From: Hadrien C. <had...@em...> - 2004-12-09 09:02:09
|
Dear Guillaume, Boolean constraints were implemented in Claire. You can have a look to the claire code to have a better. idea of how it works. Nevertheless, the implementation is quite complex and need to add some behaviour on ALL constraints since we have to explain why any constraint can be entailed or rejected. Therefore your proposal on the disjunctive will not be enough anyway (even if you implement the whyIsTrue(), whyIsFalse() methods correctly). Explanations for the whole problem will not be correct which can imply a bad behaviour during the search (as you observed). We hope this feature will be available soon. But if you have the courage to port the claire version into java, we are interested :) Guillaume and Hadrien ----- Original Message ----- From: "Guillaume Nodet" <gui...@de...> To: <cho...@li...> Sent: Wednesday, December 08, 2004 9:42 AM Subject: [Choco-users] Explained binary disjunctive constraint > Would it be possible to add a palm binary disjunctive constraint to the > library ? > > I've tried to do it, but my understanding of palm internals is not > sufficient to > have an optimized version. Following is the version i have which seems to > work > but does not handle whyIsTrue and whyIsFalse in addition to have a non > optimal > value restoration process. > > Additionaly, i've got a problem with palm: i'm trying to solve a problem, > but the solver does not stop. It keeps looping on the same decision > constraints set. > Can this behavior be the result of the very ugly disjunction constraint i > wrote ? > > Thanks, > > Guillaume Nodet > > > public class PalmBinDisjunction extends BinDisjunction implements > PalmConstraint, PalmIntVarListener { > public PalmBinDisjunction(AbstractConstraint c1, AbstractConstraint > c2) { > super(c1, c2); > this.hook = ((ExplainedProblem) > this.getProblem()).makeConstraintPlugin(this); > ((PalmConstraintPlugin) c1.getPlugIn()).addControl(this, 0); > ((PalmConstraintPlugin) c2.getPlugIn()).addControl(this, 1); > } > > public void setTargetStatus(int constIdx, boolean st) { > if (st) { > Constraint c0 = constIdx == 0 ? const0 : const1; > Constraint c1 = constIdx == 0 ? const1 : const0; > PalmExplanation expl = (PalmExplanation) ((ExplainedProblem) > this.getProblem()).makeExplanation(); > expl.addAll(((PalmIntVarListener) c1).whyIsFalse()); > ((PalmConstraintPlugin) c0.getPlugIn()).setIndirect(expl); > } > } > > public void addListener() { > super.addListener(); > int idx = ((PalmConstraintPlugin) this.hook).getConstraintIdx(); > ((PalmConstraintPlugin) > const0.getPlugIn()).setConstraintIdx(idx); > ((PalmConstraintPlugin) > const1.getPlugIn()).setConstraintIdx(idx); > } > > public void takeIntoAccountStatusChange(int index) { > statusBitVector.set(0); > } > > public void updateDataStructuresOnConstraint(int idx, int select, > int newValue, int oldValue) { > statusBitVector.set(0); > } > > public void updateDataStructuresOnRestoreConstraint(int idx, int > select, int newValue, int oldValue) { > statusBitVector.set(0); > } > > public void awakeOnRestoreInf(int idx) throws ContradictionException > { > statusBitVector.set(0); > propagate(); > } > > public void awakeOnRestoreSup(int idx) throws ContradictionException > { > statusBitVector.set(0); > propagate(); > } > > public void awakeOnRestoreVal(int idx, int val) throws > ContradictionException { > statusBitVector.set(0); > propagate(); > } > > public void awakeOnRestoreVal(int idx, IntIterator it) throws > ContradictionException { > statusBitVector.set(0); > propagate(); > } > > public Set whyIsTrue() { > return null; > } > > public Set whyIsFalse() { > return null; > } > > public String toString() { > return const0.toString() + " v " + const1.toString(); > } > } > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > Choco-users mailing list > Cho...@li... > https://lists.sourceforge.net/lists/listinfo/choco-users > |