Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"

Rodney Bowden

+ Follow
since May 03, 2019
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rodney Bowden

Hi, I am trying to write a rule to load balance, in the first instance, a singular contract. Below is the rule.

Exception in thread "AWT-EventQueue-0" Exception executing consequence for rule "fairAssignmentCountPerEmployee" in org.optaplanner.examples.nurserostering.solver: java.lang.NullPointerException
at org.drools.core.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(
at org.drools.core.common.DefaultAgenda.handleException(
at org.drools.core.phreak.RuleExecutor.innerFireActivation(
at org.drools.core.phreak.RuleExecutor.fireActivation(
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(
at org.drools.core.concurrent.AbstractRuleEvaluator.internalEvaluateAndFire(
at org.drools.core.concurrent.SequentialRuleEvaluator.evaluateAndFire(
at org.drools.core.common.DefaultAgenda.fireLoop(
at org.drools.core.common.DefaultAgenda.internalFireAllRules(
at org.drools.core.common.DefaultAgenda.fireAllRules(
at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(
at org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.calculateScore(
at org.optaplanner.examples.common.swingui.SolverAndPersistenceFrame.resetScreen(
at org.optaplanner.examples.common.swingui.SolverAndPersistenceFrame.setSolutionLoaded(
at org.optaplanner.examples.common.swingui.SolverAndPersistenceFrame.access$1(
at org.optaplanner.examples.common.swingui.SolverAndPersistenceFrame$DataImportAction.actionPerformed(
at javax.swing.AbstractButton.fireActionPerformed(
at javax.swing.AbstractButton$Handler.actionPerformed(
at javax.swing.DefaultButtonModel.fireActionPerformed(
at javax.swing.DefaultButtonModel.setPressed(
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
at java.awt.Component.processMouseEvent(
at javax.swing.JComponent.processMouseEvent(
at java.awt.Component.processEvent(
at java.awt.Container.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Container.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.LightweightDispatcher.retargetMouseEvent(
at java.awt.LightweightDispatcher.processMouseEvent(
at java.awt.LightweightDispatcher.dispatchEvent(
at java.awt.Container.dispatchEventImpl(
at java.awt.Window.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEventImpl(
at java.awt.EventQueue.access$500(
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(
Caused by: java.lang.NullPointerException
at org.drools.core.reteoo.FromNodeLeftTuple.getAccumulatedObjects(
at org.drools.core.common.AgendaItem.getObjectsDeep(
at org.drools.core.reteoo.RuleTerminalNodeLeftTuple.getObjectsDeep(
at org.optaplanner.core.api.score.holder.AbstractScoreHolder.extractJustificationList(
at org.optaplanner.core.api.score.holder.AbstractScoreHolder.registerConstraintMatch(
at org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScoreHolder.addSoftConstraintMatch(
at org.optaplanner.examples.nurserostering.solver.Rule_fairAssignmentCountPerEmployee343111290.defaultConsequence(
at org.optaplanner.examples.nurserostering.solver.Rule_fairAssignmentCountPerEmployee343111290DefaultConsequenceInvokerGenerated.evaluate(Unknown Source)
at org.optaplanner.examples.nurserostering.solver.Rule_fairAssignmentCountPerEmployee343111290DefaultConsequenceInvoker.evaluate(Unknown Source)
at org.drools.core.phreak.RuleExecutor.innerFireActivation(
... 53 more

Can see contract in debub
13:15:52.451 [EventQueue-0] INFO  HHH000397: Using ASTQueryTranslatorFactory
Hibernate: select as id1_20_, shiftonreq0_.employee_id as employee3_20_, shiftonreq0_.shift_id as shift_id4_20_, shiftonreq0_.weight as weight2_20_ from ShiftOnRequest shiftonreq0_
1 month ago
Does anyone have an example code to enable the update of the username and password fields within the hibernate.cfg file via JAVAFX?
1 month ago
I fixed my problem as per the below

package org.optaplanner.examples.nurserostering.persistence;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.poi.hssf.util.CellReference;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.optaplanner.examples.common.persistence.AbstractXlsxSolutionExporter;

import org.optaplanner.examples.nurserostering.domain.Employee;
import org.optaplanner.examples.nurserostering.domain.NurseRoster;
import org.optaplanner.examples.nurserostering.domain.NurseRosterParametrization;
import org.optaplanner.examples.nurserostering.domain.ShiftAssignment;
import org.optaplanner.examples.nurserostering.domain.ShiftDate;

1 month ago
I would like to position my output based on the column value (the date). See attachment Screen Shot. Below is my current code.  I would like to place the shift code value cell.setCellValue(obj.getShiftType().getCode()); for the employee in the correct date column and row. Any suggestions welcome.


1 month ago
Hi There, I am trying to export to excel in a particular format. Below is my current code:  

I can get the following formats.. Viewed better in attachment: What I really want is the date to be a header and the shift code to align to the date and employee. Any suggestions?

Isabella       D L E E L N N L
Anthony Phan   D D L D E D L L
Michael B       D L N L L N N L
Alana Gill       N N N N N N N N
Sophie Dreves   E E D D D L E E
Reece Bamford   N D D L N E E D
Clayton Fletcher   E E E E E D L L
Gemma Nevin       D L L N E E D L
Michael C       E E N N D E L D
Lisa Coull       D L L L D L E E
Karen Ahrens   L E E E N D E D
David Hemmings     L N N N N N N N

Isabella            2019-04-09/D 2019-04-10/D 2019-04-11/L 2019-04-14/E 2019-04-15/E 2019-04-16/L 2019-04-19/N 2019-04-20/N 2019-04-21/L
Anthony Phan        2019-04-08/D 2019-04-09/D 2019-04-10/D 2019-04-11/L 2019-04-15/D 2019-04-16/E 2019-04-17/D 2019-04-18/L 2019-04-19/L
Michael B            2019-04-10/L 2019-04-11/D 2019-04-12/L 2019-04-13/N 2019-04-15/L 2019-04-16/L 2019-04-19/N 2019-04-20/N 2019-04-21/L
Alana Gill            2019-04-08/L 2019-04-09/N 2019-04-10/N 2019-04-11/N 2019-04-12/N 2019-04-16/N 2019-04-17/N 2019-04-18/N 2019-04-21/N
Sophie Dreves        2019-04-08/N 2019-04-12/E 2019-04-13/E 2019-04-14/D 2019-04-15/D 2019-04-16/D 2019-04-17/L 2019-04-20/E 2019-04-21/E
Reece Bamford        2019-04-08/L 2019-04-09/N 2019-04-12/D 2019-04-13/D 2019-04-14/L 2019-04-15/N 2019-04-17/E 2019-04-18/E 2019-04-19/D
Clayton Fletcher    2019-04-08/D 2019-04-09/E 2019-04-10/E 2019-04-11/E 2019-04-15/E 2019-04-16/E 2019-04-17/D 2019-04-18/L 2019-04-19/L
Gemma Nevin         2019-04-10/L 2019-04-11/D 2019-04-12/L 2019-04-13/L 2019-04-14/N 2019-04-17/E 2019-04-18/E 2019-04-19/D 2019-04-20/L
Michael C            2019-04-09/E 2019-04-10/E 2019-04-11/E 2019-04-13/N 2019-04-14/N 2019-04-18/D 2019-04-19/E 2019-04-20/L 2019-04-21/D
Lisa Coull            2019-04-08/N 2019-04-12/D 2019-04-13/L 2019-04-14/L 2019-04-15/L 2019-04-16/D 2019-04-17/L 2019-04-20/E 2019-04-21/E
Karen Ahrens        2019-04-08/E 2019-04-09/L 2019-04-12/E 2019-04-13/E 2019-04-14/E 2019-04-15/N 2019-04-18/D 2019-04-19/E 2019-04-20/D
David Hemmings      2019-04-08/E 2019-04-09/L 2019-04-10/N 2019-04-11/N 2019-04-12/N 2019-04-16/N 2019-04-17/N 2019-04-18/N 2019-04-21/N

1 month ago
Hi there, I am trying to pass some data from a list into a spreadsheet. Current code below: This works fine in giving me a format as follows. But what i really want is the format as per attached. Any ideas greatly appreciated as I am struggling


Karen Ahrens E 2019-04-08
David Hemmings E 2019-04-08
Clayton Fletcher D 2019-04-08
Anthony Phan D 2019-04-08
Reece Bamford L 2019-04-08
Alana Gill L 2019-04-08
Sophie Dreves N 2019-04-08
Lisa Coull N 2019-04-08
Gemma Nevin E 2019-04-09
Michael C E 2019-04-09
Michael B D 2019-04-09
Isabella D 2019-04-09
Karen Ahrens L 2019-04-09
David Hemmings L 2019-04-09
Reece Bamford N 2019-04-09
Alana Gill N 2019-04-09
Gemma Nevin E 2019-04-10
Michael C E 2019-04-10
Michael B D 2019-04-10
Isabella D 2019-04-10

Name           2019-04-08     2019-04-09
Karen Ahrens            E                L
David Hemmings    E           L
Clayton Fletcher   D
Anthony Phan             D
Reece Bamford   L               N
Alana Gill L          N
Sophie Dreves  N
Lisa Coull          N
Gemma Nevin
Michael C
Michael B

2 months ago