Social Golfers

From: Mark A. Hennessy <>
Date: Mon 11 Oct 2004 05:13:31 PM GMT
Message-ID: <>
Hi there,

    I'm using Eclipse 5.7. I've been implementing a number of different 
models of the social golfer problem in Eclipse. I've run into a problem 
in trying to
implement one of the constraints for a particular model I have 
formulated. The code I have written so far is:

% Give an account of this model in mathematical notation. C1 and C2
% are automatically enforced my the setup of the data-structures in
% this model
sgp_model2(Weeks,NumberOfGroups,GroupSize,Groups) :-
    % Calculate the number of golfers
    NumGolfers is NumberOfGroups*GroupSize,
    % 2-d Groups Matrix of Variables
    % The Domain of each Group matrix variable is the range of
    % 1..NumberOfGroups
    Groups[1..NumGolfers,1..Weeks] :: 1..NumberOfGroups,

    % C3: limits the number of times a group identifier appears in a 
    % week to GroupSize
    (for(W,1,Weeks), param(Groups,NumGolfers,GroupSize,NumberOfGroups) do
        (for(G,1,NumberOfGroups), param(Groups,W,NumGolfers,GroupSize) do
            Occur is Groups[1..NumGolfers,W],

    % C4: All pairs of golfers must play each other at most once
    sigma(W)(Groups[X,W] = Groups[Y,W]) <= 1

I cant seem to represent the last constraint (C4) the way I would like 
to in Eclipse. I was hoping someone could show me how this is done? The
notation I've used some summation over a range of weeks might look a 
little odd but it is just to ensure that no golfer plays any other golfer in
the same group more than once.

Thanks in advance,
Received on Mon Oct 11 18:21:04 2004

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:30 PM GMT GMT