Menu

We have a Problem with the sequence of expressions in Expression Solver

Artur
2019-04-16
2019-04-16
  • Artur

    Artur - 2019-04-16

    Hi all

    We have the list of the following expressions in this sequence:
    1)a = (b + c + d)
    2)e = (f + g + (-1 * h) + (-1 * j) + (-1 * k) + (-1 * l) + (-1 * m))
    3)d = (h + j + k + l + m)

    We use intvar type of JaCop and to get the results of expressions we use the following code.
    IntVar[] intVars = our vars;
    DepthFirstSearch<intvar> search = new DepthFirstSearch<>();
    SelectChoicePoint<intvar> select = new InputOrderSelect<>(
    store,
    intVars,
    new IndomainRandom<>()
    );
    boolean labeling = search.labeling(store, select);
    When we solve the expressions in the sequence shown above, we get infinite loop, but when we change the sequence to the following we get the results successfully.
    1)a = (b + c + d)
    2)d = (h + j + k + l + m)
    3)e = (f + g + (-1 * h) + (-1 * j) + (-1 * k) + (-1 * l) + (-1 * m))</intvar></intvar>

    Can you, please, tell us what is the reason of the problem.

    Regaeds` Artur

     

    Last edit: Artur 2019-04-16
  • kris

    kris - 2019-04-16

    Hi!

    To be able to answer your question in details I need to see your code or at least a larger chunk of the code. You can send it to me directly, if you do not want to show it here.

    In general, the search has expnential complexity and the order of variables to be used for assigning their values in search matters very much. You use InputOrder, try to use SimpleSelect with SmallestDomain variable selection method, for example.

    Best regards,
    /Kris

     

Log in to post a comment.