[gecode-users] Value assignment

Mikael Zayenz Lagerkvist zayenz at gmail.com
Wed Sep 19 11:26:29 CEST 2007


To assign the remaining variables, you can use the assign-method. See
[1] for documentation.

If you still want to write your own branching, you can follow the
example in QueensJavaPropagator [2]. For example, it is not ok to
return null from description. Also, you should use IntViews and not
IntVars in a branching.

Cheers,
Mikael

[1] http://www.gecode.org/gecodej/doc/group__TaskIntIntBranch.html#g71b2d36daa7163d5e3c1bd0230fb0be5
[2] http://www-gecode.org/gecodej/doc/QueensJavaPropagator_8java-source.html#l00148

On 9/19/07, Debdeep Banerjee <debdeep.banerjee at rsise.anu.edu.au> wrote:
> hi,
>   In some cases when I know my problem is solved, I want to assign all
> non-assigned variables to -1 ( -1 is included in their domain). I wrote
> a custom branching. when i know I have assigned all the variable that
> should be in the solution, I know I am done. The what i did is post
> constraint like following
>
> for (  int i = 0; i < transitions.size(); ++i)
> {
>       IntVarView tr = transitions.get(i);
>       if ( !tr.assigned())
>       {
>            IntVar v = transitionsVars.get(i);
>            eq(home, v, CSPOrderBasedEnc2.NOT_IN_PLAN);
>       }
> }
>
> and return null from my "JavaBranchingDesc description(Space home)"
> method. But I am getting a JVM error.......
> what I am doing wrong....or what is the best way to do it?
>
> Any help will be highly appreciated.
>
> With regards
> Debdeep
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
>


-- 
Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/




More information about the gecode-users mailing list