Topic
  • 7 replies
  • Latest Post - ‏2013-05-07T18:25:49Z by Petr Vilím
SystemAdmin
SystemAdmin
378 Posts

Pinned topic Min-max or max-min programming

‏2009-04-27T19:06:52Z |

[badraali said:]

Hello,
I am new in this forum and I don't know if this question was already asked. I would like to know if there is min-max or max-min function in ILOG OPL studio and how can it be used? If there doesn't exist, is there another way to rewrite them in order to solve them with OPL?
Best regards.
Updated on 2009-04-27T22:49:51Z at 2009-04-27T22:49:51Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    378 Posts

    Re: Min-max or max-min programming

    ‏2009-04-27T19:53:09Z  

    [jfk said:]

    Hello,
    there is no 1 max-mix or max-min function but you can do something like:


    dvar int x[1..20] in 0..20;

    minimize
      max(i in 1..20) x[i];

    subject to
    {
    sum(i in 1..20) x[i]==30; 
    }


    and the reverse maximize-min as well.


    I hope it helps

    cheers
  • SystemAdmin
    SystemAdmin
    378 Posts

    Re: Min-max or max-min programming

    ‏2009-04-27T22:49:51Z  

    [jfk said:]

    Hello,
    there is no 1 max-mix or max-min function but you can do something like:


    dvar int x[1..20] in 0..20;

    minimize
      max(i in 1..20) x[i];

    subject to
    {
    sum(i in 1..20) x[i]==30; 
    }


    and the reverse maximize-min as well.


    I hope it helps

    cheers

    [badraali said:]

    Thanks jfk,
    your answer is helpful.
    cheers
  • Aaronlidebiao
    Aaronlidebiao
    5 Posts

    Re: Min-max or max-min programming

    ‏2013-05-01T16:49:19Z  

    [jfk said:]

    Hello,
    there is no 1 max-mix or max-min function but you can do something like:


    dvar int x[1..20] in 0..20;

    minimize
      max(i in 1..20) x[i];

    subject to
    {
    sum(i in 1..20) x[i]==30; 
    }


    and the reverse maximize-min as well.


    I hope it helps

    cheers

    Hi, 

    If I add one more variable y[i], and write the objective function as

    "

    minimize 

    max (i in 1..20) (x[i], y[i]);

    "

    The Cplex IDE indicated there is a error. Any suggestion about that?

     

    Regards,

    Aaron

  • Petr Vilím
    Petr Vilím
    14 Posts

    Re: Min-max or max-min programming

    ‏2013-05-02T09:02:24Z  

    Hi, 

    If I add one more variable y[i], and write the objective function as

    "

    minimize 

    max (i in 1..20) (x[i], y[i]);

    "

    The Cplex IDE indicated there is a error. Any suggestion about that?

     

    Regards,

    Aaron

    Hello,

    as I just replied in another thread, it should be probably written as:

    minimize max(i in 1..20) maxl(x[i], y[i]);
    

    Best, Petr

  • Aaronlidebiao
    Aaronlidebiao
    5 Posts

    Re: Min-max or max-min programming

    ‏2013-05-02T14:27:35Z  

    Hello,

    as I just replied in another thread, it should be probably written as:

    <pre dir="ltr">minimize max(i in 1..20) maxl(x[i], y[i]); </pre>

    Best, Petr

    Thank you very much. Petr.

    Regards,

    Aaron

  • Aaronlidebiao
    Aaronlidebiao
    5 Posts

    Re: Min-max or max-min programming

    ‏2013-05-07T17:55:57Z  

    Hello,

    as I just replied in another thread, it should be probably written as:

    <pre dir="ltr">minimize max(i in 1..20) maxl(x[i], y[i]); </pre>

    Best, Petr

    Hi  Petr,

    If I wrote as

    "

     

    range I=1..6; 
    range J=1..5; 
     
    int Corx[I]=...;
    int Cory[I]=...;
     
    dvar boolean x[I][J];
     
    Minimize
         sum(i,m in I) (max(j in J) (maxl(abs(x[i][j]*Corx[i]-x[m][j+1]*Corx[m]), abs(x[i][j]*Cory[i]-x[m][j+1]*Cory[m]))));
         

    "

    There still has a error. What I want to do is to minimize the sum of the maximum value? What do you suggest?

    Thanks.

     

    Regards,

    Debiao Li

  • Petr Vilím
    Petr Vilím
    14 Posts

    Re: Min-max or max-min programming

    ‏2013-05-07T18:25:49Z  

    Hi  Petr,

    If I wrote as

    "

     

    range I=1..6; 
    range J=1..5; 
     
    int Corx[I]=...;
    int Cory[I]=...;
     
    dvar boolean x[I][J];
     
    Minimize
         sum(i,m in I) (max(j in J) (maxl(abs(x[i][j]*Corx[i]-x[m][j+1]*Corx[m]), abs(x[i][j]*Cory[i]-x[m][j+1]*Cory[m]))));
         

    "

    There still has a error. What I want to do is to minimize the sum of the maximum value? What do you suggest?

    Thanks.

     

    Regards,

    Debiao Li

    Hello,

    what kind of error do you get? I get the following error: Index out of bound for array "x(1)": 6.

    And indeed, if j=5 then x[i][j+1] is using as second index value 6 that is out of bound.

    Petr