[gecode-users] question about lexical ordering constraint and others

Christian Schulte cschulte at kth.se
Wed May 11 11:04:17 CEST 2011


Hi Chris,

Yep, I came to same conclusion after answering Kish, so I just added it to
the trunk.

Thanks
Christian

--
Christian Schulte, www.ict.kth.se/~cschulte/


-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Christopher Jefferson
Sent: Tuesday, May 10, 2011 11:02 PM
To: Kish Shen
Cc: users at gecode.org
Subject: Re: [gecode-users] question about lexical ordering constraint and
others


On 10 May 2011, at 17:35, Kish Shen wrote:

> Hi,
> 
> I have a few (more) question about various Gecode constraints that I am
interfacing to ECLiPSe:
> 
> 1) the constraint for lexical ordering
> 
> rel(Home, IntVarArgs, IntRelType, IntVarArgs)
> 
> requires the two arrays to be the same size. It seems the same restriction
applies in the global constraint catalog for the lexical ordering
constraints as well. However, the existing ECLiPSe lexical ordering
constraints does not have this restriction -- i.e. the two sequences of
numbers being compared can be different lengths. What is the reason for the
same length restriction?
> 
> The lexical ordering for sequences of different length used in ECLiPSe
seems to be the natural one, where missing numbers in the shorter sequence
are replaced by 'bottom', i.e. a value smaller than any number.
> So (using . to separate numbers in a sequence)
> 
> 1.3 > 1.2.5
> 
> 1.2.5 > 1.2
> 
> etc.
> 
> Could such a definition of ordering be used in the Gecode version as well?

The easiest way to implement this is as follows:

If the second array is longer, just truncate it to the length of the first.
If the first array is longer, truncate it to the length of the first and
change the lex<= constraint to a lex< (assuming gecode has a lex<
constraint).

If you don't have a lex< constraint, you can make one by sticking 1 on the
end of the first array and 0 on the end of the second (once the arrays are
the same length).

Chris
_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users




More information about the users mailing list