I have a binary decision variable X and I need to convert it into a continuous variable so it can take continuous values between 0 and 1 (i.e. 0.3). I need to learn how to change a decision variable type in the OPL script part.
See example
//Now let's see how easy it is to relax integrity constraints and
//turn a MIP into LP, solve and get dual value (shadow price)
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); } }