数学建模常用Matlab/Lingo/c代码总结系列——整数规划问题

 

model: 
sets: 
row/1..4/:b; 
col/1..5/:c1,c2,x; 
link(row,col):a; 
endsets 
data: 
c1=1,1,3,4,2; 
c2=-8,-2,-3,-1,-2; 
a=1 1 1 1 1 
     1 2 2 1 6 
     2 1 6 0 0 
     0 0 1 1 5; 
b=400,800,200,200; 
enddata 
max=@sum(col:c1*x^2+c2*x); 
@for(row(i):@sum(col(j):a(i,j)*x(j))<b(i)); 
@for(col:@gin(x)); 
@for(col:@bnd(0,x,99)); 
end 



你可能感兴趣的:(c)