Topic
  • 2 replies
  • Latest Post - ‏2013-11-20T08:11:25Z by heidizh
heidizh
heidizh
4 Posts

Pinned topic How to express it using CPLEX?

‏2013-11-20T02:17:13Z |

 

I have a problem to express my objective using CPLEX, and I am not sure that if it could be expressed by CPLEX or  CP. Help me please!

I want to minimize the objective, Ui or Uj is the only decision variable. Others are all input numbers.

The two attachments have the same content with different extensive names.

 Please give me some help, I'll be very appreciated for that. 

Attachments

  • AlexFleischer
    AlexFleischer
    56 Posts
    ACCEPTED ANSWER

    Re: How to express it using CPLEX?

    ‏2013-11-20T07:57:14Z  

    Hi,

    let me give you a small example:

    using CP;

    execute
    {
     cp.param.timelimit=20;
    }  


    int n=5;
    float p=0.5;
    int d[i in 0..n][j in 0..n]=i+j;

    dvar int u[1..n] in 1..10;

    minimize
      sum(j in 1..n) p*d[0][j]*pow(1-p,u[j]-1)+
      sum(ordered i,j in 1..n) p*p*d[i][j]*pow(1-p,abs(u[i]-u[j])-1);
     
    subject to
    {
    }

     

    Alex Fleischer

  • AlexFleischer
    AlexFleischer
    56 Posts

    Re: How to express it using CPLEX?

    ‏2013-11-20T07:57:14Z  

    Hi,

    let me give you a small example:

    using CP;

    execute
    {
     cp.param.timelimit=20;
    }  


    int n=5;
    float p=0.5;
    int d[i in 0..n][j in 0..n]=i+j;

    dvar int u[1..n] in 1..10;

    minimize
      sum(j in 1..n) p*d[0][j]*pow(1-p,u[j]-1)+
      sum(ordered i,j in 1..n) p*p*d[i][j]*pow(1-p,abs(u[i]-u[j])-1);
     
    subject to
    {
    }

     

    Alex Fleischer

  • heidizh
    heidizh
    4 Posts

    Re: How to express it using CPLEX?

    ‏2013-11-20T08:11:25Z  

    Hi,

    let me give you a small example:

    using CP;

    execute
    {
     cp.param.timelimit=20;
    }  


    int n=5;
    float p=0.5;
    int d[i in 0..n][j in 0..n]=i+j;

    dvar int u[1..n] in 1..10;

    minimize
      sum(j in 1..n) p*d[0][j]*pow(1-p,u[j]-1)+
      sum(ordered i,j in 1..n) p*p*d[i][j]*pow(1-p,abs(u[i]-u[j])-1);
     
    subject to
    {
    }

     

    Alex Fleischer

    Hi, Alex, Thank you very much. You have explained it very clearly to me. It's very useful. Thank you!

     

    Best regards,

    Heidi