An instance of this class represents an algorithm for CP Optimizer.

Namespace: ILOG.CP
Assembly: ILOG.CP (in ILOG.CP.dll)

Syntax

C#
public class CP : IloModelerImpl, IModeler, IModel, 
	IAddable, ICopyable
Visual Basic
Public Class CP _
	Inherits IloModelerImpl _
	Implements IModeler, IModel, IAddable, ICopyable

Remarks

Search

CP Optimizer is designed to be used in a "model and run" fashion and as such provides a search strategy. One way of using CP is the following:

Examples

CP cp = new CP();
/// ... create Concert model ...
if (cp.Solve())
Console.WriteLine("Solution found of cost = " + cp.ObjValue());
else
Console.WriteLine("No solution found");

You can set limits on the amount of effort CP puts into finding a solution to a model by setting a parameter.
For example,

Examples

cp.SetParameter(CP.DoubleParam.TimeLimit, 60);

will limit the solve time to one minute. At the end of one minute, CP will deliver the best solution found in that time if one was found.
Access to the solution is available, through the GetValue(String) method, for example:

Examples

CP cp = new CP();

IIntVar x = cp.IntVar(0, 10);
/// ... build model
if (cp.Solve()) {
Console.WriteLine("Solution found of cost = " + cp.ObjValue());
Console.WriteLine("Value of x = " + cp.GetValue(x));
}

Other more sophisticated search techniques are available, notably search phases (CP.SearchPhase), which allow variables to be grouped according to the order in which they should be assigned in a search, and how they will be assigned.

The first creation of an CP object in a process is not multi-thread safe. All CP objects created after the first are multi-thread safe.

Inheritance Hierarchy

System..::..Object
  ILOG.Concert..::..IloModelImpl
    ILOG.Concert..::..IloModelerImpl
      ILOG.CP..::..CP

See Also