【发布时间】:2019-08-29 02:13:59
【问题描述】:
我的代码的最后两个函数有问题。有人可以帮我吗?
project.c:25: 文字集中的语法错误 Context: ...C ;受制于 setofitem { j in N } : Yj [ j ] >= sum { j in MathProg 模型 处理错误
param m, integer, >=0; #number of items
param n, integer, >=0; #number of buyers
set M := 1..m; #set of indices of items
set N := 1..n; #set of indices of buyers
set S {1..n}; #subset of j
param k {M}; #seller's supply (fortinura venditore )
param v {N}; #given value of j for_SJ
var C >=0;
var Pj {N} >=0; #paymemt of buyer j
var Yj {N}, binary; #1if obtains preferred subset Sj
var Xij {M,N}, binary; #1if J obtains an item i #supply costants
subject to production {i in M}:
sum {j in N} Xij[i,j] <= k[i];
subject to payment {j in N}: #no more than Vj
Pj[j] <= v[j] * Yj[j];
subject to anyotherbuyer {j in N}:
Pj[j] <= C;
#subject to setofitem {j in N}:
#Yj[j] >= sum {j in N} Xij[i,j] - (|S[j]|-1) ;
#subject to any {j in N}:
#C <= v[j]*Yj[j] +(1-Yj[j]) * sum {j in N} v[j] ;
maximize revenue:
sum {j in N} Pj[j];
solve;
printf "the objective function value is %.3f\n", revenue;
end;
【问题讨论】:
标签: glpk