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

From: Lutz, Charles D <charles.d.lutz_at_...53...>
Date: Wed, 18 Jul 2007 18:12:09 -0400
Hi Kish,

Thanks for the help. The problem is also found in lex_ord/2.
I changed it as such:

lex_ord(bin{colour:Col1, contents:Conts1},
        bin{colour:Col2, contents:Conts2}) :-
        % Use '=..' to extract the contents of the bin as a list
        Conts1 =.. [_ | Vars1],
        Conts2 =.. [_ | Vars2],
        lexico_le([Col1 | Vars1], [Col2 | Vars2]).

Then, however, it complained that lexico_le/2 was not defined, so I
did a help lookup and found that this is in ic_global. So that has
to be added at the top of the file along with the import for the ic
library.

Thanks,
Chuck

-----Original Message-----
From: Kish Shen [mailto:kish.shen_at_...2...] 
Sent: Wednesday, July 18, 2007 5:30 PM
To: Lutz, Charles D
Cc: eclipse-users_at_...2...
Subject: Re: [eclipse-users] Error in bin packing example

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_...53...
> 
>  
> 
> "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 - 23:13:35 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST