我正在尝试为到期日期调度问题制作模型。数学解决方案是众所周知的,可以在这里找到:http: //www.stomp9.fr/master/benchmarc.pdf
我的代码看起来已经不错了,但是我在第 20 行遇到了一个错误,说 max() 的参数无效。我已经阅读了手册并查看了示例,但看起来还不错。
有人知道这个问题吗?
# $ glpsol -m file.mod [-d arquivo-dados] -o file.mod.out.txt
param d; # Due Date
param R; # "BigR"
param n; # n-1 tasks
param N; # n tasks
set TASKS;
param p{ TASKS };
param a{ TASKS };
param b{ TASKS };
# Contraint 6
var s{ TASKS } >= 0;
var E{ TASKS } >= 0;
var T{ TASKS } >= 0;
# Contraints 2 and 3
# Payoff {s in STATES[nPeriods]} : C[nPeriods,s] >= max(0, S[nPeriods,s] - Kstrike);
EARLYS { t in TASKS } : E[t] = max(0, d - (s[t] + p[t]) );
TARDIS { t in TASKS } : T[t] = max(0, (s[t] + p[t]) - d);
# Constraint 7
var X{ TASKS, TASKS } binary;
# Constraints 4 and 5
s.t. iB4k { i in 1..n, k in n+1..N }: s[i] + p[i] <= s[k] + R * (1 - X[i,k]);
s.t. kB4i { i in 1..n, k in n+1..N }: s[k] + p[k] <= s[1] + R * X[i,k];
minimize penaltyes: sum{ t in TASKS } ( a[t]*E[t] + b[t]*T[t]);
solve;
printf "DueDate = %4d\n", d;
printf "BigR = %4d\n", R;
printf { t in TASKS } "p[%2d] a[%2d] b[%2d]\n", p[t], a[t], b[t];
data;
param d := 23; # Due Date
param R := 117; # "BigR" => Whole schedule time + 1
param n := 9; # n-1 tasks
param N := 10; # n tasks
param: TASKS : p a b :=
1 20 4 5
2 6 1 15
3 13 5 13
4 13 2 13
5 12 7 6
6 12 9 8
7 12 5 15
8 3 6 1
9 12 6 8
10 13 10 1;
end;