A simple question on how to define sets/vectors of indices (numbers) that I have not been able to answer using the manual: param SetKeep {i in 1..N2}; param X { i in 1..N1}; And then use these in the definition of a new variable of dimension N2: var XI { h in 1..N2} = X[SetKeep[h]]; How can I define SetKeep differently to be able to define my variable directly as: var XI { h in SetKeep} = X[SetKeep];? Can I do it without touching my .dat file (where SetKeep is defined as param)? If not, what's the syntax I need to use to define the set? Thanks for your help. -L You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/ampl. For more options, visit https://groups.google.com/d/optout. |
If the members of SetKeep are unique, then you could use set to define SetKeep as follows:
{#HS:558440862-4886#}
set setKeep :={1,2,3}; param X { setKeep}; var XI{h in setKeep}:=X[h]; data; param X := 1 4 2 5 3 2; Thanks, Paras -- Paras Tiwari [hidden email]
On Tue, Apr 10, 2018 at 4:20 PM UTC, Zeyad Kassem' Via Ampl Modeling Language <[hidden email]> wrote:
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/ampl. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |