你好,各位乐观主义者!
我对以下约束有一些问题:
#The supply at node i equals what was present at the last time period + any new supply and subtracted by what has been extracted from the node.
subject to Constraint1 {i in I, t in T, c in C}:
l[i,t-1,c] + splus[i,t] - sum{j in J, v in V, a in A} x[i,j,v,t,c,a]= l[i,t,c];这自然导致这个约束在它第一次循环时提供错误,因为t-1没有定义(对于我来说,li,0,c没有定义。哪里
var l{I,T,C} >= 0; # Supply at supply node I in time period T for company C.
param splus{I,T}; # Additional supply at i.
var x{N,N,V,T,C,A} integer >= 0; #Flow from some origin within N to a destination within N using vehicle V, in time T, for company C and product A.集合T;(在.mod中)是定义为:
set T := 1 2 3 4 5 6 7; in the .dat file我试过这样做:
subject to Constraint1 {i in I, t in T: t >= 2, c in C}:
all else same这给我带来了语法错误。我还尝试为所有可能的组合包括"let 101,1 := 0“,这使我产生了错误
error processing var l[...]:
no data for set I我也试过
subject to Constraint1 {i in I, t in T, p in TT: p>t, c in C}:
l[i,t,c] + splus[i,p] - sum{j in J, v in V, a in A} x[i,j,v,p,c,a]= l[i,p,c];哪里
set TT := 2 3 4 5 6;在.dat文件中(仅在.mod中设置TT;),这也会导致错误。有人知道怎么做吗?
发布于 2014-10-15 17:40:02
解决这个问题的一种方法是在索引表达式的末尾指定条件t >= 2:
subject to Constraint1 {i in I, t in T, c in C: t >= 2}:
...有关索引表达式语法的更多详细信息,请参见A.3节索引表达式和下标。
https://stackoverflow.com/questions/26381629
复制相似问题