我开始使用 Xpress Fico 工作台。model
我试图以这种方式在文件中定义一个简单的模型:
model ModelName
options noimplicit
uses "mmxprs"
! uses "mminsight" ! uncomment this line for an Xpress Insight model
declarations
! indici
indexes = 1..4
contraints = 1..2
x: array(indexes) of mpvar
c: array(indexes) of integer
A: array(contraints, indexes) of real
B: array(contraints) of real
! Objective:linctr
profit: linctr
end-declarations
!profit:=250*x1+230*x2+110*x3+350*x4
c::[250, 230, 110, 350]
profit:=sum(i in indexes) c(i)*x(i)
! 2*x1+1.5*x2+0.5*x3+2.5*x4<=100
! 0.5*x1+0.25*x2+0.25*x3+x4<=50
A::[ 2, 1.5, 0.5, 2.5,
0.5, 0.25, 0.25, 1]
B::[ 100,
50]
forall(r in contraints) do
sum(c in indexes) A(r, c) * x(c) <= B(r)! body...
end-do
writeln("Begin running model")
maximise(profit)
writeln("profit: ", getobjval)
forall(i in indexes) do
writeln("x( ", i, ")", getsol(x(i)))
end-do
writeln("End running model")
end-model
当我尝试构建文件时,我收到以下错误
Mosel: E-101 at (33,21) of `studio/esL01_01.1.mos': Incompatible types for operator (`array of integer' in `range' not defined).
Mosel: E-151 at (33,31) of `studio/esL01_01.1.mos': Incompatible type for subscript 2 of `A'.
有什么建议可以解决这个问题吗?