>lp(L):- > L=[A,B], > fd:(L::1..10), > lp_setup([],min(A),[],Handle), > lp_add_constraints(Handle,[A+B>=5,A-B=:=0],[]), > lp_solve(Handle,Cost),writeln(Cost), > lp_add_constraints(Handle,[A>=3],[]), > lp_solve(Handle,Cost),writeln(Cost). > >The second call to lp_solve just fails ???. Of course. Cost had been instantiated to 2.5, so on the second call to lp_solve/2, 2.5 is unified agaist 3.0, the new answer, and so it fails. Use a new variable for your second lp_solve call. By the way, if you want the interval of your variables to be properly communicated to the external solver, you should not be use fd's ::/2, but the one that is exported from the eplex library (so you can use ::/2 without qualification, or eplex:(L::1..10)). >It seams that adding new constraint after a solver invocation simple >doesn't work. I can't also solve any MIP problem. This means that using the >predicate lp_add_constrainst/3 to declare integers variables doesn't work. I assume they are all related to you using the same Cost variables in different calls to lp_solve/2? Related to this, we strongly recommend that you use the eplex instance interface instead of these low level predicates you are calling (although calling eplex_solve with an instantiated Cost will still fail). Cheers, KishReceived on Fri Feb 07 13:22:34 2003
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:20 PM GMT GMT