The reason we intend to have access to variable fixation by reduced cost is that the problem we are working on is defined over a directed graph and whenever an arc variable is fixed to zero its corresponding arc can be removed from the graph.
Prior to attempting variable fixing by reduced cost, we apply our own pre-solve module for the problem. Our idea is then to combine our own module with reduced cost variable fixation to set up a larger and more effective pre-solve module for the problem.
Accordingly, if reduced cost fixation performs well, and the graph becomes significantly sparser, we would then go back to our own pre-solve module and iterate.
Is there any way we could have access to the actual variables that are fixed to zero by CPLEX reduced cost fixation?
------------------------------
Victor Hugo Rodrigues do Nascimento
------------------------------
Original Message:
Sent: Thu May 14, 2020 01:57 AM
From: Daniel Junglas
Subject: Fixing variables inside callback using reduced costs
There are several things wrong with your approach:
- It is not allowed to access/modify the IloCplex instance from within a callback. This will at best raise exceptions but will more likely result in undefined behavior.
- What you plan to do is not possible in C++ Concert: the reduced costs of the current nodelp are not available in C++. This sort of low-level access to solution information is only available to callable library applications (there you can get a reference to the node LP and then query the desired information on that instance). If you want to do this in C++ Concert then your only option is to
- Create a deep copy of your model
- In the callback find the current bound tightenings and apply them to the deep copy of the model
- Solve the deep copy of the model as an LP
- Get the reduced costs from the solution of that deep copy and fix variables according to this
Note that CPLEX itself performs variable fixings based on reduced cost. So maybe what you are doing is already done by CPLEX?
------------------------------
Daniel Junglas
Original Message:
Sent: Wed May 13, 2020 03:24 PM
From: Victor Hugo Rodrigues do Nascimento
Subject: Fixing variables inside callback using reduced costs
I'm extending IloCplex::UserCutCallbackI. My idea is to get the reduce cost of each variable x and fix x = 0 if the reduced cost is greater than the gap. I've added a Ilocplex reference called cplex to my callback class, and then tried to get the reduced cost using cplex.getReducedCost(x). Doing that threw a 1017 ( Not available for mixed-integer programs) error. Even though my program is integer, I would like to get the reduced costs of the relaxation.
------------------------------
Victor Hugo Rodrigues do Nascimento
Original Message:
Sent: Wed May 13, 2020 03:56 AM
From: Daniel Junglas
Subject: Fixing variables inside callback using reduced costs
How exactly are you trying to fix the variables? What functions do you call? In which callback?
------------------------------
Daniel Junglas
Original Message:
Sent: Tue May 12, 2020 02:25 PM
From: Victor Hugo Rodrigues do Nascimento
Subject: Fixing variables inside callback using reduced costs
I'm solving a problem using branch and cut and I would like to fix variables using the reduced cost of the node relaxation. Apparently it's not possible (when I try to do that I get error 1017). Is there other way to make this work? If not, is there a way to just check the reduced costs inside the callback?
------------------------------
Victor Hugo Rodrigues do Nascimento
------------------------------
#DecisionOptimization