Additional Calculation during solving process in CPLEX

Solver related questions
Post Reply
kevindj97
User
User
Posts: 5
Joined: 1 year ago

Additional Calculation during solving process in CPLEX

Post by kevindj97 »

Hello everyone,

I have a question regarding the CPLEX solver. I'm trying to do some small calculation in each node (using values of coefficients from the problem formulation in each node) and save them as variables. Is it possible to add some actions / calculation during the MIP solving process in CPLEX?

Thank you in advance,
Kevin
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Additional Calculation during solving process in CPLEX

Post by bussieck »

There is the GAMS BCH facility (https://www.gams.com/latest/docs/UG_Sol ... CHFacility). This calls some user written GAMS program based on some Cplex event and passes the node solution to your GAMS program. The facility is meant to help Cplex to solve faster by sending back some user cuts or improved feasible solutions calculated by the user. You can use it to calculate things while Cplex is running. It comes at a cost: certain preprocessing steps and multi-threading are disabled. Just a warning: The BCH facility is for very very advanced users. Debugging a model that works with BCH is a pain and I bet you won't get much help here if you get in trouble with this.

-Michael
kevindj97
User
User
Posts: 5
Joined: 1 year ago

Re: Additional Calculation during solving process in CPLEX

Post by kevindj97 »

Hello Michael,

Thank you for the reply. I have a follow up question
From the manual, it says:
Such solvers often allow to call a user supplied routine after a node in the branch-and-bound (B&B) tree has been processed. Within that routine, available information like the solution of a relaxation (often an LP or NLP) at that node and the current incumbent, if any, is exported by the BCH facility into a GDX file using the original GAMS namespace.
and also,
A relaxation solution may be exported into a file bchout.gdx by the BCH facility. This GDX file does not only contain the variable values as level values (.l), but also variable bounds (.lo and .up). For a B&B solver, these are the local bounds at this node. Hence, they reflect branching decisions made in the B&B tree and bound tightenings that were deduced by the solver. In a similar way, the BCH facility may export an incumbent solution to the GDX file bchout_i.gdx.
Now I'm trying to simply generate the bchout.gdx file using the following options:

Code: Select all

$onecho > cplex.opt
mipdisplay 4
mipinterval 1
cutsfactor 0
preind 0
divetype 1
nodesel 0
lpmethod 1
heurfreq -1
mipsearch 1
usergdxname bchout.gdx
$offecho
However, it does not seem to generate anything. My question is: How can I access these .gdx file (or any information inside) from each node that generated from the BCH Facility?

Thank you in advance,
Kevin
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Additional Calculation during solving process in CPLEX

Post by bussieck »

You need to set some of the "user*call" options to trigger BCH. -Michael
Post Reply