Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

Infinite solving time while using "-a -bb 3" options #18

Open
bconfais opened this issue Feb 15, 2019 · 1 comment
Open

Infinite solving time while using "-a -bb 3" options #18

bconfais opened this issue Feb 15, 2019 · 1 comment

Comments

@bconfais
Copy link

bconfais commented Feb 15, 2019

Using the following program to solve a very easy instance of n-queens problem leads to an infinite solving time. This problem only occurs when we request to print all the solution (-a) found using an ActivityBased strategy (-bb 3).

public class demo {
  public static void main(String[] argv) throws Exception {
    org.chocosolver.parser.xcsp.XCSP xcsp = new org.chocosolver.parser.xcsp.XCSP();
    xcsp.addListener(new org.chocosolver.parser.xcsp.BaseXCSPListener(xcsp));
    xcsp.setUp(new String[]{"queens.xcsp3", "-a", "-bb", "3"});
    xcsp.defineSettings(new org.chocosolver.parser.xcsp.XCSPSettings());
    xcsp.createSolver();
    xcsp.buildModel();
    xcsp.configureSearch();
    xcsp.solve();
  }
}

queens.xcsp3:

<instance format="XCSP3" type="CSP">
<variables>
<array id="q" size="[4]"> 0..3 </array>
</variables>
<constraints>
<allDifferent>
q[]
</allDifferent>
<allDifferent>
add(q[0],0) add(q[1],1) add(q[2],2) add(q[3],3)
</allDifferent>
<allDifferent>
sub(q[0],0) sub(q[1],1) sub(q[2],2) sub(q[3],3)
</allDifferent>
</constraints>
</instance>
@cprudhom
Copy link
Member

cprudhom commented Mar 4, 2019

Hi,

And thank you for the bug report.
The thing is: looking for all solutions of a satisfaction problem with a black-box search strategy may lead to find the same solution more than once.
In your case, there is a combination of unlucky parameters that produces a never ending loop...

Indeed, ABS restarts on each solution and during the probing phase, on each failure.
In addition, a fast restart strategy is added to force restarting every 500 failure.
Finally, a nogood-from-restart option is plugged-in, that should prevent the same search tree to be rediscovered again and again.
But the latter is not able to extract nogood when no decision are refuted, which is the case here due to ABS that is good at building path to solutions.
Long story short, you must add a nogood-from-solution option, which is not available as a CLI option...
I'll add it and let you know.

Best

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants