The variables in the objective have "?" in their name which makes them different from the variables in the constraints.
The objective function is thus deconnected from the constraints and presolve can remove any constaints. Removing the "?" in the .lp file connects the objective variables and the ones in the constraints. The model can thus be solved to optimality an a solution is available. It seems that this gives the model you want and you need to check the variables you create for that model in the code that generates it.
Original Message:
Sent: Fri January 10, 2025 09:08 AM
From: Leonardo Parisi
Subject: solve() returns false but getCplexStatus() shows Optimal - All rows and columns eliminated
it's my first time exporting a model and I don't know what either the "?" means or much of what's written in the file
------------------------------
Leonardo Parisi
Original Message:
Sent: Fri January 10, 2025 09:02 AM
From: Olivier Lhomme
Subject: solve() returns false but getCplexStatus() shows Optimal - All rows and columns eliminated
In the model you sent, the objective begins as follows, you do not have it? or maybe there is a meaning of the "?" that I am not aware of?
obj1: - ? x1 - ? x2 + 1.21658980540257 x3 - ? x4 - ? x5 + 0.543968849921459 x6 - ? x7 + 0.502788189871249 x8 - ? x9 + 1.71027162985521 x10 - ? x11
------------------------------
Olivier Lhomme
Original Message:
Sent: Fri January 10, 2025 06:28 AM
From: Leonardo Parisi
Subject: solve() returns false but getCplexStatus() shows Optimal - All rows and columns eliminated
Hello Olivier
what do you mean by "removing the '?' in your file"?
------------------------------
Leonardo Parisi
Original Message:
Sent: Thu January 09, 2025 01:31 PM
From: Olivier Lhomme
Subject: solve() returns false but getCplexStatus() shows Optimal - All rows and columns eliminated
Hello,
removing the '?' in your file, I have no problem with the same cplex version, with the following code, do you?
IloObjective obj; IloNumVarArray var(env); IloRangeArray rng(env); cplex.importModel(model, "model.lp" , obj, var, rng); cplex.extract(model); cplex.solve(); IloNumArray vals(env); cplex.getValues(vals, var); env.out() << "Solution status = " << cplex.getStatus() << endl; env.out() << "Solution value = " << cplex.getObjValue() << endl; env.out() << "Values = " << vals << endl;
------------------------------
Olivier Lhomme
Original Message:
Sent: Wed January 08, 2025 09:25 AM
From: Leonardo Parisi
Subject: solve() returns false but getCplexStatus() shows Optimal - All rows and columns eliminated
Hi Cédric,
this is the exported model.
I hope i can be helpful
------------------------------
Leonardo Parisi
Original Message:
Sent: Tue January 07, 2025 11:05 AM
From: Cédric Doens
Subject: solve() returns false but getCplexStatus() shows Optimal - All rows and columns eliminated
You may cplex.exportModel("model.lp")
or post directly your model code
------------------------------
Cédric Doens
Original Message:
Sent: Tue January 07, 2025 10:45 AM
From: Leonardo Parisi
Subject: solve() returns false but getCplexStatus() shows Optimal - All rows and columns eliminated
Hi Cédric,
i am using the version version 22.1.0
there is a way to export the model or anything that might be useful?
my program is written in C/C++
thanks
------------------------------
Leonardo Parisi
Original Message:
Sent: Tue January 07, 2025 10:33 AM
From: Cédric Doens
Subject: solve() returns false but getCplexStatus() shows Optimal - All rows and columns eliminated
Hi Leonardo,
That looks unexpected.
Could you share your model or a minimal example such that we can take a look ?
Which cplex version do you use ?
------------------------------
Cédric Doens
Original Message:
Sent: Sun January 05, 2025 07:24 AM
From: Leonardo Parisi
Subject: solve() returns false but getCplexStatus() shows Optimal - All rows and columns eliminated
I am trying to solve a small setcover problem with cplex.
What I don't understand is how it is possible that solve() returns false while getCplexStatus() and getStatus() show Optimal.
What is the cause of this?
This is the output of cplex:
Tried aggregator 1 time.MIP Presolve eliminated 274 rows and 296 columns.All rows and columns eliminated.Presolve time = 0.00 sec. (0.16 ticks)Root node processing (before b&c): Real time = 0.00 sec. (0.20 ticks)Parallel b&c, 12 threads: Real time = 0.00 sec. (0.00 ticks) Sync time (average) = 0.00 sec. Wait time (average) = 0.00 sec. ------------Total (root+branch&cut) = 0.00 sec. (0.20 ticks)
From what I understand the problem was "simple" and was solved in the presolve step.
Is this a possible explanation for the behavior described above?
How do I get the values of the variables? If i call getValues() i get an exception.
------------------------------
Leonardo Parisi
------------------------------