[gecode-users] FW: Help:How to compute Autocorrelation of a v-length sequence

George Rudolph george.rudolph at citadel.edu
Wed Oct 24 02:41:30 CEST 2007


Below I am posting an answer from Christian Schulte to some questions
that I thought I had also posted to the mailing list, but did not.
So here they are.

George

-----------------------------------------------------------------------

Dear George,

thank you for your constructive attitude, I would also like to apologize
to
you for being quite rude: I fear that we have to be focused in what kind
of
discussions take place on the mailing list: Gecode does not target
people
not knowing constraint programming in general; we would like to keep the
discussions on a level that assumes prior knowledge.

However, questions those such as you phrase below are very good! After
you
took the effort to isolate questions their answers can be reused and
capture
nicely some knowledge required to implement a model in Gecode (or
Gecode/J).

So let me try.

1. You can't. You have (as you hint yourself) create an additional
IntVar
and constraint it to a single value (either by how you initialize it or
by
operations such as rel or dom). While doing otherwise is difficult in a
statically typed language such as C++ or Java, Mozart will do quite
often
exactly the same thing without you knowing.

2. I assume that you mean posting a constraint that compares for
equality
when you refer to "compare". 
   The following steps should work:
   - You declare an array of BoolVarArgs, say b, of the right size.
   - You iterate over all element with a loop.
   - You initialize (yes, BoolVarArgs does not initialize its elements)
each
b[i], say with
		b[i].init(this,0,1)
   - You post a comparison constraint between x[i] and y[i]
		rel(this, x[i], IRT_EQ, y[i], b[i]);
   - Counting is then just a linear constraint, say you have an IntVar c
for
the result
		linear(this, b, IRT_EQ, c);

Hope that helps.

All the best
Christian

-----Original Message-----
From: George Rudolph [mailto:george.rudolph at citadel.edu] 
Sent: Sunday, October 21, 2007 4:13 AM
To: cschulte at kth.se
Subject: RE: [gecode-users] Help:How to compute Autocorrelation of a
v-length sequence

Christian,

No need to apologize. I know that development time is precious.
Especially yours.
I completely agree that it is a modeling issue.
Unquestionably. And non-trivial, or not simple.
My intent was to ask for help from the community,
and I do not intend someone to spend time they don't have.

I do not understand what you mean by "Gecode-specific", however.
For example, I have Oz Mozart code that computes this algorithm,
and in fact I'm doing a translation to Gecode/J because
it allows me to use Java tools, and I'm hoping it's more
efficient, and syntactically cleaner than what I have.
And it will help me learn the language/API.


More information about the gecode-users mailing list