Menu

Automatic creaton of boolean dependency formulas to solve with sat solver

Help
Moritz Fey
2016-09-08
2016-09-13
  • Moritz Fey

    Moritz Fey - 2016-09-08

    Hi,

    we are currently looking for a way to check if a certain configuration fullfills specific constraints. Our idea is to use JaCoP to generate possible solutions for these constraints and check our configuration afterwards.

    A typical constraint would be "a->(b&c)" or "a->(b^c)"

    As I understand, there is no easy way to express these constraints, or am I overlooking something?

    Best regards
    Moritz Fey

     
  • kris

    kris - 2016-09-08

    Hi Motitz!

    There exist several ways of representing this constraint.

    One way is to use finite domain solver and IfThen constraints since this models implication. In this case, you model your boolean expression, for example "a->(b&c)"as follows

    store.impose(new IfThen(new XeqC(a, 1), new And(new XeqC(b, 1), new XeqC(c, 1)))));

    The other way is to use SAT solver interfact (http://jacopguide.osolpro.com/guideJaCoP.html#x1-590001) and it will look more or less as

    SatTranslation sat = new SatTranslation(store);
    sat.impose(); // impose SAT-solver as constraint

    BooleanVar a = new BooleanVar(store, "a");
    BooleanVar b = new BooleanVar(store, "b");
    BooleanVar c = new BooleanVar(store, "c");
    BooleanVar x = new BooleanVar(store, "x");

    // adding SAT clauses
    sat.generate_implication(a, x);
    sat.generate_and(new BooleanVar[] {b, c}, x);

    /Kris

     
  • Radoslaw Szymanek

    Hi,

    I would recommend checking Gates example from JaCoP library.

    https://github.com/radsz/jacop/blob/master/src/main/java/org/jacop/examples/fd/Gates.java

    It contains example how to use ExtensionalSupport constraints to obtain good model for a bit more complex boolean constraints. There are multiple ExtensionalSupport constraints and you may want to experiment with different implementations.

    This type of approach gives you the strongest reasoning algorithm called GAC.

    best,
    Radek

     
  • Moritz Fey

    Moritz Fey - 2016-09-13

    Thank you very much for your responses! I'm looking into your recommendations.

    Best regards
    Moritz

     

Log in to post a comment.