12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

IloMPModeler.setLinearCoefs, and IloMPModeler.addToExpr apply in thissituation.The type of a variable cannot be changed. However, it can be overwritten for a particularmodel by adding an IloConversion object, which allows you to specify new types forvariables within that model. When <strong>ILOG</strong> <strong>CPLEX</strong> finds a conversion object in the activemodel, it uses the variable types specified in the conversion object instead of the originaltype specified for the optimization. For example, in a model containing the following lines,<strong>ILOG</strong> <strong>CPLEX</strong> will only generate solutions where variable x is an integer (withintolerances), yet the type returned by x.getType will remain IloNumVarType.Float.IloNumVar x = cplex.numVar(0.0, 1.0);cplex.add(cplex.conversion(x, IloNumVarType.Int));A variable can be used only in at most one conversion object, or the model will no longer beunambiguously defined. This convention does not imply that the type of a variable can bechanged only once and never again after that. Instead, you can remove the conversion objectand add a new one to implement consecutive variable type changes. To remove theconversion object, use the method IloModel.remove.<strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL 95

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!