Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In this code, the system equation have two solutions, but method GetNext() not find other result. So, the code only gives one solution.

Can someone say me how to obtain the two solutions, please?
Thank you for all
C#
SolverContext context = SolverContext.GetContext();
Model model = context.CreateModel();

Decision X = new Decision(Domain.Real, "X");
Decision Y = new Decision(Domain.Real, "Y");
model.AddDecision(X);
model.AddDecision(Y);
model.AddConstraint("eq0", "(X-3)^2+(Y-4)^2 == 2^2");
model.AddConstraint("eq1", "(X-6)^2+(Y-4)^2 == 2^2");

Solution solution = context.Solve(new Directive() { TimeLimit = 20000 });

var a = X.GetDouble();
var b = Y.GetDouble();

solution.GetNext();
            
a = X.GetDouble();
b = Y.GetDouble();
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900