Planner: What is a good example/algo to chain entities?
by Michiel Vermandel
Hi,
I need to keep some Planning entities (Tasks) together and I am looking for some insights/ideas/examples in how to tackle this.
Tasks are grouped by a groupId (Groups are problem facts).
The Tasks do not have to be grouped like a pillar but more like an accordion.
One of the planning variables is "Period", a Period typically is 3 weeks and we have 12 Periods to plan the tasks into.
The requirement is that all tasks within a group need to be kept together in such a way that:
- the spread (nr of periods) of the tasks is minimal
- the spread is never more than the sum of the duration of the separate tasks in the group.
So given a group of 3 tasks:
1)This is good:
Period 12345789ABC
T1: xxx
T2: xx
T3: x
2)This is better:
Period 12345789ABC
T1: xxx
T2: xx
T3: x
3)This is (one of) the best:
Period 12345789ABC
T1: xxx
T2: xx
T3: x
4)This is bad:
Period 12345789ABC
T1: xxx
T2: xx
T3: x
Of course 3 is favorite, but maybe not possible due to other planning variables (-> availability of people to execute the tasks).
I need to plan a few hundred of such groups of tasks which all share the same Period space and list of available people.
(A person can only do one task per period)
I have got the DRL rule that keeps the tasks together (rule counts the gaps) , but giving penalty for making gaps (by shifting a single task) makes it hard to find a good solution.
What would be the best approach to solve this problem?
- A combination of custom mover and swapper which moves/swaps groups instead of single tasks?
- The above in combination with a group shuffle factory (swapping tasks in a single group)?
Other ideas?
Thanks a lot!
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
13 years, 1 month
DSL Bug?
by rjr201
I've had the following problem when creating a DSL. Not sure if it's a bug,
but it confused me for a good 40 minutes so thought I'd mention it here in
case others have the same problem..
If I create a DSL like this:
[when]There is a fact {fact_name}{fact_label}={fact_label}:{fact_name}()
And create a rule in the guided editor that has Object as the {fact_name}
and $obj as the {fact_label} I get:
1. | rule "rule"
2. | dialect "mvel"
3. | when
4. | Object$obj:()
5. | then
6. | end
as the source.
At first I thought it was to do with putting quotation marks around the
{}'s. But I've since found that if I put a space between {fact_name} and
{fact_label} I get the expected result of:
1. | rule "rule"
2. | dialect "mvel"
3. | when
4. | $obj:Object()
5. | then
6. | end
Again, sorry if this is down to my limited understanding of DSLs. Any
further insights into why this happens or any other quirks of DSLs would be
greatly appreciated as I'm going to be spending a lot of time with them in
the not too distant future..
Rich.
--
View this message in context: http://drools.46999.n3.nabble.com/DSL-Bug-tp4022209.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
DroolsServiceImplementation - from examples
by MaverickDrools
Hi,
Trying to run the startServers() test at:
https://github.com/droolsjbpm/guvnor/blob/5.5.x/guvnor-webapp-drools/src/...
which gives me an exception:
java.lang.NoClassDefFoundError:
Lorg/drools/guvnor/server/DroolsServiceImplementation;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredFields(Class.java:1743)
at org.junit.runners.model.TestClass.<init>(TestClass.java:40)
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:65)
at
org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:59)
at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:50)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at
org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at
org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException:
org.drools.guvnor.server.DroolsServiceImplementation
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 25 more
I'm guessing I need to add a dependency in the pom file to get the
implementation of this class.
org.drools / guvnor-webapp-drools / 5.5.0.Beta1 is a WAR artifact and so
org.drools.guvnor.server.DroolsServiceImplementation resides within a WAR
file. How can I make it accessible to the JUnit that I'm trying to execute?
Thanks,
Aseem
--
View this message in context: http://drools.46999.n3.nabble.com/DroolsServiceImplementation-from-exampl...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Guvnor Calendar problem
by Anton Nikulin
Hi
I have such problem. I use Guvnor as a storage for rules, and now i want to
add calendars declaration to some rule. I've done this and in my sources of
these rules i can see:
rule "CalendarTest"
calendars "AUD Home Loans"
no-loop true
dialect "mvel"
when
then
System.out.println("CALENDAR IS WORKING!!!");
end
In my application I use KnowledgeAgent and such configuration to use rules
from Guvnor:
KnowledgeBuilder builder = KnowledgeBuilderFactory
.newKnowledgeBuilder();
builder.add(ResourceFactory.newClassPathResource("ChangeSet.xml"),
ResourceType.CHANGE_SET);
if (builder.hasErrors()) {
throw new RuntimeException(builder.getErrors().toString());
} // creating KnowledgeBase and Session
KnowledgeBase base = KnowledgeBaseFactory.newKnowledgeBase();
base.addKnowledgePackages(builder.getKnowledgePackages());
StatefulKnowledgeSession session =
base.newStatefulKnowledgeSession();
my ChangeSet.xml looks like this:
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/...'
>
<add>
<resource source='
http://localhost:8083/drools-guvnor/rest/packages/magick-model/source'
type='DRL' basicAuthentication="enabled" username="admin" password="admin"/>
</add>
</change-set>
But the problem is when i invoke fureRules this rule with calendars clause
also invokes, even if i don't set any calendar objects to session.
Can you help me what the problem is?
And if i just use local drl file, everything works fine
Thanks, Anton
13 years, 1 month
Uploading JAR using REST
by rjr201
Hi,
I've successfully uploaded a JAR file using the rest api. I can see it under
the model tab of a package in Guvnor. However, when I go to create a rule
using the Guided Editor it tells me that no model has been uploaded.
Does anyone have any ideas why this happens and how to go about solving it?
As always, thanks for any help in advance.
Rich.
--
View this message in context: http://drools.46999.n3.nabble.com/Uploading-JAR-using-REST-tp4022115.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month