[eclipse-clp-users] Piecewise Linear functions

From: Marco Gavanelli <marco.gavanelli_at_...17...>
Date: Wed, 04 Aug 2010 21:49:50 +0200
Dear all,

I am trying to use Eplex with a piecewise linear function.
My intention was to use Special Order Sets (SOS), but I am probably 
misunderstanding how I can use them.

My first attempt was to use piecewise_linear_hull/3:

go(X,Y,V):-
     X :: 0..10,
     Y :: 0..10,
     piecewise_linear_hull(X, [(0,2), (1,2), (3,1), (10,10)], Y),
     optimize(min(Y), V).

[eclipse 2]: go(X,Y,V).
Eplex warning: Imposing integer bounds on variable(s) X for eplex 
instance eplex does not impose integer type.
Eplex warning: Imposing integer bounds on variable(s) Y for eplex 
instance eplex does not impose integer type.
WARNING: module 'eplex_relax' does not exist, loading library...
No (0.08s cpu)

So, maybe I am misunderstanding what is passed to the MILP solver;
I try to save the model in an mps file:

go:-
     eplex_solver_setup(min(Y)),
     X :: 0..10,
     Y :: 0..10,
     piecewise_linear_hull(X, [(0,0), (1,2), (3,3)], Y),
     eplex_write(mps,'piece.mps').

and I get the file:

------------------------------------------------
NAME          eclipse
ROWS
  N  obj
COLUMNS
     x1        obj                             1
     x2        obj                             0
RHS
BOUNDS
  UP bnd       x1                             10
  UP bnd       x2                             10
ENDATA
------------------------------------------------

but there is no SOS section.

But, maybe I can create an MPS file without SOS, add myself an SOS 
section, and then explicitly load the MPS from the MILP solver.
Of course, in a large project I cannot find which variables should be in 
an SOS if they are named x1, x2, ...
Looking at the manual page for eplex_set/2, I find the use_var_names option.

So I try

:- lib(var_name).
go2(X,Y):-
     eplex_solver_setup(min(Y)),
     eplex_set(use_var_names,yes),
     X :: 0..10, set_var_name(X,"X"),
     Y :: 0..10, set_var_name(Y,"Y"),
     eplex_write(mps,'piece.mps').

I get the warning

[eclipse 10]: go2(X,Y).
Default column names x1, x2 ... being created.

X = X#0{0.0 .. 10.0}
Y = Y#0{0.0 .. 10.0}
Yes (0.00s cpu)

and, in fact, the piece.mps file has not changed.

What am I doing wrong?

Thank you in advance,
Marco

-- 
Marco Gavanelli, Ph.D. in Computer Science
Dept of Engineering
University of Ferrara
Tel/Fax  +39-0532-97-4833
http://www.ing.unife.it/docenti/MarcoGavanelli/
Received on Wed Aug 04 2010 - 20:13:54 CEST

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