<html><body><div style="color:#000; background-color:#fff; font-family:tahoma, new york, times, serif;font-size:10pt">Hi Geoffrey,<br><br>Thanks for the support so far.<br>I understand that you do not provide full support on this level. <br>Though I have the feeling that this is really <br>- a very basic solution setup<br>- a beginners-mistake and since I'm looking into it now for about 3 days (since I started with planner) it seems to be not obvious to find for a beginner.<br>So I was trying my luck in offering the code.<br>It could be an opportunity to enrich the documentation ;-) ;-)<br><br><br>Ok, <br><br><span style="font-weight: bold;">1) </span>adding the $t2 results in the same sort of exception, only planningEntity seems different:<br><br>with <span style="font-weight: bold;">insertLogical(new UnweightedConstraintOccurrence("tasksInSameJobMustBeInSamePeriod", $t1, $t2));</span><br><br>Exception in thread "main"
java.lang.IllegalStateException: Score corruption: the workingScore (-2) is not the uncorruptedScore (0):<br> The workingMemory has 2 ConstraintOccurrence(s) in excess:<br> tasksInSameJobMustBeInSamePeriod/NEGATIVE_HARD:[Maintenance of Boeing 737 - PJ23.I#1 73111693, Maintenance of Boeing 737 - PJ23.I#2 427578167]<br> tasksInSameJobMustBeInSamePeriod/NEGATIVE_HARD:[Maintenance of Boeing 737 - PJ23.I#2 427578167, Maintenance of Boeing 737 - PJ23.I#1 73111693]<br> Check the score rules who created those ConstraintOccurrences. Verify that each ConstraintOccurrence's causes and weight is correct.<br> at org.drools.planner.core.score.director.AbstractScoreDirector.assertWorkingScore(AbstractScoreDirector.java:101)<br> at org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.doMove(DefaultGreedyDecider.java:110)<br> at
org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.decideNextStep(DefaultGreedyDecider.java:78)<br> at org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:63)<br> at org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:183)<br> at org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:151)<br> at be.axi.planner.domain.MaintenancePlanning.main(MaintenancePlanning.java:27)<br> <br>with <span style="font-weight: bold;">insertLogical(new UnweightedConstraintOccurrence("tasksInSameJobMustBeInSamePeriod", $t1));</span><br> <br>Exception in thread "main" java.lang.IllegalStateException: Score corruption: the workingScore (-2) is not the uncorruptedScore (0):<br> The workingMemory has 2
ConstraintOccurrence(s) in excess:<br> tasksInSameJobMustBeInSamePeriod/NEGATIVE_HARD:[Maintenance of Airbus A350 - XJ34.I#2 778813475]<br> tasksInSameJobMustBeInSamePeriod/NEGATIVE_HARD:[Maintenance of Airbus A350 - XJ34.I#0 225744121]<br> Check the score rules who created those ConstraintOccurrences. Verify that each ConstraintOccurrence's causes and weight is correct.<br> at org.drools.planner.core.score.director.AbstractScoreDirector.assertWorkingScore(AbstractScoreDirector.java:101)<br> at org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.doMove(DefaultGreedyDecider.java:110)<br> at org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.decideNextStep(DefaultGreedyDecider.java:78)<br> at
org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:63)<br> at org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:183)<br> at org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:151)<br> at be.axi.planner.domain.MaintenancePlanning.main(MaintenancePlanning.java:27) <br><div><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><span><span style="font-weight: bold;">2) </span>You suggested to replace UnweightedConstraintOccurrence with </span>IntConstraintOccurrence. I
will.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;">UnweightedConstraintOccurrence is used in the very basic Queens example though...</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><br> </div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: tahoma,new york,times,serif; background-color: transparent; font-style: normal;"><span style="font-weight: bold;">3) </span>Where is the best place to read about what <span style="font-style: italic;">insertLogical</span> and <span style="font-style: italic;"><span></span>IntConstraintOccurrence </span><span>really do?<span><br></span></span></div>What is the purpose of the Cause -objects, which should be passed?<br>=> where is the best place to find explanation about this?<br>(<a
href="http://docs.jboss.org/drools/release/5.4.0.Final/drools-planner-docs/html_single/">http://docs.jboss.org/drools/release/5.4.0.Final/drools-planner-docs/html_single/</a> doesn't really enlighten me on that part)<br><br>Thanks in advance.<br><br><div>-----------------<br>http://www.codessentials.com - Your essential software, for free!<br>Follow us at http://twitter.com/#!/Codessentials<br></div> <div style="font-family: tahoma, new york, times, serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Geoffrey De Smet <ge0ffrey.spam@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> Michiel Vermandel <mvermand@yahoo.com>; Rules Users List <rules-users@lists.jboss.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, September 3, 2012
9:47 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: Best model for planning? technicians, airplanes and shifts<br> </font> </div> <br>
Without going through the code with a fine comb (which we don't generally do on this level of free support), it's a bit hard to tell.<br><br>Some suggestions to take a look at:<br><br>1) Verify that the exception message now is still _exactly_ the same. You could be looking at another score corruption exception.<br>If it differs the slightest bit, can you paste it again?<br><br>2) Switch from UnweightedConstraintOccurrence to IntConstraintOccurrence, because none of the examples use the former and most examples use the latter. If that fixes it, let me know so I can verify and fix the bug, although on first sight I don't see a bug in the code of UnweightedConstraintOccurrence.<br><br><br>Op 03-09-12 09:00, Michiel Vermandel schreef:<br>> Indeed, it did not help.<br>> <br>> Any other ideas?<br>> Please...<br>> <br>> Thanks,<br>> <br>> Michiel<br>> *From:* Geoffrey De Smet <<a ymailto="mailto:ge0ffrey.spam@gmail.com"
href="mailto:ge0ffrey.spam@gmail.com">ge0ffrey.spam@gmail.com</a>><br>> *To:* Rules Users List <<a ymailto="mailto:rules-users@lists.jboss.org" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>> *Sent:* Monday, September 3, 2012 8:37 AM<br>> *Subject:* Re: [rules-users] Best model for planning? technicians,<br>> airplanes and shifts<br>> <br>> Op 02-09-12 16:11, Michiel Vermandel schreef:<br>> > Hi,<br>> ><br>> > I have set the environment option to DEBUG and now the solver reports<br>> > this exception:<br>> > Exception in thread "main" java.lang.IllegalStateException: Score<br>> > corruption: the workingScore (-2) is not the uncorruptedScore (0):<br>> > The workingMemory has 2 ConstraintOccurrence(s) in excess:<br>> > tasksInSameJobMustBeInSamePeriod/NEGATIVE_HARD:[Maintenance of
Boeing<br>> > 737 - PJ23.I#1]<br>> > tasksInSameJobMustBeInSamePeriod/NEGATIVE_HARD:[Maintenance of<br>> > Boeing 737 - PJ23.I#2]<br>> > Check the score rules who created those ConstraintOccurrences. Verify<br>> > that each ConstraintOccurrence's causes and weight is correct.<br>> > at<br>> ><br>> org.drools.planner.core.score.director.AbstractScoreDirector.assertWorkingScore(AbstractScoreDirector.java:101)<br>> > at<br>> ><br>> org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.doMove(DefaultGreedyDecider.java:110)<br>> > at<br>> ><br>> org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.decideNextStep(DefaultGreedyDecider.java:78)<br>> >
at<br>> ><br>> org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:63)<br>> > at<br>> ><br>> org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:183)<br>> > at<br>> ><br>> org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:151)<br>> > at<br>> ><br>> be.axi.planner.domain.MaintenancePlanning.main(MaintenancePlanning.java:27)<br>> ><br>> > It is caused by this rule:<br>> ><br>> > rule "tasksInSameJobMustBeInSamePeriod"<br>> > when<br>> > $t1 : MaintenanceTask($id : id, $periodId : periodId, $jobId :<br>> > jobId )<br>> >
$t2 : MaintenanceTask(id != $id, periodId != $periodId, jobId<br>> > == $jobId)<br>> > then<br>> > insertLogical(new<br>> > UnweightedConstraintOccurrence("tasksInSameJobMustBeInSamePeriod", $t1));<br>> I expect you would add $t2 to the causes too:<br>> insertLogical(new<br>> UnweightedConstraintOccurrence("tasksInSameJobMustBeInSamePeriod",<br>> $t1, $t2));<br>> <br>> It's unlikely that that's causing the score corruption though.<br><br><br><br> </div> </div> </div></body></html>