[AMPL 2121] Options unsetting during the script execution

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[AMPL 2121] Options unsetting during the script execution

Stefano Coniglio

Greetings,

I've got a maybe pretty obvious question (with related problem) but I
can't find any help in the manual. At least, not where I'm looking at.

I'm running a script which solves two different LPs somewhat in an
intertwined iterating sequence.
I'm expecting some options to suddenly unsed while the script runs.

For instance, the
option display_1col 0;
option which I set at the beginning of the script needs to be reset
somewhere in the middle of it to remake it active.

Something similar happens with some variables I'm fixing with a plain
fix, for which the fix setting just disappears after some point. (At
the moment I am menaging it by just refixing it).

Even more strange: over a fixed set of iterations I sometimes obtain
different solutions just by commenting or decommenting a display
command somewhere in the script.

I think the overall problem could be due the bad way I'm handling the
interaction between the two problems, in terms of the "environment"
command (which at the moment I tried to use but provided no help).

Maybe you did encounter something similar in your experience...

Thanks a lot,
-Stefano Coniglio

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

Reply | Threaded
Open this post in threaded view
|

[AMPL 2130] Re: Options unsetting during the script execution

Robert Fourer-2


I can't be sure without seeing the details of your script, but most likely
it is the environment feature that is causing the changes to the option
settings.  Each named environment "remembers" all of the options that are
set when it is active, and restores all of those options whenever it is
reactivated.  So you have to be sure that you set each environment's options
while that environment is active.

If you are also declaring named problems (via the "problem" command) then
each problem will remember the fix/unfix status of the variables, and will
restore this status whenever it is made the current problem.

Display commands don't have any effect on solutions, but if you are not
resetting everything then running a script a second time can produce
different results.  For example an optimal basis or solution from one run
might serve as a starting point for the second run.

Bob Fourer
[hidden email]


> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of
> Stefano Coniglio
> Sent: Wednesday, December 10, 2008 1:00 PM
> To: AMPL Modeling Language
> Subject: [AMPL 2121] Options unsetting during the script execution
>
>
> Greetings,
>
> I've got a maybe pretty obvious question (with related problem) but I
> can't find any help in the manual. At least, not where I'm looking at.
>
> I'm running a script which solves two different LPs somewhat in an
> intertwined iterating sequence.
> I'm expecting some options to suddenly unsed while the script runs.
>
> For instance, the
> option display_1col 0;
> option which I set at the beginning of the script needs to be reset
> somewhere in the middle of it to remake it active.
>
> Something similar happens with some variables I'm fixing with a plain
> fix, for which the fix setting just disappears after some point. (At
> the moment I am menaging it by just refixing it).
>
> Even more strange: over a fixed set of iterations I sometimes obtain
> different solutions just by commenting or decommenting a display
> command somewhere in the script.
>
> I think the overall problem could be due the bad way I'm handling the
> interaction between the two problems, in terms of the "environment"
> command (which at the moment I tried to use but provided no help).
>
> Maybe you did encounter something similar in your experience...
>
> Thanks a lot,
> -Stefano Coniglio
>



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

Reply | Threaded
Open this post in threaded view
|

[AMPL 2132] Re: Options unsetting during the script execution

damoft


Hi,my name is Diego David i´m from colombia-cali (Valle University), and i´m new in AMPL.
 
Pleese somebody help me, i have a small problem,it´s so tiny. i want give a value to a binary varible idexed by to sets. Example Yij when i=[1,..,5] and j=[1,...,4], then i want that Y(3,2)=0 and Y(1,4)=0 like a constrain, in the first case i = 1 and j=2.

 how can i write this in AMPL?.

 


Comparte hasta 500 fotos en un solo email con Windows Live
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

[AMPL 2134] Re: Options unsetting during the script execution

Paul A. Rubin

Diego,

Just for future reference, it is better to start a new thread with a
question like this, rather than replying to a message in a thread that
is unrelated to your question.  :-)

If I understood you correctly, you want something like the following:

set I := 1..5;
set J := 1..4;
var Y {I, J} binary;
# other model declarations here
s.t. constraint1: Y[3,2] = 0;
s.t. constraint2: Y[1,4] = 0;

If you have a specific subset of (i,j) pairs for which you know at the
outset that Y must be zero, you could declare them in a set, as
follows:

set I := 1..5;
set J := 1..4;
set Yzero within I cross J;
let Yzero := {(3,2), (1,4)};
var Y {I, J} binary;
# other model declarations here
s.t. KnownZero {(i,j) in Yzero}: Y[i,j] = 0;

If the known zeros have a pattern, you may be able to compute Yzero
rather than having to list all its members.  For instance, if Y[i,j]
is zero when i + j = 5, you could replace the initialization of Yzero
with

let Yzero := {(i,j) in I cross J : i + j = 5};

/Paul


On Dec 22, 12:57 pm, diego david lozano <[hidden email]> wrote:
> Hi,my name is Diego David i´m from colombia-cali (Valle University), and i´m new in AMPL.
>
> Pleese somebody help me, i have a small problem,it´s so tiny. i want give a value to a binary varible idexed by to sets. Example Yij when i=[1,..,5] and j=[1,...,4], then i want that Y(3,2)=0 and Y(1,4)=0 like a constrain, in the first case i = 1 and j=2.
>
>  how can i write this in AMPL?.
>
> _________________________________________________________________
> Sé el primero en tener el nuevo Windows Live Messengerhttp://download.live.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---