最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

linear programming - Reduced Costs in IBM ILOG CPLEX Optimization Studio - Stack Overflow

programmeradmin5浏览0评论

In this Stack Overflow post, they give the code to find the solution duals (shadow prices).

execute { writeln(ctMaxTotal.dual); writeln(ctMaxTotal2.dual); writeln(ctMaxChloride.dual); }

What is the command to find the reduced costs of a linear programming problem?

All of the help I found assumes that I am running CPLEX inside java or inside python. However, I am running the IBM ILOG CPLEX Optimization Studio.

In this Stack Overflow post, they give the code to find the solution duals (shadow prices).

execute { writeln(ctMaxTotal.dual); writeln(ctMaxTotal2.dual); writeln(ctMaxChloride.dual); }

What is the command to find the reduced costs of a linear programming problem?

All of the help I found assumes that I am running CPLEX inside java or inside python. However, I am running the IBM ILOG CPLEX Optimization Studio.

Share Improve this question asked Mar 11 at 11:41 David ColeyDavid Coley 32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

In oil.mod in OPL CPLEX examples you may see

execute DISPLAY_REDUCED_COSTS{
  for( var g in Gasolines ) {
    writeln("a[",g,"].reducedCost = ",a[g].reducedCost);
  }
}

or even a simpler example I wrote

int nbKids=300;
float costBus40=500;
float costBus30=400;
 
dvar int+ nbBus40;
dvar int+ nbBus30;
 
minimize
 costBus40*nbBus40  +nbBus30*costBus30;
 
subject to
{
 ctKids:40*nbBus40+nbBus30*30>=nbKids;

}

main {
  var status = 0;
  thisOplModel.generate();
  if (cplex.solve()) {
    writeln("Integer Model");   
    writeln("OBJECTIVE: ",cplex.getObjValue());   
    
  }

  // relax integrity constraint
  thisOplModel.convertAllIntVars();
 
  if (cplex.solve()) {
    writeln("Relaxed Model");   
    writeln("OBJECTIVE: ",cplex.getObjValue());  
    
    writeln("dual of the kids constraint = ",thisOplModel.ctKids.dual);
    writeln("reduced costs for nbbus40 : ",thisOplModel.nbBus40.reducedCost);
    writeln("reduced costs for nbbus30 : ",thisOplModel.nbBus30.reducedCost);
  }
   
 
}
发布评论

评论列表(0)

  1. 暂无评论