Goals and Callbacks in CPLEX+Java: Nonlinear Pre-processing

I have a problem in which I want to insert new solutions in CPLEX. Originally, I did this using a Heuristic Callback. The problem here is that the following is ignored:

model.setParam(IloCplex.Param.Preprocessing.Linear,1); 

(I know that this happens because of the Control Callback). The problem is: The non-linear preprocessing would help me a lot to bring down the lower bound on the cost (otherwise, I cannot prove optimality).

I did some research online, and found that I can also add a solution using Goals, in particular Solution Goals.

I now use a Solution goal, which in brevity looks as follows:

private class InsertSolution2 extends IloCplex.Goal {     @Override     public IloCplex.Goal execute(IloCplex iloCplex) throws IloException {         if (nextSolution != null) {             System.out.println("In Solution Goal: Next Solution Exists");             //inject solution             //set values for vars and vals             nextSolution = null;             return cplex.solutionGoal(vars, vals);         }         return null;     } } 

I then add this to cplex.solve(new InsertSolution2())

This gives me a few problems (but I am a complete beginner with goals …)

  • Is the above correct?
  • How is it implemented in the backend? It still ignores the preprocessing … Is there an alternative which allows non-linear preprocessing?
  • Is this in conflict with start solutions? My start solutions are now being ignored …

Thank you! Layla

Add Comment
1 Answer(s)

I don’t think that using goals is going to help you. Goals are implemented using callbacks, so there is nothing you can achieve with goals that you cannot achieve with callbacks.

But instead of using the heuristic callback to inject a feasible solution you could try to use the new generic callback framework. This framework was designed to overcome exactly the problem you describe. In this framework you can for example active the GLOBAL_PROGRESS context and post heuristic solutions from there. See the AdMIPex9.java example that ships with CPLEX for an example of how to inject feasible solutions from the generic callback during tree search.

Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.