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

From: Kish Shen <kisshen_at_cisco.com>
Date: Thu, 11 Sep 2008 15:42:18 +0100
Ulrich Scholz wrote:
> Thanks Joachim,
> 
> now this error went away.  Maybe you should note the predecence issue in the
> eplex description.  (Maybe you do and I missed it)
> 
> Best,
> 
> Ulrich
> 
> 
> On Thu, Sep 11, 2008 at 12:27:29AM +0100, Joachim Schimpf wrote:
>> Kish Shen wrote:
>>> 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
>>>>
>> ...
>>>>     
>>>>     my_instance: Utility $= Utilities * DVs,
>>>>     
>>>>     Subcomponent = [Utility, DVs, Utilities].
>>>> --------------
>>>>
>>> Hi,
>>>
>>> You are not using the correct syntax -- you cannot simply use lists in 
>>> expression.
>>
>> Actually, the List*List syntax is legal in lib(eplex) and lib(ic).
>> The problem is the relative precedence of the : and the $= operator.
>> The : binds stronger than the $=, so you have to add parentheses like
>>
>>   my_instance:(Utility $= Utilities * DVs)
>>
>>
>> Cheers,
>> -- Joachim
> 
I don't think it is explicitly discussed in the eplex chapter, but all 
the descriptions for the constraints that need it are shown with brackets.

The problem is that it is easy to miss them when you are looking at the 
code, and the error messages you get when you don't use them is not too 
helpful. There is better error messages for the :: cases, and I will 
look to see if this can be done for the other constraints as well.

I will also add in some explicit mention of the brackets issue.

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 Thu Sep 11 2008 - 07:42:30 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET