Namespace: ILOG.Concert
Assembly: ILOG.CPLEX (in ILOG.CPLEX.dll) Version: 22.1.1.0
Syntax
Remarks
After you create a conversion object, you must explicitly add the object to your model and extract the object so that CPLEX takes it into account. To add the conversion object to your model, use the appropriate overload of the method IModel.Add.
When a variable is created, its type is determined to be one of Int, Float, or Bool. The type of a variable can be queried with the method INumVar.GetType(). It cannot be changed throughout the lifetime of the variable.
However, it is sometimes necessary to consider a model where, for example, some integer variables are relaxed to be continuous. This is achieved using objects of type IConversion. By adding an IConversion object to a model, you can change the types of the variables represented in the IConversion object for that model only. When solving the model, the changed types are used instead of the original types of the variables. Method INumVar.GetType() still returns the original variable types.
The type of a variable can be changed only once per model. An attempt to add more than one IConversion object to a model containing the same variable will cause an exception to be thrown.
To change the type of a variable more than once, you must remove the existing IConversion object before adding a new IConversion object. Removing the conversion object for a variable from the model will re-instantiate the original type of variable within that model.
For an example of conversion in use, see the sample AdMIPex6.cs distributed with the product.