我希望这对某人来说是显而易见的。我只使用了GLPK / MathProg。 我无法弄清楚GNU MathProg(在GLPK中)的语法来执行以下操作,例如:
set PartsOfWeek;
set WeekDays;
data;
set PartsOfWeek := WorkWeek WeekEnd;
set WorkWeek := Mon Tue Wed Thu Fri;
set WeekEnd := Sat Sun;
set WeekDays := setof{d in (WorkWeek union WeekEnd)}(d);
问题在于MathProg拒绝了这一点。
一般来说,我只希望能够: - 声明一个Partition(这里是PartsOfWeek)和一个set(这里是Weekdays) - 从数据构建分区 - 使用分区中集合的元素填充集合。
更好的例子可能是季节和月份。
答案 0 :(得分:8)
@ ALi的文献参考帮助:
set seasons;
set months;
set monthsOfseason {seasons} within months;
data;
set seasons := winter spring summer fall;
set months := jan feb mar apr may jun jul aug sep oct nov dec;
set monthsOfseason[winter] := dec jan feb;
set monthsOfseason[spring] := mar apr may;
set monthsOfseason[summer] := jun jul aug;
set monthsOfseason[fall] := sep oct nov;