Egg Planning: number of facts is also a planning variable
by Paul Adams
Hi everyone,
I'm new to Drools, so apologies if I'm missing something obvious or mixing up my terms here. Hopefully the subject line got someone's attention!
My problem is this (somewhat contrived and simplified):
Facts:
1. A person would like to eat 3 eggs per day, of each of several different breeds (Legbar, Rhode Island Red, Dorking)
2. A hen takes 45 days to get to egg-laying stage (varies by breed)
3. At maturity, each hen lays 2 eggs every 10 days (also varies by breed)
4. A hen house has 30 available roosts
5. Each hen can lay 5 times before they give up (luckily for us this isn't really true!)
My planning problem is to figure out how many chicks I need to buy, when I need to buy them, and to allocate them to a particular roost for their entire egg-laying life. Basically what I would like the solution to contain is an allocation of a particular hen to a roost for a particular period, when the eggs will appear, and when a roost will become free to plan more hens.
Hard Constraint:
No hen can share the same roost
The problem feels like the hospital bed problem in the examples, but where the number of patients is both a planning variable and a fact, and the planning period is undefined. As I said, the problem is paraphrased and simplified - there are a number of soft constraints - some hens like it hot :-)
I would appreciate any guidance as to how I might model this problem, or any simplifications I could make.
Many thanks,
Paul.
12 years, 1 month
1 Week Until Intellifest - Register soon to learn about Drools & jBPM
by Mark Proctor
http://blog.athico.com/2012/10/1-week-until-intellifest-register-soon.html
----
Only 1 week to go for IntelliFest 2012, in San Diego, start Monday 22nd of October.
Program Overview ( detailed agenda for Monday and Tuesday below ):
Monday - Healthcare focus for Rules, Workflow, Ontologies and Events (Free)
Tuesday - General Drools&jBPM session (Free)
Tuesday - Rule Design Patterns in Production Rule Systems
Wed - Fri - General IntelliFest Sessions
There are limited spaces, so register soon here.
Monday - Healthcare focus for Rules, Workflow, Ontologies and Events (free)
0830-0920 Captain Emory Fry, MD
Socratic Grid : Open Source Distributed Decision Support for Healthcare
0930-1020 Dr Robert Greenes, Department of Biomedical Informatics, Arizona State University
Key Note : Embedding Decision Support in Clinical Systems
1030-1120 Dr Aziz Boxwala, Division of Biomedical Informatics, University of California
Clinical Decision Support Consortium
1130-1200 Dr Seong Ki Mun, President and CEO of OSEHRA
Open Source Electronic Health Record Agent
1200:1300 Lunch
1300-1350 Dr Davide Sottara, Department of Biomedical Informatics, Arizona State University
Knowledge Representation Standards For Building Executable Clinical Processes Models
1400-1450 David Shields, Health ITS, University of Utah
OpenCDS: a Clinical Decision Support Infrastructure Based on Drools
1500-1520 Harold Solbring, Division of Biomedical Informatics, Mayo Clinic
Semantic Wiki
1530-1655 Conor Dowling, Caregraf
Semantic Terminology Services
1600-1620 Dr Xiao Hu, Department of Neurosurgery, University of California
Clinical Decision Support Driven Alarms
1630-1700
Panel Discussion - Collaboration Opportunities
Tuesday - General Drools&jBPM Workshop (free)
8.00 AM: Breakfast Social – pre-laptop setup, and QA time with solution Architects.
-Key will be provided to setup your laptop, so you can view and run the examples used during the talks.
9.00 BRMS Product Overview (Prakash Aradhya 15min)
How we turn the Drools and jBPM communtiy parts into a world class product. Supporting and harvesting all the innovation done in the open community, Red Hat delivers reliable, dependable and integrated solutions for enterprise customers.
9.15 Introduction to Drools Expert (Mark Proctor 45min)
Drools Expert covers the business rule engine. A gentle, example driven, dive into the Drools technical rule language and engine features.
10.10 Introduction to Drools Fusion (Edson Tirelli 45min)
Learn how Drools does CEP differently. Our unified approach extends Drools Expert with a series of language and sub-engine extensions to provide temporal reasoning and event correlation.
11.05 Introduction to jBPM and BPMN2 (Tihomir Surdilovic 45min)
jBPM is a BPM engine designed for flexible processes, implementing and extending the BPMN2 spec. Built form the ground up to be part of a unified strategy for business automation and decision management. jBPM fully integrates with Drools Expert and Fusion.
11.45 Decision Modelling with Graphical Editors (Edson Tirelli 30min)
Drools Expert provides sophisticated web based tooling, around decision tables, guided editors and templates. Our decision modelling approach draws from the very best research found at Dr Jan Vanthienien school of Decision Modelling.
12.30 Working Lunch – Experience Drools and jBPM – Hands on labs (Optional) (1hour)
13.30 Human Tasks up Close and Personal (Tihomir Surdilovic 40min)
Human tasks are a central component of BPM. This example driven talk will build an example live, demonstrating what jBPM’s Human Task technology can do for you.
14.20 Building Games with Drools – Pong, Snake and Wumpus (Mark Proctor 40min)
Time for some hard play, learn how to build classic computer games with Drools. These also provide interesting exercises in BA requirements gathering.
15.10 Drools Planner a Quick Overview (Geoffrey De Smet 40min)
Whether it’s employee rostering, task scheduling, vehicle routing, bin packing or another planning problem: all organizations try to optimize their limited resources under constraints. Drools Planner optimizes business resources for normal Java programmers.
15.50 Drools Chance for Imperfect Reasoning (Davide Sottara 40min)
Sometimes data quality is not perfect, so facts may not be known with precision and certainty. Likewise, crisp constraints such as hard thresholds might not be able to capture the complexity of a business policy. Drools Chance allows to apply gradual and/or probabilistic constraints to uncertain or vague data.
16.40 UberFire – Drools&jBPM Workbench framework (Mark Proctor 30min)
UberFire is a new project that forms the foundation of our 6.0 web tooling. It’s standalone framework that provides a sophisticated workbench framework for the web; where everything is a plugin. Come learn about the Uberfire, and how you can use the workbench to build your own web applications.
17.10 Drools&jBPM 6.0 and Beyond (Optional : open as long as people remain)
An open presentation and discussion about the design ideas, principles and goals that are driving the development of Drools & jBPM version 6.0. This will be an optional and informal session where attendees will have the opportunity to learn about what is coming, contribute ideas and provide feedback that will be taken in consideration by the development team.
17.10 Hands on Lab
Run at the same time as "Drools&jBPM and Beyond" and Beyond. Solution Architects are on hand to help you with your coding problems, and running examples.
Tuesday - Rule Design Patterns in Production Systems
Rule Design Patterns
What is a “Rule Design Pattern”?
Basic Rule Formats
Fact Classification
Handling Failure to Match
Extending Rules
Reasoning with Interfaces
Active Facts
Marker Facts
Fact Proxies
Application Design Patterns
Short-Term Sessions
Permanent Sessions
12 years, 1 month
rules files character encoding and sprint patch
by Joachim Van der Auwera
Could one of the drools developers look at JBRULES-3633 and the pull
request in there?
It would help me a lot if this patch could be applied. Please let me
know if there is any problem with this patch, I will improve it as
needed. We have been using a patched version for a while here without
problems.
The issue allows users to specify the character encoding to be used to
read a rule file when setting up your knowledge base using spring
configuration.
Thanks,
Joachim
12 years, 1 month
DSL how to define recursive expression
by prashantmirajkar@gmail.com
A simple statement like
id of organization
with DSL rule
[keyword][]{attr:[A-Za-z0-9]+}\s+property\s+of\s+{obj:[A-Za-z0-9]+}={obj}.get{attr!ucfirst}()
works just fine with result organization.getId().
If I want to use statements like
id property of organization property of department
which should result in to department.getOrganization().getId().
OR
id property of organization property of department property of employee
which should result in to
employee.getDepartment().getOrganization().getId().
How do I achieve this?
cheers,
Prashant
--
View this message in context: http://drools.46999.n3.nabble.com/DSL-how-to-define-recursive-expression-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Decision Table Help
by qwertyqwerty
hi
I was wondering if I could get some help on how to achieve something using
an Excel based decision table to do the following:
I have an ArrayList of Objects.
The Object will contain: name, value, result
In my spreasheet i need to check to see if the value confroms to a
particular regex, and set the response in the <result> of my Object.
Each name will have a different regex applied to it.
Does anyone have any suggestions on the best way/steps to achieve this?
--
View this message in context: http://drools.46999.n3.nabble.com/Decision-Table-Help-tp4019281.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
java.lang.OutOfMemoryError: Java heap space
by vdelbart
Hello,
In my tests of the 4.0.3, I have some : java.lang.OutOfMemoryError.
So, I try a simple test with 10.000 sequential execution of 1 rule with no
context and just a workingmemorylogger and I have the error :
java.lang.OutOfMemoryError: Java heap space
My code is :
public class ExecReglesMemotyTest
{
private static final Reader DRL = new
InputStreamReader(ExecReglesMemotyTest.class
.getResourceAsStream("/rules/exemple.drl"));
private static final String FICHIER_LOG = "session";
/**
* @param args
*/
public static void main(String[] args)
{
try
{
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(DRL);
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(builder.getPackage());
for (int i = 0; i < 10000; i++)
{
StatefulSession session = ruleBase.newStatefulSession();
WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(session);
logger.setFileName(FICHIER_LOG);
session.fireAllRules();
logger.writeToDisk();
session.dispose();
}
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
with this rule (doesn't matter):
#created on: Fri Nov 09 15:48:45 CET 2007
package initPackage
#list any import classes here.
rule "ERG9"
when
then
end
I try this in 4.0.1, and it's working (no OutOfMemoryError)
What's the problem ?
thanks for any information,
V.
--
View this message in context: http://www.nabble.com/java.lang.OutOfMemoryError%3A-Java-heap-space-tf477...
Sent from the drools - user mailing list archive at Nabble.com.
12 years, 1 month
getting mismatched '==' error
by zeeshan
Hi !
Please find my attached Decision Table. I am getting following error...
log4j:WARN No appenders could be found for logger (com.sample.RuleRunner).
log4j:WARN Please initialize the log4j system properly.
Warning: Cell at E20 not present - adding a blank
Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 -
setting to empty
Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 -
setting to empty
Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 -
setting to empty
Exception in thread "main" org.drools.rule.InvalidRulePackage: [10,9]: [ERR
102] Line 10:9 mismatched input '==' in rule "Distribution Cost Rules_11"
[23,9]: [ERR 102] Line 23:9 mismatched input '==' in rule "Distribution Cost
Rules_12"
[36,9]: [ERR 102] Line 36:9 mismatched input '==' in rule "Distribution Cost
Rules_13"
[49,9]: [ERR 102] Line 49:9 mismatched input '==' in rule "Distribution Cost
Rules_14"
[62,9]: [ERR 102] Line 62:9 mismatched input '==' in rule "Distribution Cost
Rules_15"
[75,9]: [ERR 102] Line 75:9 mismatched input '==' in rule "Distribution Cost
Rules_16"
[88,9]: [ERR 102] Line 88:9 mismatched input '==' in rule "Distribution Cost
Rules_17"
[101,9]: [ERR 102] Line 101:9 mismatched input '==' in rule "Distribution
Cost Rules_18"
[114,9]: [ERR 102] Line 114:9 mismatched input '==' in rule "Distribution
Cost Rules_19"
[127,9]: [ERR 102] Line 127:9 mismatched input '==' in rule "Distribution
Cost Rules_20"
[140,9]: [ERR 102] Line 140:9 mismatched input '==' in rule "Distribution
Cost Rules_21"
[153,9]: [ERR 102] Line 153:9 mismatched input '==' in rule "Distribution
Cost Rules_22"
[166,9]: [ERR 102] Line 166:9 mismatched input '==' in rule "Distribution
Cost Rules_23"
[179,9]: [ERR 102] Line 179:9 mismatched input '==' in rule "Distribution
Cost Rules_24"
[192,9]: [ERR 102] Line 192:9 mismatched input '==' in rule "Distribution
Cost Rules_25"
[205,9]: [ERR 102] Line 205:9 mismatched input '==' in rule "Distribution
Cost Rules_26"
[218,9]: [ERR 102] Line 218:9 mismatched input '==' in rule "Distribution
Cost Rules_27"
[231,9]: [ERR 102] Line 231:9 mismatched input '==' in rule "Distribution
Cost Rules_28"
[244,9]: [ERR 102] Line 244:9 mismatched input '==' in rule "Distribution
Cost Rules_29"
[257,9]: [ERR 102] Line 257:9 mismatched input '==' in rule "Distribution
Cost Rules_30"
[270,9]: [ERR 102] Line 270:9 mismatched input '==' in rule "Distribution
Cost Rules_31"
[283,9]: [ERR 102] Line 283:9 mismatched input '==' in rule "Distribution
Cost Rules_32"
[296,9]: [ERR 102] Line 296:9 mismatched input '==' in rule "Distribution
Cost Rules_33"
[309,9]: [ERR 102] Line 309:9 mismatched input '==' in rule "Distribution
Cost Rules_34"
[0,0]: Parser returned a null Package
at org.drools.rule.Package.checkValidity(Package.java:471)
at
org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:481)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:436)
at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:443)
at com.sample.RuleRunner.loadRules(RuleRunner.java:70)
at com.sample.RuleRunner.runStatelessRules(RuleRunner.java:185)
at com.sample.RuleMain.main(RuleMain.java:132)
http://drools.46999.n3.nabble.com/file/n4017627/Distribution_Factor.xls
Distribution_Factor.xls
--
View this message in context: http://drools.46999.n3.nabble.com/getting-mismatched-error-tp4017627.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Re: [rules-users] [Drools Fusion] Accessing Events' time (read-only) with Drools in STREAM mode, REALTIME clock
by Davide Sottara
Stefano Bragaglia wrote
> Hi guys,
> I just realised that it is not possible to take advantage of the
> default time handling and access the timestamp value at the same time.
Agreed, one may want to write both qualitative ( A after B ) and
quantitative constraints ( A.time > x ) on an event. While this is possible
when the even timestamp is assigned externally, this is very hard to do with
the fusion-managed timestamp. Unfortunately, what you propose won't work,
since that particular configuration (setting a @timestamp field) would break
the assumption of immutable events.
We would need something like:
//operator-like, even better with implicit unification
Event( this happensAt $t ) // timestamp
Event( this lasts $d ) // duration
//accessor-like
Event( $t := happensAt, lasts > 100 )
Probably this needs to be taken to the dev channel or to the jira feature
requests
Best
Davide
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Fusion-Accessing-Events-time-rea...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month