[AMPL 2878] Repetition of objects in set

View: New views
2 Messages — Rating Filter:   Alert me  

[AMPL 2878] Repetition of objects in set

by Max-176 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello everybody.
I've a question:
is it possible in AMPL to generate ordered sets with the repetition
set members of the same set?
For example,
model;
set LINKS ordered;
set POINTS ordered within LINKS;

data;
set LINKS := L1 L2 L3 L4;
set POINTS:= L1 L1 L2 L3 L3 L2 L4;

Thanks
Best Regards
Max

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@...
To unsubscribe from this group, send email to ampl+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---


[AMPL 2882] Re: Repetition of objects in set

by Robert Fourer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



1. A set cannot have repeated members, even if they are ordered.  So the
examples LINKS in the first query and POINTS in the second will be rejected
with an error message.  However you can define a symbolic parameter, indexed
over an ordered set, that contains the intended set members.  For example:

   param nPOINTS integer > 0;
   set LINKS;
   param POINTS {1..nPOINTS} symbolic in LINKS;

The data would be:

   param nPOINTS := 7;
   set LINKS := L1 L2 L3 L4;
   param POINTS := 1 L1 2 L1 3 L2 4 L3 5 L3 6 L2 7 L4;

2. Sets of pairs cannot be ordered.

Bob Fourer
4er@...


> -----Original Message 1-----
> From: ampl@... [mailto:ampl@...]
> On Behalf Of Josip.Lorincz [josip.lerinc@...]
> Sent: Wednesday, October 14, 2009 5:06 AM
> To: ampl@...
> Subject: [AMPL 2879] Repetition set members
>
> Respected,
> i have 2 questions:
> 1. is it possible in AMPL to generate ordered sets with repetition set
> members,
> for example:
> data;
> set LINKS:= L1 L1 L2 L1 L3 L4 L2;
>
> 2. is it possible in AMPL to generate set of pairs of members which will
> be
> ordered, for example:
> model;
> set COSTUM ordered within {LP_PAIRS};
>
> data;
> set COSTUM := L1,P1 L1,P2 L2,P1 L2,P2;
> Thanks in advance.
> Best regards.
> Josip
> --
> View this message in context: http://www.nabble.com/Repetition-set-
> members-tp25887497p25887497.html
> Sent from the AMPL mailing list archive at Nabble.com.
>


> -----Original Message 2-----
> From: ampl@... [mailto:ampl@...]
> On Behalf Of Max [m.bogarelli@...]
> Sent: Wednesday, October 14, 2009 9:26 AM
> To: AMPL Modeling Language
> Subject: [AMPL 2878] Repetition of objects in set
>
> Hello everybody.
> I've a question:
> is it possible in AMPL to generate ordered sets with the repetition
> set members of the same set?
> For example,
> model;
> set LINKS ordered;
> set POINTS ordered within LINKS;
>
> data;
> set LINKS := L1 L2 L3 L4;
> set POINTS:= L1 L1 L2 L3 L3 L2 L4;
>
> Thanks
> Best Regards
> Max
>



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@...
To unsubscribe from this group, send email to ampl+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---