Re: [eclipse-users] Error in bin packing example

From: Kish Shen <kish.shen_at_crosscoreop.com>
Date: Wed, 18 Jul 2007 22:29:42 +0100
Hi,

This is an error with the tutorial text. 

> constrain_bin(bincolour:Col, capacity:Cap, contents:C) :-

this should be

constrain_bin(bin{colour:Col, capacity:Cap, contents:C}) :-

i.e. bin is named structure. The curly bracket is missing because they needed to be quoted in
the LaTeX source (\{ and \} rather than { and }) and was not.

Thanks for reporting this, I have fixed it in the source, and should be fixed for the next 5.10
build (#84).

Cheers,

Kish

On Wednesday 18 July 2007 20:20, you wrote:
> Hi folks,
> 
>  
> 
> I am trying the bin packing example from the tutorial, and I'm getting
> the following
> 
> error:
> 
>  
> 
> calling an undefined procedure constrain_bin(Bin) in module eclipse
> 
>  
> 
> I typed in the example, got the error, then made a new .pl file in which
> I copied the
> 
> code from the PDF of the tutorial in case I had made manual typos, but I
> get the
> 
> same result.
> 
>  
> 
> It seems to be complaining about the first predicate in the second
> clause defining
> 
> bin_setup/2 below: 
> 
>  
> 
> bin_setup(Demand,[]) :-
> 
> all_zeroes(Demand).
> 
>  
> 
> bin_setup(Demand, [Bin | Bins]) :-
> 
> constrain_bin(Bin),
> 
> reduce_demand(Demand, Bin, RemainingDemand),
> 
> bin_setup(RemainingDemand, Bins).
> 
>  
> 
> constrain_bin/3 is defined like this:
> 
>  
> 
> constrain_bin(bincolour:Col, capacity:Cap, contents:C) :-
> 
> colour_capacity_constraint(Col, Cap),
> 
> capacity_constraint(Cap, C),
> 
> contents_constraints(C),
> 
> colour_constraints(Col, C).
> 
>  
> 
> Since the call within bin_setup/2 only has one parameter ("Bin"), is
> this the problem?
> 
>  
> 
> Thanks,
> 
>  
> 
> Chuck Lutz
> 
> Lockheed Martin
> 
> Systems of Systems Engineering
> 
> BMC4I Modeling and Simulation
> 
> Moorestown, NJ
> 
> (856)638-7234 (office)
> 
> charles.d.lutz_at_lmco.com
> 
>  
> 
> "A graphic is never an end in itself; it is a moment
> 
> in the process of decision making."
>      - Jacques Bertin
> 
>  
> 
> 
Received on Wed Jul 18 2007 - 22:29:13 CEST

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