help-glpk
[Top][All Lists]

## [Help-glpk] Is there a simpler way to write this s.t. in MathProg, can m

 From: P PO1434 Subject: [Help-glpk] Is there a simpler way to write this s.t. in MathProg, can models be output in C Date: Sat, 18 Feb 2006 01:45:46 +0000

```Hi group

Question 1
Is is possible to take eg. the MPS format model and convert it into C?

Question 2
```
I have written some staff scheduling MathProg code - straightforward shift start time to match demands by hour of day. The subject to section needs to check demand for staff required against staff on deck ie. could be staff from an earlier shift who haven't finished yet.
```
```
The code below works fine, but I was just wondering whether there is a better way to code this..
```
There are 2 shift types (4hr and 8hr), over a 0400 to 2300 day:

subject to

```
S04: sum{period in 04..04} starts[period,4] + sum{period in 04..04} starts[period,8]>=demand; S05: sum{period in 04..05} starts[period,4] + sum{period in 04..05} starts[period,8]>=demand; S06: sum{period in 04..06} starts[period,4] + sum{period in 04..06} starts[period,8]>=demand; S07: sum{period in 04..07} starts[period,4] + sum{period in 04..07} starts[period,8]>=demand; S08: sum{period in 05..08} starts[period,4] + sum{period in 04..08} starts[period,8]>=demand; S09: sum{period in 06..09} starts[period,4] + sum{period in 04..09} starts[period,8]>=demand; S10: sum{period in 07..10} starts[period,4] + sum{period in 04..10} starts[period,8]>=demand; S11: sum{period in 08..11} starts[period,4] + sum{period in 04..11} starts[period,8]>=demand; S12: sum{period in 09..12} starts[period,4] + sum{period in 05..12} starts[period,8]>=demand; S13: sum{period in 10..13} starts[period,4] + sum{period in 06..13} starts[period,8]>=demand; S14: sum{period in 11..14} starts[period,4] + sum{period in 07..14} starts[period,8]>=demand; S15: sum{period in 12..15} starts[period,4] + sum{period in 08..15} starts[period,8]>=demand; S16: sum{period in 13..16} starts[period,4] + sum{period in 09..16} starts[period,8]>=demand; S17: sum{period in 14..17} starts[period,4] + sum{period in 10..17} starts[period,8]>=demand; S18: sum{period in 15..18} starts[period,4] + sum{period in 11..18} starts[period,8]>=demand; S19: sum{period in 16..19} starts[period,4] + sum{period in 12..19} starts[period,8]>=demand; S20: sum{period in 17..20} starts[period,4] + sum{period in 13..20} starts[period,8]>=demand; S21: sum{period in 18..21} starts[period,4] + sum{period in 14..21} starts[period,8]>=demand; S22: sum{period in 19..22} starts[period,4] + sum{period in 15..22} starts[period,8]>=demand; S23: sum{period in 20..23} starts[period,4] + sum{period in 16..23} starts[period,8]>=demand;
```
```
I was hoping to do something that would avoid using the hardcoded shift starts, and shift lengths (4,8).....
```
Thanks for you help in advance

Pete

```