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

From: Paul Cannongeyser <paul_dice_2_at_...75...>
Date: Thu, 10 Oct 2013 08:04:53 -0700 (PDT)
I ran this example.  The results were unexpected.

----- eplex_9.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 = X{-1.7976931348623157e+308 .. 1.7976931348623157e+308 _at_ 2.0}
Y = Y{-1.7976931348623157e+308 .. 1.7976931348623157e+308 _at_ 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).
-----

However, I was able to run a similar example without any warnings and the result showed as an integer, rather 
than a decimal.

----- eplex_3.ecl
% Run in this way: top(X,Y,Cost).
% >From http://eclipseclp.org/reports/Workshop/eplex.ppt entitled The EPLEX Library
/*
Results:
?- top(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)

*/

:-lib(eplex).

top(X,Y,Cost) :-
X+Y $>=3,
X-Y $= 0,
integers([X]),  % This is a mixed integer problem.
optimize(min(X),Cost).
-----

Is the result in my first program run (i.e., eplex_9.ecl, at the top of this email) the correct behavior or did I do something wrong?
Received on Thu Oct 10 2013 - 15:05:02 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:21 CEST