Hi,
through flow control you could enumerate solutions and make sure solutions are not too close from each other.
sub.mod
float dist=1;
dvar float x in 0..2;
dvar float y in 0..2;
tuple point
{
float x;
float y;
}
{point} solutions=...;
subject to
{
forall(s in solutions) abs(x-s.x)+abs(y-s.y)>=dist;
}
execute
{
writeln("x,y = ",x,",",y);
}
and then main.mod
tuple point
{
float x;
float y;
}
{point} solutions={};
main {
var nbsol=0;
var source = new IloOplModelSource("sub.mod");
var cplex = new IloCplex();
var def = new IloOplModelDefinition(source);
var stop=0;
while (stop==0)
{
var opl = new IloOplModel(def,cplex);
var data2= new IloOplDataElements();
data2.solutions=thisOplModel.solutions;
opl.addDataSource(data2);
opl.generate();
if (cplex.solve()) {
opl.postProcess();
nbsol++;
thisOplModel.solutions.add(opl.x.solutionValue,opl.y.solutionValue);
} else {
writeln("No more solution");
writeln("nb solutions = ",nbsol);
stop=1;
}
data2.end();
opl.end();
}
}
then if you run main.mod you ll get
x,y = 0,0
x,y = 2,2
x,y = 1,0
x,y = 1,1
x,y = 2,1
x,y = 1.5,1.5
x,y = 0.5,0.5
x,y = 2.000000165e-09,0.999999998
x,y = 1.5,0.5
x,y = 1.000000004,1.999999996
x,y = 0.5,1.500000008
x,y = 2,0
x,y = 0,2
No more solution
nb solutions = 13
regards
------------------------------
ALEX FLEISCHER
------------------------------
Original Message:
Sent: Mon July 20, 2020 01:19 AM
From: Abbas Omidi
Subject: Counting all LP feasible solutions
Dear Daniel,
Many thanks for your response. It is so interesting.
I would like to know, is there any way to get such information from CPLEX?
------------------------------
Abbas Omidi
Original Message:
Sent: Mon July 20, 2020 12:18 AM
From: Daniel Junglas
Subject: Counting all LP feasible solutions
Would a software like polymake do you what you want to do?
------------------------------
Daniel Junglas
Original Message:
Sent: Sun July 19, 2020 07:58 AM
From: Abbas Omidi
Subject: Counting all LP feasible solutions
Dear community team,
I am trying to count all feasible (basic) solutions of a specific system of equations which describes in this link. Also, I saw this question and its answers related to my subject.
Let's say, there is a convex polyhedron as a system of equations. I have tried to use SCIP for that but in the case of the LP, it cannot enumerate multiple solutions. I know that there is a specific cutting plane method to do that but, in this case, and what mentioned in this link, the problems have an objective function.
I was wondering if, how can we count all feasible (basic) solutions of such system by CPLEX? (Java or OPL would be preferred)
------------------------------
Regards
A.Omidi
------------------------------
#DecisionOptimization