Use an indexed parameter: In your model section declare:
set IdxWeeks; param weeks[IdxWeeks]; and in your data section have: param : IdxWeeks : weeks := 1 1 2 4 3 8 4 11 ; -----Original Message----- From: Help-glpk [mailto:[email protected]] On Behalf Of Andrew Makhorin Sent: Sunday, May 01, 2016 12:19 PM To: [email protected] Subject: [Help-glpk] [Fwd: One Dimensional Set Ordering] -------- Forwarded Message -------- From: Curtis Passorelli <[email protected]> To: [email protected] Subject: One Dimensional Set Ordering Date: Sun, 1 May 2016 11:36:39 -0400 Hello, I have a discrete set. set weeks:={1,4,8,11}; What I want to do is create a parameter to access the i-th element of the set. weeks[1] = 1, weeks[2] = 4, weeks[3] = 8 and weeks[4] = 11. I want to do this assignment dynamically because these week numbers will change each time new data is entered into the model. Do you have any suggestions or code? _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk This e-mail and any attachments may be confidential or legally privileged. If you received this message in error or are not the intended recipient, you should destroy the e-mail message and any attachments or copies, and you are prohibited from retaining, distributing, disclosing or using any information contained herein. Please inform us of the erroneous delivery by return e-mail. Thank you for your cooperation. _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
