Hello,

I am using the C++ Concert technology with CPLEX (version 12.10) and I am trying to implement a generic callback capable of running an user-defined heuristic in order to boost the performances of my current formulation. The heuristic is only launched within the context

Context::Id::Relaxation. For this, I am using the postHeuristicSolution method (see below an extract of my code).
IloNumArray vals(context.getEnv());

IloNumVarArray vars(context.getEnv());
/*... fill Arrays ... */

double objVal = getHeuristicObjective();

context.postHeuristicSolution(vars, vals, objVal, IloCplex::Callback::Context::SolutionStrategy::NoCheck);

However, when running this code, I am receiving the following error from CPLEX:

Exception caught: CPLEX Error 1003: Bad argument to Callable Library routine.

By looking over the documentation I figured out that the reason would be that the solution passed was not a "complete solution". The issue I have here, is that the solution I am passing is indeed using all variables I (as a user) have defined -- and hence should characterize a complete solution.

I therefore decided to export my model to .lp file and check it over. To my surprise, CPLEX is declaring some additional auxiliary variables in order to model the piecewise linear functions I use in my model contraints. (see below an extract of my .lp model)

[...]

VNF_Placement(0,0,0): - y(0,1) + x(0,0,0) <= 0

ReqAvail(0): x138 >= -0.00100050033358353

availLink(0,0): secAvail(0,0) + secUnavail(0,0) = 1

SectionAvail(0,0): 5.11599580975408 x(14,0,0) + 5.52146091786225 x(13,0,0)

+ 5.80914299031403 x(12,0,0)

+ 4.8283137373023 x(11,0,0) + 4.8283137373023 x(10,0,0)

+ 6.90775527898214 x(9,0,0) + 5.80914299031403 x(8,0,0)

+ 4.8283137373023 x(7,0,0) + 4.96184512992682 x(6,0,0)

+ 5.80914299031403 x(5,0,0) + 4.96184512992682 x(4,0,0)

+ 6.21460809842219 x(3,0,0) + 4.8283137373023 x(2,0,0)

+ 5.29831736654804 x(1,0,0) + 4.8283137373023 x(0,0,0)

+ x139 = 0

[...]

Pwl

p1: x138 = secAvail(0,0) 1.001001001001

(0.999249895791573, -0.000750354396073185)

(0.999749895770686, -0.000250104229313819) 1

p2: x139 = secUnavail(0,0) 100000000 (5.77472401322578e-8, -13.6459567307266)

(0.0000182612807406618, -7.88949399824147)

(0.00691466994893107, -0.993085330051069) 1

I guess the problem is coming from this fact since when I relax the constraints that use the piecewise linear functions (i.e., ReqAvail and SectionAvail), the heuristic runs smoothly and no error is raised. The problem I have now is that since I wasn't the one who created these variables (x138 and x139) -- at least not directly -- I don't know how to get my hand into their implementation so that I can include them into my vars array during the heuristic posting. Can you please help me?

I also tried to use the strategy Propagate (which seems to accept the "partial" solution but then the heuristic solution is never really used) and Solve (which raises a weird segmentation fault problem. Both these strategies also work fine when I relax the constraints using pwl functions...

------------------------------

Rafael Colares

------------------------------