各位优化师您好!
我在以下约束方面遇到了一些问题:
#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 未定义(对我来说, l[i,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 l[1,0,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 文件中(并且仅设置 TT; 在 .mod 中),这也给出了错误。有人知道如何做到这一点吗?