New user: reducing the problem space
by Adam Hirsch
Hey, folks -- I'm trying to wrap my head around Optaplanner by extending
the nurse-rostering example (for my wife, who's a nurse in a group that
needs a rostering solution, as it happens).
I've got a couple of approach/philosophy questions I haven't yet found
addressed in the docs, and I'm hoping someone could help direct me.
- How best to constrain a problem: Say I've got six people to schedule
and Employee A *must* work every Tuesday night and alternate Friday nights,
while the other five people should fill in the remaining shifts as best
they can with the other soft constraints I'm specifying. From my initial
reading, I'm thinking the best approach will be to specify an "only Tuesday
and alt Fridays" <Contract> in the scoreRules.xml (with an accompanying DRL
rule to match whether or not the particular employee is working shifts
other than those) and then specify it as a "hard" constraint for that
particular employee. Do I have that right, or is there some way to remove
those shifts entirely from the problem space, since we already know ahead
of time how they'll be allocated?
- A similar question would come up around Christmas, New Years, Arbor
Day, etc, to wit: if we know before the problem ever runs which employees
are supposed to be working those, what's the recommended approach to
pre-setting an employee into those particular shifts before trawling the
solution space?
Apologies if these are naive questions -- I suppose I could/should have
started with one of the easier examples, but, well, real world needs and
all.
Thanks!
Adam
12 years, 8 months
unable to resolve method using strict-mode:
by Roopa
RuleBaseTask failed: [Error: unable to resolve method using strict-mode:
This is the error I am getting while compiling drl file.
I am calling a method in the when clause.
The same code works fine in eclipse. Error is when I am compiling using ant
script.
Eclipse is doing some settings, that even I got to do in ant script.
I am using drools 5.5.0 and eclipse indigo.
Code :
function String updateQuery(Query querie, AOCCRuleKnobConfig
aoccRuleKnobConfig, String advPgmExclude, Logger log){
}
rule "ExecuteQuery"
//include attributes such as "salience" here...
no-loop true
salience 9
when
//conditions
$aoccRuleKnobConfig : AOCCRuleKnobConfig($commissionThreshold :
commissionThreshold)
$query : Query(name == "Account-Eligibility-Criteria" , $statement :
statement)
Query(name == "AdvisoryProgramExclusion" , $advPgmExclude :
statement)
$order : Order() from
hibernateSession.createSQLQuery(updateQuery($query, $aoccRuleKnobConfig,
$advPgmExclude, log))
.addScalar("id",LongType.INSTANCE)
.addScalar("totalCommission", BigDecimalType.INSTANCE)
.setResultTransformer(Transformers.aliasToBean(com.nph.radar.rule.operands.Order.class)).list();
then
end
Please do help me with this.
--
View this message in context: http://drools.46999.n3.nabble.com/unable-to-resolve-method-using-strict-m...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 8 months
Process Compilation Error: Drools can not be resolved
by V Vignesh
Hi guys,
I am new new to Rule Flow.
I am using eclipse for rule flow.
In a new Drools-Project
in ProcessTest.java
I tried to insert a HashMap in a knowledge base session
-------------------------------------------------------
HashMap hMap = new HashMap();
hMap.put("Id", "10");
hMap.put("RollNumber", "456");
FactHandle qMapHandle = ksession.insert(hMap);
ksession.startProcess("sample.ruleflow");
ksession.fireAllRules();
------------------------------------------------------
but in my ruleflow.rf
I added a script Task
when in its Action, i tried accessing this fact Handle i get an error
"Drools cannot be resolved"
---------------------------------------------
if(drools.getWorkingMemory().getFactHandles()){
System.out.println("Inside the Script Task");
}
---------------------------------------------
Can you please help me to figure out the Reasons for Compilation Error
--
View this message in context: http://drools.46999.n3.nabble.com/Process-Compilation-Error-Drools-can-no...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 8 months
How to get Parameters in Script Task
by V Vignesh
Hi guys,
I am new new to Rule Flow.
I am use eclipse for rule flow.
In a new Drools-Project
in ProcessTest.java
I tried to insert a HashMap in a knowledge base session
-------------------------------------------------------
HashMap hMap = new HashMap();
hMap.put("Id", "10");
hMap.put("RollNumber", "456");
FactHandle qMapHandle = ksession.insert(hMap);
ksession.startProcess("sample.ruleflow");
ksession.fireAllRules();
------------------------------------------------------
but in my ruleflow.rf
I added a script Task
when in its Action, i tried accessing this HashMap i am unable to get it
----------------------------------------------------
if(hMap.get("Id"){
System.out.println("Student exists");
}
---------------------------------------------------
Can you please help me to figure out retrieving the HashMap from my Process
Test.java inside the Script Task of rule-flow.rf?
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-get-Parameters-in-Script-Task-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 8 months
[OptaPlanner] conflict Resolver 'org.drools.core.conflict.DepthConflictResolver' not found
by Sandeep Bandela
Hi,
I am using planner 6.0.0.beta5. to schedule some kind of events like in
curriculum example, and created web front end for this using Vaadin.
but for some reason some users (only few) from this web client get this
exception (at the end) and scheduler fails.
What could have been the cause for this? the code I have is as follows.
SolverFactory solverFactory = new XmlSolverFactory(
"/org/optaplanner/examples/curriculumcourse/solver/curriculumCourseSolverConfig.xml");
TerminationConfig tc =
solverFactory.getSolverConfig().getTerminationConfig();
tc.setMaximumSecondsSpend(120L);
Solver solver = solverFactory.buildSolver();
creating the solver is throwing the exception.
log:
*java.lang.IllegalArgumentException: conflict Resolver
'org.drools.core.conflict.DepthConflictResolver' not found
at
org.drools.core.RuleBaseConfiguration.determineConflictResolver(RuleBaseConfiguration.java:866)
~[drools-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.drools.core.RuleBaseConfiguration.init(RuleBaseConfiguration.java:455)
~[drools-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.drools.core.RuleBaseConfiguration.init(RuleBaseConfiguration.java:411)
~[drools-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.drools.core.RuleBaseConfiguration.<init>(RuleBaseConfiguration.java:262)
~[drools-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieBaseConfiguration(KieServicesImpl.java:146)
~[drools-compiler-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildKieBase(ScoreDirectorFactoryConfig.java:330)
~[optaplanner-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildDroolsScoreDirectorFactory(ScoreDirectorFactoryConfig.java:280)
~[optaplanner-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:187)
~[optaplanner-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:175)
~[optaplanner-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.optaplanner.core.config.solver.SolverConfig.buildSolver(SolverConfig.java:145)
~[optaplanner-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.optaplanner.core.config.solver.XmlSolverFactory.buildSolver(XmlSolverFactory.java:104)
~[optaplanner-core-6.0.0.Beta5.jar:6.0.0.Beta5]*
--
Regards,
Sandeep Bandela.
12 years, 8 months
compare attributes form similar type
by kashif10
Hi I need help to come up with the expression which match an attribute form
similar type of bean.
e.g matching dob of all Person object.
Example:
I have Person Object
Person{
Date dateOfBith;
String name;
String gender;
}
exists (Person ( gender=="male" , <whose dob is first in period 1/1/2012 to
12/31/2012>) )
Now at run time, I am going to get data of multiple Persons.
If a person who born first in 2012 among all person data & if he is male -->
condition match.
But if that person is a female then condition will not match.
--
View this message in context: http://drools.46999.n3.nabble.com/compare-attributes-form-similar-type-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 8 months
Re: [rules-users] So can you automatically upload a POJO JAR Model or not?
by Nicolas Héron
Hi,
Yes it is possible to upload a pojo jar over rest. There were commits in
the 5.5.x branch so you have to compile it yourself.
Contact me in direct if you need more info : nicolas dot heron at pymma dot
com
Cheers
Nicolas
2013/8/16 Mark Bennett [via Drools] <ml-node+s46999n4025580h13(a)n3.nabble.com
>
> Hi guys,
>
> I'm using 5.5, and I've looked around and around on Google, and although
> I've seen a few claims that this might work, so far I haven't had any luck.
> I'm getting various errors, 404 no such page, also "service not
> available".
>
> I do pass in the authentication header. I'm also making sure to generate
> Java 1.6 classes, and the UI accepts the JAR without complaint and exposes
> it in the UI.
>
> I saw one post claiming to upload as an asset, but there was some code
> change required to Drools/Guvnor to get it to treat it as a model, so
> that's not an option.
>
>
> Let me try a few simple questions that might narrow this down:
>
> * Would you expect to use the REST API or the Webdav API to upload?
>
> * What would the URL look like? (I've tried a bunch, looks simple enough
> online, and I'm able to download the DRLs)
>
> * I downloaded the combo pack of JBoss and Drools/Guvnor 5.5. Is there
> maybe some config change needed to enable the additional REST or Webdav
> URLs?
>
> * When you submit a JAR interactively, I know GWT is involved, but does it
> hand over the request to either the REST or Webdav API? OR does it have
> some other special entrance into the system, some third way in? And if so,
> could I use that?
>
> * Would I use a POST or a PUT? The theory seems to be use POST if it's
> new, or PUT if it's an update, but neither has worked.
>
> * What mime type would you use? The 3 ideas were octet-stream, multipart
> or java jar (not the exact syntax)
>
> * Would I shove just the bytes of the jar file, or do I need multipart and
> also include some type of XML file as well?
>
> * Is it OK to just write the raw bytes of the jar, or do I need to encode
> them?
>
> * Assuming I could upload a JAR, would I then also need to issue some type
> of "commit", the way the UI does?
>
> * Do you agree that this should be possible to test with curl? (to
> eliminate Java coding and library differences as the problem)
>
> * Instead of a JAR, is there some other fact model / syntax that I can
> automatically generate and upload? I get the impression there is, but
> neither the doc nor the 3 books seem very specific, I haven't seen a full
> example of this.
>
> * Generally, for dynamic models driven by external systems, what is the
> "Best Practice" for telling the Guvnor UI about the model? Maybe I'm going
> about this all wrong?
>
> * Does Drools 6 and the new Guvnor replacement suddenly make this much
> easier?
>
>
> I've been looking around and experimenting for about a week now so I'm
> running out of ideas.
>
> Thanks,
> Mark
>
> --
> Mark Bennett / LucidWorks: Search & Big Data / [hidden email]<http://user/SendEmail.jtp?type=node&node=4025580&i=0>
> Office: 408-898-4201 / Telecommute: 408-733-0387 / Cell: 408-829-6513
>
>
> _______________________________________________
> rules-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4025580&i=1>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://drools.46999.n3.nabble.com/rules-users-So-can-you-automatically-up...
> To start a new topic under Drools: User forum, email
> ml-node+s46999n47000h33(a)n3.nabble.com
> To unsubscribe from Drools, click here<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscr...>
> .
> NAML<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_vi...>
>
-----
Nicolas Héron
--
View this message in context: http://drools.46999.n3.nabble.com/Re-rules-users-So-can-you-automatically...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 8 months
Re: [rules-users] unable to resolve method using strict-mode
by Roopa
Hi,
Even I am struck in the same kind of problem.
"RuleBaseTask failed: [Error: unable to resolve method using strict-mode:
com.nph.radar.drools.UpdateQuery.updateQuery(com.nph.radar.rule.operands.Query,
com.nph.radar.rule.operands.AOCCRuleKnobConfig, java.lang.String,
org.apache.log4j.Logger)]"
[Near : {... updateQuery($query, $aoccRuleK ....}]
This is the error I am getting while compiling drl file.
I am calling a method in the when clause.
The same code works fine in eclipse. Error is when I am compiling using ant
script.
Eclipse is doing some settings, that even I got to do in ant script.
I am using drools 5.5.0 and eclipse indigo.
Code :
function String updateQuery(Query querie, AOCCRuleKnobConfig
aoccRuleKnobConfig, String advPgmExclude, Logger log){
}
rule "ExecuteQuery"
//include attributes such as "salience" here...
no-loop true
salience 9
when
//conditions
$aoccRuleKnobConfig : AOCCRuleKnobConfig($commissionThreshold :
commissionThreshold)
$query : Query(name == "Account-Eligibility-Criteria" , $statement :
statement)
Query(name == "AdvisoryProgramExclusion" , $advPgmExclude :
statement)
$order : Order() from
hibernateSession.createSQLQuery(updateQuery($query, $aoccRuleKnobConfig,
$advPgmExclude, log))
.addScalar("id",LongType.INSTANCE)
.addScalar("totalCommission", BigDecimalType.INSTANCE)
.setResultTransformer(Transformers.aliasToBean(com.nph.radar.rule.operands.Order.class)).list();
then
end
Thanks in advance.
--
View this message in context: http://drools.46999.n3.nabble.com/unable-to-resolve-method-using-strict-m...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 8 months