So, if I know of a solution (in this case, an optimal solution), I can find it by adding additional constraints on some of the variables. E.g., in this particular example, the additional constraint, prob: (B2 $= 9), enables me to get the same solution as shown in the tutorial. ?- main2(Cost, Vars). Cost = 710.0 Vars = [0.0, 21.0, 0.0, 16.0, 9.0, 15.0, 34.0, 0.0, 0.0, 0.0, 0.0, 10.0] Yes (0.00s cpu) Thank you, Kish, for your answer. On Thursday, October 31, 2013 1:23 AM, Kish Shen <kisshen_at_cisco.com> wrote: Hi, On 30/10/2013 21:27, Paul Cannongeyser wrote: > "Note that, in general, an MP problem can have many optimal solutions, i.e. different solutions which give the > optimal value for the objective function." > > The tutorial has one optimal solution. My recent run got another. > > How do I get the same optimal solution as the tutorial? > Short answer: you cannot. In general, for a constraint problem, if all your constraints are satisfied, then you cannot demand a specific solution unless you post extra constraints (to remove solutions you don't want). The exact solution returned by the solver is likely determined by implementational details. So in the case of MP solvers, you should not expect different solvers, or even different versions of the same solver, to return the same solution. In fact, you probably should not even expect the same solver to return the exact same solution for the same problem in all cases, because it is possible that the solving algorithm may use some randomisation component, although I suspect for debugging reasons, such behaviour is not likely to be the default. Cheers, KishReceived on Wed Nov 06 2013 - 19:57:32 CET
This archive was generated by hypermail 2.2.0 : Fri Nov 08 2013 - 06:14:17 CET