Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #659 #660

Merged
merged 4 commits into from Jan 20, 2020
Merged

Fix issue #659 #660

merged 4 commits into from Jan 20, 2020

Conversation

cprudhom
Copy link
Member

Fixes # 659.

Changes proposed in this PR:

  • Adding two methods in Solver, namely moveForward(Decision) and moveBackward to make possible applying a step-by-step search space exploration.

Example:

Model model = new Model();                               
IntVar x1 = model.intVar("x1", 0, 2);                    
IntVar x2 = model.intVar("x2", 0, 2);                    
x1.eq(x2).post();                                        
Solver solver = model.getSolver();                       
IntStrategy strategy = inputOrderLBSearch(x1, x2);       
Decision<IntVar> dec = null;         
int sol = 0;                         
boolean search = true;               
while(search) {                      
    if (solver.moveForward(dec)) {   
        dec = strategy.getDecision();
        if (dec == null) {           
            sol++;                   
        }else {                      
            continue;                
        }                            
    }                                
    search = solver.moveBackward();  
}                                    
System.out.printf("# solutions : %d\n", sol);

@codecov-io
Copy link

Codecov Report

Merging #660 into master will decrease coverage by 22.92%.
The diff coverage is 0%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master     #660       +/-   ##
=============================================
- Coverage      62.7%   39.77%   -22.93%     
+ Complexity    10309     6779     -3530     
=============================================
  Files           658      658               
  Lines         42712    42747       +35     
  Branches       7807     7811        +4     
=============================================
- Hits          26782    17003     -9779     
- Misses        13603    24045    +10442     
+ Partials       2327     1699      -628
Impacted Files Coverage Δ Complexity Δ
...r/src/main/java/org/chocosolver/solver/Solver.java 63.15% <0%> (-19.81%) 85 <0> (-23)
...r/parser/flatzinc/ast/declaration/Declaration.java 0% <0%> (-100%) 0% <0%> (-1%)
.../chocosolver/solver/search/limits/NodeCounter.java 0% <0%> (-100%) 0% <0%> (-3%)
...solver/constraints/set/PropIntCstNotMemberSet.java 0% <0%> (-100%) 0% <0%> (-5%)
...ava/org/chocosolver/solver/learn/Implications.java 0% <0%> (-100%) 0% <0%> (-1%)
.../chocosolver/solver/objective/ParetoOptimizer.java 0% <0%> (-100%) 0% <0%> (-15%)
...r/solver/constraints/extension/TupleValidator.java 0% <0%> (-100%) 0% <0%> (-1%)
...olver/constraints/extension/binary/PropBinAC3.java 0% <0%> (-100%) 0% <0%> (-15%)
...ava/org/chocosolver/solver/learn/IExplanation.java 0% <0%> (-100%) 0% <0%> (-1%)
...er/constraints/nary/binPacking/PropLoadToItem.java 0% <0%> (-100%) 0% <0%> (-17%)
... and 337 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 79091f5...56bb51a. Read the comment docs.

@cprudhom cprudhom merged commit 68854de into master Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants