[rules-users] Planner: How to Set Global Varaiables

Geoffrey De Smet ge0ffrey.spam at gmail.com
Wed Jan 2 11:01:12 EST 2013


Global variables in DRL's in Planner are an open discussion, feel free 
to add your viewpoints:
   https://issues.jboss.org/browse/JBRULES-2700

Originally, I figured the SolverFactory.setRuleBase() (will we be 
refactored to setKnowledgeBase() or setKieBase())
would be sufficient to expose all of drools's capabilities to the user's 
(and basically do whatever they want),
but globals are set per KnowledgeSession (AKA WorkingMemory), so that 
doesn't allow the user access.
And Planner might use multiple KnowledgeSession's, especially in genetic 
algorithms or multi-threaded solving.
If you want to investigate the code yourself:
Each KnowledgeSession is wrapped by a DroolsScoreDirector which is 
created by the DroolsScoreDirectorFactory.

So let me reverse the question:
How would want Planner to expose setGlobal functionality, knowing that 
it might use multiple KnowledgeSession for 1 Solver (one per solving 
thread)?

Op 02-01-13 14:48, jonathan.labin schreef:
> I see in the documentation for Drools Expert a description of how to set
> global variables through the API via a StatefullKnowledgeSession or
> StatelessKnowledgeSession.
>
> How is this achieved when using the Drools Planner?  I have a solver
> instance that is created from a XmlSolverFactory (as shown in the examples).
> Is there a sequence of getters calls originating at the Solver instance that
> ultimately gets to the ksession on which setGlobal can be called?
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Planner-How-to-Set-Global-Varaiables-tp4021333.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



More information about the rules-users mailing list