|
Op 06-12-12 14:37, Michiel Vermandel
schreef:
The construction heuristics first need to insert all planning entities (uninitialized) into the working memory. This means the planning variables are still null at that time. The best way to make your rules null safe is to use null safe getters: class ShiftAssignment { ... public Contract getContract() { if (employee == null) { return null; } return employee.getContract(); } } when ShiftAssignment (contract != null, ...) No, the gain of using construction heuristics is too way big to ignore them. It's an open discussion currently: - Users suffer because they need to make their rules null safe. I recognize this. - Planner implementation wise, it makes far more sense to require the rules to be null safe -- avoids certain bugs - What should Planner return if no initialized solution has been found yet? -- (the constr heuristics aren't finished yet) -- What would be the Score of that uninitialized solution? - How does PlanningVariable(nullable = true) affect this? -- Returning an uninitialized best solution is much better than returning a null best solution - What can Drools Expert provide to make it easier to have null-safe rules? -- They now support an elvis-like operator but it's slower because it falls back on mvel.
|
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
