# combinatorical problem !?

From: Manuel Weindorf <weindorf_at_ipf.bau-verm.uni-karlsruhe.de>
Date: Thu 05 Jul 2001 08:53:57 AM GMT
Message-Id: <01070510535704.16856@ipfu2>
```Hi there,

up to now I used Eclipse as a Prolog system, but now I guess I have a 'real'
Eclipse problem, but I don't know how to set it up :-(

I have a set of balls lying on a table (red, green and blue ones) represented
as facts like

ball( ID, COLOR ):

ball( 1, red ).
ball( 2, blue ).
ball( 3, blue ).
ball( 4, green ).
ball( 5, red ).
ball( 6, green ).
ball( 7, red ).
ball( 8, green ).
ball( 9, blue ).
ball( 10, red ).

Further I have a set of costs (distances between balls on the table)

cost( BallID1, BallID2, Cost ):

cost( 1, 2, 5.0 ).
cost( 1, 3, 3.0 ).
cost( 1, 4, 3.0 ).
cost( 2, 1, 5.0 ).
cost( 2, 4, 2.0 ).
cost( 2, 8, 3.0 ).
cost( 2, 10, 4.0 ).
cost( 3, 1, 3.0 ).
cost( 3, 5, 4.0 ).
cost( 3, 6, 6.0 ).
cost( 3, 7, 2.0 ).
cost( 3, 4, 5.0 ).
cost( 4, 1, 3.0 ).
cost( 4, 3, 5.0 ).
cost( 4, 7, 4.0 ).
cost( 4, 2, 2.0 ).
cost( 5, 3, 4.0 ).
cost( 5, 6, 4.0 ).
cost( 6, 3, 6.0 ).
cost( 6, 5, 4.0 ).
cost( 6, 7, 3.0 ).
cost( 7, 4, 4.0 ).
cost( 7, 3, 2.0 ).
cost( 7, 6, 3.0 ).
cost( 7, 8, 3.0 ).
cost( 7, 9, 3.0 ).
cost( 8, 2, 3.0 ).
cost( 8, 7, 3.0 ).
cost( 8, 9, 4.0 ).
cost( 8, 10, 2.0 ).
cost( 9, 8, 4.0 ).
cost( 9, 7, 3.0 ).
cost( 9, 10, 5.0 ).
cost( 10, 2, 4.0 ).
cost( 10, 8, 2.0 ).
cost( 10, 9, 5.0 ).

Now I want to group the balls into triples of three different colored balls.
But obviously there are many solutions, so I want the solution with the
minimal sum of costs.
Because the number of green, blue and red balls is not equal, there will be
some balls left (not belonging to a group) in the end (In this example one
red ball will be left).

This seems to me like a typical Eclipse problem, maybe there's somebody out
there to give me a hint how to set this up ;-)