# [eclipse-clp-users] Q: Linear Programming with Disjunction constraints

From: Kim Lai <kim73327_at_...6...>
Date: Wed, 23 Apr 2008 23:06:23 +0800
```---------- Forwarded message ----------
From: Kim Lai <kim73327_at_...6...>
Date: Apr 23, 2008 10:56 PM
Subject: Q: Linear Programming with Disjunction constraints
To: eclipse-clp-users_at_...105...

hi, I'm new to eclipse. Here looks for a great HELP. after studying the
documents... I still have trouble with my problem.
I don't know how to use lib(eplex) for
1. disjunctive constraints
2. get a maximum among lots Varables

I tried lib(ic). maxlist can help me get a maximum.
But I don't know how to model a linear programming in IC.
I always gets a integer solution or Errors like
"out of range in get_domain_size(A1{0.0 .. 10.5}, _605)".
but I didn't call the get_domain_size !.

I'd like to formulate a problem like this:
------------------------------------------------------------------------------
Vars = [ t1, t2, t3 ]
Vars :: 0.0..inf

% constraints
(t1 - t2 <= -10.2  or  t1 - t2 >= 15.6) and
(t2 - t3 <= -3.1 or t2 - t3 >= 9.8 )
% goal ( cost )
try to minimize( Maximum among( t1 + 14.5, t2+1.4, t3+ 4.5 ) )
-------------------------------------------------------------------------
Here is my code with wrong behavior.

:- lib(ic).

:- lib(branch_and_bound).
solve(Vars, Cost) :-

model(Vars, Obj),

Cost \$= eval(Obj),

minimize(search(Vars, 0, first_fail, indomain_split, complete, []),
Cost).

model(Vars, Obj) :-

Vars = [A1, A2, A3, A4, A5],
Prop = [P1, P2, P3, P4, P5],
Vars ::
0..inf,

P1 \$= A1 + 4.3,

P2 \$= A2 + 3.3,

P3 \$= A3 + 2.3,

P4 \$= A4 + 2.3,

P5 \$= A5 + 1.3,

A4 - A1 \$>= 1.2 or A4 - A1 \$=< -0.2,
A2 - A3 \$>= 0.2 or A2 - A3 \$=< -0.7,

maxlist( Prop , Obj).
---------------------------------------------------------------

any comment will be a big help , thanks !

--
....Best Regards
by Kim Lai, 賴廣甫
Welcome to visit http://kimklai.blogspot.com

--
....Best Regards
by Kim Lai, 賴廣甫
Welcome to visit http://kimklai.blogspot.com
```
Received on Wed Apr 23 2008 - 08:06:35 CEST

This archive was generated by hypermail 2.3.0 : Sat Aug 24 2019 - 21:14:55 CEST