求解器 – GLPK MathProg集和组

我希望这对某人来说是显而易见的.我只使用了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)
– 从数据构建分区
– 使用分区中的集合元素填充集合.

一个更好的例子可能是季节和月份.

与@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;
相关文章
相关标签/搜索