[rules-users] getting list of broken constraints for some solution(NOT BEST SOLUTION) in drools-planner

Nurlan nurlan.rakhimzhanov at gmail.com
Sat May 5 02:50:55 EDT 2012


Hi guys!
I'm using drools-planner-*5.4.0.CR1*...

Let's say I have some solution(NOT FINAL BEST SOLUTION) which done by human
manually and I want get list of broken contraints for that solution, I've
tried

	this.scoreDirector.setWorkingSolution(someSolution);
	this.scoreDirector.calculateScore();

it returns *null* since it isn't connected with Solver

then I've tried using Solver with
<termination><maximumStepCount>0</maximumStepCount></termination>:
	this.scoreDirector.setWorkingSolution(someSolution);
	this.solver.setPlanningProblem(this.scoreDirector.getWorkingSolution());
	
	this.solver.solve();
		
	this.scoreDirector.setWorkingSolution(this.solver.getBestSolution());
	this.scoreDirector.calculateScore();

then it shows *java.lang.UnsupportedOperationException* because there is no
best solution in Solver

java.lang.UnsupportedOperationException: StepCountTermination can only be
used for phase termination.
	at
org.drools.planner.core.termination.StepCountTermination.isSolverTerminated(StepCountTermination.java:40)
	at
org.drools.planner.core.termination.OrCompositeTermination.isSolverTerminated(OrCompositeTermination.java:42)
	at
org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:181)
	at
org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:151)


how can implement this task? or I have to implement setBestSolution in
Solver, i think this is bad idea...


--
View this message in context: http://drools.46999.n3.nabble.com/getting-list-of-broken-constraints-for-some-solution-NOT-BEST-SOLUTION-in-drools-planner-tp3964160.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list