Skip to content

Commit

Permalink
Make possible to plug a Runnable on solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
cprudhom committed Jun 27, 2024
1 parent cbe70c8 commit 962f55b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions solver/src/main/java/org/chocosolver/solver/Solver.java
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,15 @@ public void unplugMonitor(ISearchMonitor sm) {
searchMonitors.remove(sm);
}

/**
* Operation to execute when a solution is found
*
* @param r operation to execute
*/
public void onSolution(Runnable r) {
searchMonitors.add((IMonitorSolution) r::run);
}

/**
* Empties the list of search monitors.
*/
Expand Down

0 comments on commit 962f55b

Please sign in to comment.