[AMPL 2779] relxing binary restriction only for some time periods

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

[AMPL 2779] relxing binary restriction only for some time periods

by rami_asad_80 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

I am currently facing some difficulties in retricting the value of a
deicison variable to binary (zero or one) only in some time periods.
For example, in a production planning mode, I have a variable which is
defined over three sets: raw material, finished products and time, as
follows:

  var  y{raw, finish, time}

Now, i am trying to restrict the value of this variable to binary only
in the first time period and keep it continous for the time periods
starting from period 2 till the end of the planning horizon (T). What
i did is the following:

 var  y{raw, finish, first} binary;
 var  y{raw, finish, first+1..last} >= 0;

 However, AMPL does not execite the above command and gives an error.
Any ideas on how to do this please?
 Thanks a lot in advance.

--~--~---------~--~----~------------~-------~--~----~
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 2788] Re: relxing binary restriction only for some time periods

by Robert Fourer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



As this example shows, AMPL does not provide for defining the same variable
twice with different indexing.  There is a suffix .relax that can be used to
specify that some variables defined as integer should be instead treated as
continuous:

   var y {raw, finish, first..last} binary;
   let {r in raw, f in finish, t in first+1..last} y[r,f,t].relax := 1;

This will give all of the relaxed binary variables an upper bound of 1,
however.  A more general solution is to define a separate binary variable
and equate it to the corresponding continuous variables:

   var y {raw, finish, first..last} >= 0;
   var yf {raw, finish} binary;

   subj to yFirst {r in raw, f in finish}:
      y[r,f,first] = yf[r,f];

Bob Fourer
4er@...


> -----Original Message-----
> From: ampl@... [mailto:ampl@...]
> On Behalf Of rami [rami_asad_80@...]
> Sent: Thursday, August 27, 2009 3:53 PM
> To: AMPL Modeling Language
> Subject: [AMPL 2779] relxing binary restriction only for some time periods
>
> Hi,
>
> I am currently facing some difficulties in retricting the value of a
> deicison variable to binary (zero or one) only in some time periods.
> For example, in a production planning mode, I have a variable which is
> defined over three sets: raw material, finished products and time, as
> follows:
>
>   var  y{raw, finish, time}
>
> Now, i am trying to restrict the value of this variable to binary only
> in the first time period and keep it continous for the time periods
> starting from period 2 till the end of the planning horizon (T). What
> i did is the following:
>
>  var  y{raw, finish, first} binary;
>  var  y{raw, finish, first+1..last} >= 0;
>
>  However, AMPL does not execite the above command and gives an error.
> Any ideas on how to do this please?
>  Thanks a lot in advance.
>



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---