Re: [eclipse-clp-users] Trying to run MIP using eplex.

From: Paul Cannongeyser <paul_dice_2_at_...75...>
Date: Thu, 10 Oct 2013 12:46:43 -0700 (PDT)
I made the appropriate changes and ran it again for my own edification.


----- eplex_10.ecl
% Run in this way: mip_example(X,Y,Cost).
% From http://eclipseclp.org/doc/libman/libman060.html#toc67 entitled 10.2.6  Examples
/*
Results:
?- mip_example(X, Y, Cost).
X = 2               <<<<<<====== X is printed as an integer, 2, not a decimal, 2.0.  (Nicely done.)
Y = 2.0
Cost = 2.0
Yes (0.00s cpu)

No integer variables - nothing to do (in orange letters)

*/

:- lib(eplex).
:- eplex_instance(my_instance).

mip_example(X,Y,Cost) :-
     my_instance: (X+Y $>= 3),
     my_instance: (X-Y $= 0),
     my_instance: integers([X]),  % This is a mixed integer problem.
     my_instance: eplex_solver_setup(min(X)),
     my_instance: eplex_solve(Cost),
     % retrieve typed solution
     my_instance: eplex_get(vars, Vars),
     my_instance: eplex_get(typed_solution, Vals),
     Vars = Vals.
-----

I have read both of your replies and understand the points made in both.

Thank you, Thorsten and Kish.
Received on Thu Oct 10 2013 - 19:46:51 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST