OPL CPLEX中的epsilon-constraint方法

时间:2017-07-11 20:10:27

标签: cplex ibm-ilog-opl

我想用ILOG OPL中的epsilon-constraint方法编写双目标问题,有没有样本可以帮助我? 感谢

1 个答案:

答案 0 :(得分:0)

int n=10;
int m=25;

range position = 0..n-1;

dvar boolean x[position][position];
dvar float obj1 in position;
dvar float obj2 in position;

minimize (obj1)*n+obj2;

subject to
{
  sum(i,j in position) x[i][j]==m;

  forall(i,j in position) (x[i][j]==1) => (obj1>=i);

  forall(i,j in position) (x[i][j]==1) => (obj2>=j);
}



 execute
 {
 writeln("objectives : ",obj1+1," ",obj2+1);
 }

 main
 {
   var epsilon=0.0001; 

   thisOplModel.generate();
   cplex.setObjCoef(thisOplModel.obj2,0);
   cplex.solve();
   thisOplModel.postProcess();
   var obj1=thisOplModel.obj1.solutionValue;
   thisOplModel.obj1.LB=obj1;
   thisOplModel.obj1.UB=obj1+epsilon;
   cplex.setObjCoef(thisOplModel.obj2,1);
   cplex.solve();
   thisOplModel.postProcess();

 }

给出了

objectives : 3 10
 objectives : 3 9