Hi Yunus,
There are two options here: 1. You track inside your propagator for which assigned variable you have already created a propagator. One easy trick is (it depends on your propagator whether this is in fact possible) to remove assigned views from your array. Another option would be to use a bitset or something like that. 2. You can track which views get assigned by using advisors. Please check MPG for the details. Best Christian -- Christian Schulte, www.gecode.org/~schulte Professor of Computer Science, KTH, cschu...@kth.se Expert Researcher, SICS, cschu...@sics.se From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On Behalf Of Yunus Acikoz Sent: Friday, March 18, 2016 10:47 To: users@gecode.org Subject: [gecode-users] Getting just assigned variable from ViewArray in a propagator Hi everyone, I have a tunneling constraint propagator that has 4 ViewArrays and scheduled to run on their assignment events: Gecode::ViewArray<Gecode::Int::IntView> successors_; Gecode::ViewArray<Gecode::Int::IntView> predecessors_; Gecode::ViewArray<Gecode::Int::IntView> vehicles_; Gecode::ViewArray<Gecode::Int::BoolView> cancels_; successors_.subscribe(home, *this, Gecode::Int::PC_INT_VAL); predecessors_.subscribe(home, *this, Gecode::Int::PC_INT_VAL); vehicles_.subscribe(home, *this, Gecode::Int::PC_INT_VAL); I want to post additional constraints whenever a value gets fixed over those arrays. for (int i = 0; i < successors_.size(); ++i) { if (vehicles_[i].assigned()) { int val = vehicles_[i].val(); // post constraint... // eg. Gecode::element(home, vehicles_, successors_[i], val); } if (successors_[i].assigned()) { int val = successors_[i].val(); // post another constraint ... } } For example assume that we first assign the vehicle[2] to some value and propagate accordingly. Then if we assign vehicle[7] how can we prevent doing same action for vehicle[2]. Does it post the same constraints for all the previously assigned variables, again and again.... ? Is there a way to get the recently assigned variable that cause thıs propagator to run? Cheers, Yunus
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users