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

[AMPL 2540] Re: Condicions in AMPL function

by Paul A. Rubin :: Rate this Message:

Reply to Author | View in Thread


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