Re: [eclipse-clp-users] instantiation fault while ic:labeling

From: Kish Shen <kisshen_at_...5...>
Date: Mon, 12 Oct 2009 19:52:45 +0100
Hi Oliver,

Oliver Scheickl wrote:

> In my little program I get an "instantiation fault" error message when
> ic:labeling starts. Maybe you can help me out of that issue.
>
You seem to suggest that the error happens when the labeling goal is 
called in your program. Why do you think this? Your error actually 
occurs in the line:

         Out is In + Weight

which is before the call to labeling. The error message you get is

instantiation fault in +(0, _534{1 .. 3}, _711)

and the reason for this is because Weight is not a number, but is still 
a variable (a finite domain variable, but still a variable). is/2 is not 
a constraints, so all the variables in the expression that is evaluated 
must be ground when it is called.

It looks like you want to create a constraint on the total weights. You 
can do this by collecting the Weight variables in your loop, so instead 
of the fromto(0,...), you collect weights into a list with the specifier:

(foreach(Edge, Edges),
  foreach(Weight, Weights), param(EdgeWeights) do
   weight(Edge, .....)
).

so instead of Sum #< 10, you would have sum(Weights) #< 10

where Weights is the list of Weight you collected earlier.

If you want to see where your program is going wrong, you can use the 
debugger to see trace the execution. The tutorial has a chapter that 
describes how to use the debugger.

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 Mon Oct 12 2009 - 18:52:58 CEST

This archive was generated by hypermail 2.3.0 : Thu Feb 22 2024 - 18:13:20 CET