ILOG CPLEX .NET Reference Manual

Cplex.HeuristicCallback.SetSolution Method (INumVar[], Double[], Int32, Int32)

Injects a solution to be used as the potential new incumbent from an array that may possibly contain other elements.

protected virtual void SetSolution(
   INumVar[] vars,
   double[] vals,
   int start,
   int num
);

Parameters

vars
An array containing variables whose solution values are specified.
vals
An array containing the solution values for the variables specified in vars. vals[j] specifies the solution value for vars[j] for j in start through start+num-1.
start
The index of the first element to consider in arrays vars and vals.
num
The number of consecutive elements to consider in arrays vars and vals.

Remarks

The injected solution is specified by providing solution values for all variables in the model. The array used to specify the values may contain more elements; in that case, use the argument start to specify the starting element and the argument num to specify the number of consecutive elements to use.

If a user heuristic is successful in finding a new candidate for an incumbent, it can be passed to Cplex by the method setSolution. Cplex analyzes the solution and, if it is both feasible and better than the current incumbent, Cplex uses it as the new incumbent. A solution is specified using arrays vars and vals, where vals[i] specifies the solution value for vars[i].

Do not call this method multiple times. Calling it again overwrites any previously specified solution.

See Also

Cplex.HeuristicCallback Class | ILOG.CPLEX Namespace | Cplex.HeuristicCallback.SetSolution Overload List