[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## [Help-glpk] A couple of simply MathProg questions

**From**: |
Harley Mackenzie |

**Subject**: |
[Help-glpk] A couple of simply MathProg questions |

**Date**: |
Thu, 26 Jan 2006 16:34:49 +1100 |

I have a couple of pretty fundamental MathProg questions that seem simple but I
cant find a solution in the manual:
Given a set:
set SB := SP1 SP2 SP3 SP4 SP5 SP6 SP7 SP8 SP9 SP10 SP11 SP12
SP13 SP14 SP15 SP16 SP17 SP18 SP19 SP20 SP21 SP22 SP23 SP24 SP25
SP26 SP27 SP28 SP29 SP30 SP31 SP32 SP33 SP34 SP35 SP36 SP37 SP38
SP39 SP40 SP41 SP42 SP43 SP44 SP45 SP46 SP47 SP48 SP49 SP50;
1. Is there an operator to tell me the number of symbols in the set. The only
solution I have come up with is "sum {sb in SB} 1", but I think there may be a
better way.
2. How do I write an iteration statement to sum all of the elements except the
last one. Again the only solution I have come up with is: "sum {sb in SB: sb !=
'SP50'}" but this ties the model to a specific value "SP50" in the model and I
want to vary the number of elements in SB so the terminal value "SP50" will
change and the change is required in the model section not the data section. Is
there a way of writing this without having to change the model for different
numbers of elements in SB?
Thanks,
Harley
------------------------------------------------------------------
Dr. Harley Mackenzie ACN: 087 953 839
ABN: 27 087 953 839
HARD Software Web: www.hardsoftware.com
207 Noble Street Tel: +61 3 5222 3435
Newtown 3220, Australia Email: address@hidden
------------------------------------------------------------------

**[Help-glpk] A couple of simply MathProg questions**,
*Harley Mackenzie* **<=**