Re: [eclipse-clp-users] eplex: Unable to linearise / type error

From: Kish Shen <kisshen_at_...5...>
Date: Wed, 10 Sep 2008 15:53:19 +0100
Ulrich Scholz wrote:
> Dear all,
> 
> I try to write a CP problem with the eplex constraint solver.  Below you
> find my code.
> 
> I use decision variables to select one of a list of values.  On the call
> 
>   :- generateSubcomponents(3, S). 
> 
> I get the following error:
> 
> Eplex warning: Unable to linearise my_instance : Utility =:= [3, 1, 6] * [_184, _186, _188]
> type error in eplex : (my_instance : Utility =:= [3, 1, 6] * [_184, _186, _188])
> Abort
> 
> What to do?  
> 
> Is it a problem of my use of decision variables?  How to find an optimal
> solution in a discrete CSP?
> 
> 
> Thanks,
> 
> Ulrich
> 
> ------------
> :- lib(eplex_osi_clpcbc).
> :- eplex_instance(my_instance).
> 
> generateSubcomponent(NbImplementation, Subcomponent) :-
> 
>     % the decision variables
>     
>     length(DVs, NbImplementation),
>     my_instance: (DVs $:: 0..1),
>     my_instance: integers(DVs),
>     
>     % the utilities
>     
>     length(Utilities, NbImplementation),
>     
>     (foreach(Utility, Utilities)
>     do(
>           % results in an random Integer in the range [1, 8]
>           generateNoZeroRandom(8, Utility)
>       )
>     ),
>     
>     my_instance: Utility $= Utilities * DVs,
>     
>     Subcomponent = [Utility, DVs, Utilities].
> --------------
> 
Hi,

You are not using the correct syntax -- you cannot simply use lists in 
expression. You have something in the form:

A =:= [3,1,6] * [X,Y,Z]

I assume what you want is:

A =:= 3*X + Y + 6*Z

This is standard syntax of Prolog, and is described in many Prolog 
textbooks, and also in the ECLiPSe manuals and tutorials. Most of the 
examples in

http://87.230.22.228/examples/index.html

shows how to process structured data (lists, matricies) to create the 
expressions/constraints you want.

Cheers,

Kish


-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Wed Sep 10 2008 - 07:54:33 CEST

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