Equal shift assignment based on employment form
by ns
Hi,
I would like to distribute shifts equally among employees based on their
employment form (full time or part time: 100%, 75%, 50%, ...). I have a
variable for each employee that holds the employment form. How do I make
sure all shifts get distributed equally, so that somebody that works 50% of
the time only gets half the shifts assigned than someone who works 100%.
And how do I make sure shifts that employee need to do are distributed
equally over time. So for example we have 20 shifts a month and 5 employees.
How do I make sure I get a plan like e1, e2, e3, e4, e5, e1, e2, e3, e4, e5,
... Instead of e1, e1, e1, e1, e1, e2, e2, e2, e2, e2. Thanks.
Kind regards,
Nick
--
View this message in context: http://drools.46999.n3.nabble.com/Equal-shift-assignment-based-on-employm...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months
Drools 5.5 Property Reactive on Maps
by gboro54
So I have an object with a map like follows:
protected ConcurrentMap<String, Double> accumulations = new
ConcurrentHashMap<String, Double>();
I wrote a convince method on the class that will look up the value in the
map and add to it if it exists and
if not there will put it in the map:
@Modifies({ "accumulations " })
public void addToAccumulation(String code, long volume) {
if (accumulations .containsKey(code)) {
Double value = accumulations .get(code) + volume;
accumulations .put(code, value);
} else {
accumulations .putIfAbsent(code, new Double(volume));
}
}
I have a rule to listen on the change of this filed on the object(i.e
accumulations["someCode"]!=null) but
when I modify the object the rule doesn't fire. I have added
@PropertyReactive to the Object and build the kbase as follows:
Properties props = new Properties();
props.setProperty("drools.dialect.java.compiler", "JANINO");
KnowledgeBuilderConfiguration config = KnowledgeBuilderFactory
.newKnowledgeBuilderConfiguration(props);
config.setOption(PropertySpecificOption.ALWAYS);
Any insight into why this may not work?
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-5-5-Property-Reactive-on-Maps-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months
How can I iterate through the ArrayList
by Govind J. Parashar
HI,
I have a AwaitingActionList Object which has a awaitingActionsList Object which has a ArrayList of AwaitingAction Objects. How can I iterate through the ArrayList to get to check each object AwaitingAction .value in the drl file.
Java refrence file attached
Thanks
Govind
MASTEK LTD.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 years, 2 months
iterate through the ArrayList
by Govind J. Parashar
Hi all
I have Class A which has a one attribute
private List<B> obj = new ArrayList<B>();
Class B which has a one attribute
Status
Value
How can I iterate through the ArrayList (i.e obj) to get to check each object B . Status=='True' the set Value=true in the drl file.
Thanks
Govind
MASTEK LTD.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 years, 2 months
How to use type-safe enums in rule condition
by droolster
Hello,
I would like to use type-safe enums in my rules. At the moment I have
situation like this:
public class Country {
private String name;
// getter/setters
}
rule "Country"
when
Country ( name == "USA" )
then
DO SOMETHING
end
I would like to have something like this:
public enum Country {
USA ()
// list of all countries in the world
}
and in the rule I would like to do this:
rule "Country"
when
Country ( name == Country.USA )
then
DO SOMETHING
end
Is that possible?
Thanks in advance for your help.
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-use-type-safe-enums-in-rule-cond...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months
Problem in writing rule and apply DSL
by braveheart85
Hello guys,
I really need your help.
I'm writing a DSL file in order to allow my application user to write their
simple rules.
I have queries of this typology:
$a: Data( )
$b: Year( ) from $a.years
$c: Person( ) from $b.persons
dsl mapping (inline version):
there are persons=$a: Data( ) $b: Year( ) from $a.years $c: Person( ) from
$b.persons
now if i would add attribute to person i can't, for example to get persons
over 18 years old.
If i write:
there are persons
- age more than 18
drools engine try to add attribute to Data object, probably because it is
first object in line.
To resolve this problem i should write query something like:
$c: Person( ) from ( Year( ).persons from Data( ).years )
In this way i can add attribute to Person instead of Data. Unfortunatly i
don't know how can i get it.
Someone can help me please.
Best Regards
--
View this message in context: http://drools.46999.n3.nabble.com/Problem-in-writing-rule-and-apply-DSL-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months
"distinct" operator in a query
by braveheart85
Hello guys,
I make a very simple question, especially for a curiosity.
I have this query:
query "QuerySelected"
$result: Person( identifierCode == "ABCDEF12H45S100A" )
$y: YearData( id == $result.identifierCode )
exists Vehicle( ) from $y.vehicles
end
With this query i get two equal person results because there are two annual
that matches with condition.
There is a simple way in drools to apply "distinct" operator or avoid this
behaviour.
Best regards
Andrea
--
View this message in context: http://drools.46999.n3.nabble.com/distinct-operator-in-a-query-tp4026762....
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months
Out of Mem and thousand threads : Disabling JIT ?
by Raphael Jolivet
Hi,
I am using Drools for some time an I recently increased the number of rules
and their complexity.
I have now about 200 rules, for 700 x 200 facts (rules on a cartesian
product on them).
Since then, the computation of rules explodes with the following exception :
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.$$YJP$$start0(Native Method) [na:1.6.0_30]
at java.lang.Thread.start0(Thread.java) [na:1.6.0_30]
at java.lang.Thread.start(Thread.java:640) [na:1.6.0_30]
at
java.util.concurrent.ThreadPoolExecutor.addIfUnderMaximumPoolSize(ThreadPoolExecutor.java:727)
~[na:1.6.0_30]
at
java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:657)
~[na:1.6.0_30]
at
org.drools.rule.constraint.MvelConstraint.jitEvaluator(MvelConstraint.java:232)
~[org-drools-drools-core-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:197)
~[org-drools-drools-core-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:157)
~[org-drools-drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
~[org-drools-drools-core-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
~[org-drools-drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
~[org-drools-drools-core-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
~[org-drools-drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
~[org-drools-drools-core-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
~[org-drools-drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
~[org-drools-drools-core-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
~[org-drools-drools-core-5.5.0.Final.jar:5.5.0.Final]
...
After Googling a bit, I saw that this is due to JIT compilation of my rules.
For some reason, each one seem to create a Thread and ends up with
thousands of them.
First of all, I find a bit risky that the JIT compilation is fired by
some *hardcoded
*threshold :
I was not expecting such a technical tricky optimization to randomly
activate depending of my data.
Anyway, I wanted to disable this JIT thing.
I saw that the disabling is only available since *5.5.0.-final* right ?
I have switched to that version but I can't seem to be able to disable it.
I have tried both :
*-Dmvel2.disable.jit=true* (which would not be a viable solution for
production anyway : We can't rely on some settings of the server to ensure
things work)
And also this :
*OptimizerFactory.setDefaultOptimizer("reflective"); *(found
here<http://mvel.codehaus.org/Disabling+the+JIT+Compiler>
)
Any help would be appreciated.
Brgds,
Raphael
12 years, 2 months