« Return to Thread: [AMPL 2536] Condicions in AMPL function

[AMPL 2541] Re: Condicions in AMPL function

by plozmar :: Rate this Message:

Reply to Author | View in Thread


Thanks so much, but now I have problems with the parameter M because
it makes that the result optimization of the variables x and y
changes, I don´t know why. I take a big number (sufficiently large
that |x-y|) the values of x and y changes (and the program doesn´t
work ok) Why is it?

Thanks for all

On 26 mayo, 22:37, Paul <ru...@...> wrote:

> I assume x and y are variables?  You'll need to introduce a binary
> variable.
>
> var z;  # objective value
> var b binary;  # decides which of x and y is smaller
> param M > 0;  # sufficiently large parameter that |x-y| < M for all
> feasible x, y
>
> minimize totalcost: z;
> s.t. IfXSmaller: z >= x - M*b;
> s.t. IfYSmaller: z >= y - M*(1-b);
>
> On May 26, 5:12 am, plozmar <lozano_pal...@...> wrote:
>
>
>
> > Hi,
> > now I want to make this, using CPLEX
>
> > minimize totalcost:
>
> >  min(x,y)
>
> > How can I implement this statement? Can I with this solver?
>
> > Thanks to all,- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -

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

 « Return to Thread: [AMPL 2536] Condicions in AMPL function