[gecode-users] Set constraints working for sequential data, but not non-sequential data. Ideas?

Christian Schulte cschulte at kth.se
Fri Dec 18 09:08:15 CET 2009


Hi,

 

1)      If you only need these variables for branching store them
temporarily: use a SetVarArgs array instead of of a SetVarArray.

2)      No. Only if you want to have them as part of your solution, say, for
printing, etc. Otherwise branchings take care of themselves.

 

Cheers

Christian

 

--

Christian Schulte, web.ict.kth.se/~cschulte/

 

From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Holger Winnemoeller
Sent: Friday, December 18, 2009 2:09 AM
To: users at gecode.org
Subject: Re: [gecode-users] Set constraints working for sequential data, but
not non-sequential data. Ideas?

 

 

I've added "branch(*this, specialSelected, SET_VAL_MIN_INC);" as the last
line in CreateAndRequestCategory


and the code runs like a charm!

 

You might want to collect the specialSelected variables, and branch on them
at the same time. Then you could use some selection heuristic between the
variables (e.g., the specialSelected var with the smallest unknown value, a
random choice, ...).

 


Ok, this brings up some other questions:

1) I assume the way I would collect on all specialSelected variables would
be:

SetVarArray mySpecialSets (*space, numSpecialSets, IntSet::empty, 0,
maxSpecialSetSize);
foreach(SetVar specialSet in mySpecialSets)
{
   // do something
}
branch(*space, mySpecialSets, SET_VAR_NONE, SET_VAL_MIN_INC); // or other
options

Is this what you had in mind?

2) The second, related, questions are then:

*	Would mySpecialSets have to be a member of my Space definition?
*	Would I have to propagate this info in the special copy constructor,
like so:

MySpace(bool share, MySpace& s)
        : Space(share,s) {
            mySpecialSets.update(*this,share,s.mySpecialSets);
    }

*	Or more generally: What kind of variables (IntVar, SetVar, ...) do I
have to update in this fashion? I gues I am not quite clear on the
relationship between the branching and the special copy constructor.

 

Any help is appreciated.
Thanks,

Holger.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20091218/1c57bc80/attachment-0001.htm>


More information about the users mailing list