Menu

Clarification about DebtFirstSearch class

Help
2019-05-02
2019-05-02
  • Erik Zhamakochyan

    Hello everyone

    I would like to know more comprehensively how the DepthFirstSearch class solves expressions. I think, that it finds all possible solutions during the solving process, and then it chooses one of them randomly. If what I think is right, can I somehow "make" it provide us the first found answer, and stop looking for other possible solutions.

    Thank you
    Erik

     
  • kris

    kris - 2019-05-02

    No, DepthFirstSearch class searches for a solution and can stop after finding the first one. You control whether it finds all solutions or only the first one by the followoing instruction.

    search.getSolutionListener().searchAll(true);
    

    and seting the value to true or false.

    Morover search selects variables and values assigned to these variables using choice point selection (a class implementing interface SelectChoicePoint). In the classes implementing this interface one defines in what order variables are selected and what values are assigned. Please, check the documentation or the code.

    Best,
    /Kris

     

Log in to post a comment.