Is OptaPlanner the right tool for the job?
by Andrzej Raczkowski
Hello all OptaPlanner geeks! :)
This is my first post on this list. I would be very grateful if somebody
could give me any advice in this matter (details below).
We need to plan the schedule for repair units consisting of few people with
some particular skills and equipment.
What we know / What the Client has:
1. tasks - different tasks have different attributes like:
a) priority
b) time needed to fix a problem
c) number of employees needed
d) employees' skills
i) destination coordinates of the task to perform (we can use GIS to get
road costs)
2. established number of employees working according to work schedule and
having particular skills
3. established number of vehicles and equipment
What we want - to be able to plan tasks with the assumption that a good
schedule:
1. will 'keep in mind' all limitations (number of employees and equipment)
2. will plan all tasks in the shortest possible amount of time.
We want to optimize time that it takes to perform all tasks, and time would
be the only flexible feature here.
Is OptaPlanner the right tool to this kind of problems?
Thank you and have a nice day
Andrzej
11 years, 9 months
User Security with guvnor 5.4 and Tomcat 6.0.36
by thecaptn
Hi,
I have searched extensively for any answers, but have obviously not been
looking in the right places.
Tomcat is my app server: it should define the users. This is no problem:
since it is a small application we want to define our users in
tomcat-users.xml, using the UserDatabaseRealm (in preference to
MemoryRealm). JAAS or other options are overkill for us.
Now, what should I do on the guvnor side? I understand I should be looking
at the WEB-INF/beans.xml config file. I can't find much documentation on the
contents of this file in general, and nothing specific that seems to help
me. A lot of the advice out there seems JBoss AS specific or precedes the
move in 5.4 to beans.xml.
But, I understand that tomcat in this setting is not supplying a JAAS
context, which seemed to be the most likely option.
Do I need to implement a version of
org.drools.guvnor.server.security.DemoAuthenticator?
Is that our only option?
Hasn't someone done this before?
What would you do in this situation?
Any assistance would be greatly appreciated.
Thanks, Pete
--
View this message in context: http://drools.46999.n3.nabble.com/User-Security-with-guvnor-5-4-and-Tomca...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
Spring 4.0 & Drools 6.0.1 Integration issue
by kmansoor
Hi All- I'm trying to use Drools in a Spring 4 applications. Trying to inject
a StatelessSession in a Spring bean:
@Service
public class RulesServiceImpl implements RulesService {
@Inject()
private StatelessKieSession kStatelessSession;
...
}
This results in:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [org.kie.api.runtime.StatelessKieSession] found
for dependency: expected at least 1 bean which qualifies as autowire
candidate for this dependency. Dependency annotations:
{(a)javax.inject.Inject()}
pom.xml is as follows:
<kie.version>6.0.1.Final</kie.version>
<drools.version>6.0.1.Final</drools.version>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${kie.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
<version>${kie.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-spring</artifactId>
<version>${kie.version}</version>
</dependency>
and applicationContext.xml:
<kie:kmodule id="kmodule1">
<kie:kbase name="kbase1" packages="rules">
<kie:ksession name="ksession1" type="stateless" />
</kie:kbase>
</kie:kmodule>
<bean id="kiePostProcessor"
class="org.kie.spring.KModuleBeanFactoryPostProcessor" />
I also tried the other route:
@PostConstruct
public void setUp() {
KieServices kieServices = KieServices.Factory.get();
KieContainer kContainer = kieServices.getKieClasspathContainer();
kStatelessSession = kContainer.newStatelessKieSession("ksession1");
}
This results in NullPointerException:
Caused by: java.lang.NullPointerException
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.newStatelessKieSession(KieContainerImpl.java:444)
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.newStatelessKieSession(KieContainerImpl.java:435)
at
ca.utoronto.med.dc.webcv.service.RulesServiceImpl.setUp(RulesServiceImpl.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:349)
at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:300)
at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
... 23 more
I do see the following in the console:
2014-02-10 20:05:06,263 DEBUG
org.drools.compiler.kie.builder.impl.ClasspathKieProject.getPomProperties(210):
- Found and used pom.properties
\work\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dcwebcv\META-INF\maven\ca.utoronto.med.dc\dcwebcv\pom.properties
releaseId == ca.utoronto.med.dc:dcwebcv:1.0-SNAPSHOT
2014-02-10 20:05:06,407 INFO
org.drools.compiler.kie.builder.impl.KieRepositoryImpl.addKieModule(72): -
KieModule was added:FileKieModule[
ReleaseId=ca.utoronto.med.dc:dcwebcv:1.0-SNAPSHOTfile=\work\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dcwebcv\WEB-INF\classes]
Any pointer will be highly appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/Spring-4-0-Drools-6-0-1-Integration-iss...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
[MVEL BUG] MVEL Parsing error
by alexandrebhr
Hi,
I found a MVEL bug :
When I want to compile a specific expression with MVEL, a
NullPointerException is thrown.
Test Case (Java Language) :
String expression = "5 + 1/10 * (VAR - 5)";
MVEL.compileExpression(expression);
When I launch this test, I get an error :
java.lang.NullPointerException
at
org.mvel2.MVELInterpretedRuntime.parse(MVELInterpretedRuntime.java:47)
at org.mvel2.MVEL.eval(MVEL.java:408)
at org.mvel2.ast.Substatement.getReducedValue(Substatement.java:48)
at
org.mvel2.compiler.AbstractParser.arithmeticFunctionReduction(AbstractParser.java:2479)
at
org.mvel2.compiler.ExpressionCompiler.compileReduce(ExpressionCompiler.java:318)
at
org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:172)
at
org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62)
at org.mvel2.MVEL.compileExpression(MVEL.java:810)
at org.mvel2.MVEL.compileExpression(MVEL.java:820)
at org.mvel2.MVEL.compileExpression(MVEL.java:723)
...
I get this error in rare case with this syntax but with different one, it
works.
Expressions which work :
5 + 1+10 * (VAR - 5)
5 + 1-10 * (VAR - 5)
5 + (1/10) * (VAR - 5)
5 + (VAR - 5) * 1/10
Expressions which not work :
5 + 1/10 * (VAR - 5)
5 + 1*10 * (VAR - 5)
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/MVEL-BUG-MVEL-Parsing-error-tp4028939.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
Embedded sub-process in drools rule flow
by Sanjay Mj
Hi all,
Can anyone please tell me whether it is possible to design nested blocks in
rule flow. I know that using sub-process, we can embed different rule
tasks, but my rule flow file is getting bulkier by the day and I wanted to
know if i can have a few rules in a sub-process, but the rule tasks
executed by the sub-process should not be visible in the uppermost layer.
DOuble clicking on that should take me inside the sub-process and show the
rules executed by it. Also if it is not possible to have such an operation
with the build in blocks in drools rule flow, can anyone tell me how i can
have a custom made block which has that functionality. I have designed
custom blocks having simple properties, but i have no idea how this should
be done. Hope to get an answer here.
Regards sanjay
11 years, 9 months
Getting started
by vvicky72
I am a newbie to both Drools and Maven. I was asked to research how we can
build brms using drools. This is what I am trying
1) Setup a guided decision table using drools workbench.
This worked without much issues. I deployed the project ( pnd-1.1.pom
<http://drools.46999.n3.nabble.com/file/n4028927/pnd-1.1.pom> )pom.xml
attached.
2) Setup a drools project in ecplise to execute the rule. To do this
a) I installed the Maven plugin in eclipse.
b) I copied the pom.xml create above to my drools project (Not sure if this
was the right thing to do).
c) I then ran Maven install using eclipse. That got the jar file pnd-1.1.jar
(kie wb project created using workbench).
d) I copied the following code to execute the rules
<http://drools.46999.n3.nabble.com/file/n4028927/DroolsTestClient.jpg>
*My first problem was that it would not find the bean (Data Model) that is
in the pnd-1.1.jar.* For the sake of moving forward, I recreated that class
in my drools project on eclipse.
This is how my project looks.
<http://drools.46999.n3.nabble.com/file/n4028927/Droolsproject.jpg>
*Now when I run it I get the error java.lang.RuntimeException: Cannot find
KieModule: com.yrc.ops:pnd:1.1*
I am obviously missing something. But after reading several posts and
tutorials I am still unable to solve it. Please shed some light and help me
out.
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Getting-started-tp4028927.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
Not able to detect how to correct ERR 102
by ankit3j
Below is a sample DSLR code I am trying out. Now I am getting error in "when"
block. After hours of trying to search for a solution I have not yet been
able to detect the error.
package com.sample
import com.sample.*;
//expander sample.dsl
rule "hello rule"
when
There is a "$customer" with first name "David" // This is
where the error is
then
Greet Customer
end
[ERR 102] Mismatched input "is" in rule "hello rule"
Any idea whats wrong with this line??
--
View this message in context: http://drools.46999.n3.nabble.com/Not-able-to-detect-how-to-correct-ERR-1...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
Performance of rules in Drools
by Seb Geek
Hello,
I have a list of very similar rules executed in Drools and some performance
problems appear ... I want some advices to choose between two "direction"
in order to correct them ...
First the context :
I have to execute always the same check but with different level or
"parameters".
For example,
- in the first demand (rule for our client) i have to count and retrieve
the list all Article that have a family code equals to 'A', 'B' or 'C' and
execute the then clause only if there is 3 elements in the filtered list.
- in the second demand (rule for our client) i have to count and retrieve
the list all Article that have a family code equals to 'B' or 'C' and
execute the then clause only if there is 4 elements in the filtered list
and so on ...
The number of different group of parameter values and the values of theses
parameters will change over time ...
The question is : is it more efficient to implement a lot of different
rules, each with their parameter in the code OR is it more efficient to
implement only one rule with an additional object as a drools fact
containing different parameter's values ?
Thanks for your help
Sébastien
11 years, 9 months