[gecode-users] Custom branching and Custom Propagator

Debdeep Banerjee banerjed at rsise.anu.edu.au
Sat Apr 5 15:18:38 CEST 2008


Guido Tack wrote:
> Debdeep Banerjee wrote:
>
>> Hi,
>> I am using my own propagator and branching. But when I am using my
>> branching ( via post()  method) the propagator is not working. But if I
>> use the gecode branching method ( branch() ) then the propagator works.
>> I have checked the custom branching.....the methods ( status,
>> description , commit ) are called from the DFS Search engine, but the
>> propagator did not propagate.
>>
>> What would be the reason ?
>
> Perhaps your propagator does not respond to the modification events 
> generated by your custom branching, but to those from the standard 
> branchings.  E.g., the standard INT_VAL_MIN branching always assigns a 
> variable on the left branch, and that triggers propagators registered 
> for the PC_INT_VAL propagation condition.  If you registered for 
> PC_INT_VAL, but your branching does not assign variables (it might 
> only partition the domain, for instance), then your propagator won't 
> be.  That's just a guess, of course.
>
> Guido
>
Hi,
  I still couldn't able to find out the problem. So I will give some 
details of my code.


My propagator looks like the following

CSPPropagator::CSPPropagator(Gecode::Space* home, ViewIntArray& arr)
  : Gecode::NaryPropagator< Gecode::Int::IntView, 
Gecode::Int::PC_INT_VAL>(home, arr)

Where  ==> typedef Gecode::ViewArray<Gecode::Int::IntView> *ViewIntArray*;

My Branching looks like

CSPBranch::CSPBranch(Gecode::Space* home, ViewIntArray& xv)
      : Gecode::Branching(home)
      , x(xv)
      , pos(-1)
      , val(-1)
    {  }

The commit method looks like

 Gecode::ExecStatus CSPBranch::commit(Gecode::Space* home, const 
Gecode::BranchingDesc* b, unsigned int a)
  {
   
    const Gecode::PosValDesc<int,2>* desc = static_cast <const 
Gecode::PosValDesc<int,2>* > (b);
   
     
    if (a)
      return Gecode::me_failed(x[desc->pos()].nq(home, desc->val())) ? 
Gecode::ES_FAILED : Gecode::ES_OK;
    else
      return Gecode::me_failed(x[desc->pos()].eq(home, desc->val())) ? 
Gecode::ES_FAILED : Gecode::ES_OK;
  }

I have a class called " CSPInstance" which extends the Gecode::Space 
class. The code inside the constructor has the following line in the 
respective order

 Gecode::IntVarArgs arg_array(transitions); [ transitions == > 
Gecode::IntVarArray ]

 Gecode::ViewArray<Gecode::Int::IntView> trans_array(this, arg_array);
   
 CSPPropagator::post(this, trans_array);
      
 CSPBranch::post(this, trans_array);


After commit, the propagators are not propagating.

I have attached the three main files with this email. Any help will be 
greatly appreciated.

-- 
Debdeep Banerjee
PhD Candidate
CSL/RSISE/NICTA
Australian National University
Email: debdeep.banerjee at rsise.anu.edu.au
Web:http://rsise.anu.edu.au/~banerjed


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20080406/99ea4cd3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cspbranch.cc
Type: text/x-c++src
Size: 3229 bytes
Desc: not available
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20080406/99ea4cd3/attachment.cc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cspinstance.cc
Type: text/x-c++src
Size: 2444 bytes
Desc: not available
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20080406/99ea4cd3/attachment-0001.cc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: csppropagator.cc
Type: text/x-c++src
Size: 16313 bytes
Desc: not available
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20080406/99ea4cd3/attachment-0002.cc>


More information about the gecode-users mailing list