注意事项
lingo中变量默认是非负的
示例
model:
max = 2*x1 + 3*x2;
2*x1 + x2 < 8;
4*x1 + 3*x2 < 15;
end
数组型变量
集合段、数据段、目标与约束段、计算段、初始段和子模型段
model:
sets:
s/1..10/:x;
endsets
data:
x = 1 2 3 4 5 6 7 8 9 10;
enddata
min = @sum(s(i):x(i));
end
model:
sets:
a/1..2/:;
b/1..3/:;
C(a,b):x;
endsets
data:
x = 1 2 3
4 5 6;
enddata
@sum(c(i,j):x(i,j)) > 10;
end
model:
sets:
a/1..2/:;
b/1..3/:;
C(a,b):x;
endsets
@for(b(j): @sum(a(i):x(i,j))>10 );
end