[Planner][DRL] Changable problem facts?
by mSkiba
Hello!
I am working on task scheduling system. My system works fine, but I want to
make it faster. For my current problem we can assume that my domain consists
of:
* Worker (int id, List<TimePeriod> workingHours)
* TaskAssignment (int id, List<TimePeriod> possibleExecutionTime, Duration
leadTime, Worker worker)
I am trying to assing each Task Assignment to 1 worker. It's obvious. All I
need to do is to make my rules computing faster. For example I have a rule:
rule "ASSIGN_OUT_OF_WORKING_TIME"
when
$w : Worker($id : id != 0, $wh : workingHours)
$ta : TaskAssignment(worker != null, worker.id == $id)
not TimePeriod( isBetweenInclusive($ta.getTimeSlot()),
isBetweenInclusive($ta.getEndTimeSlot()) ) from $wh
then
insertLogical(new IntConstraintOccurrence("ASSIGN_OUT_OF_WORKING_TIME",
ConstraintType.NEGATIVE_HARD,
100, $w ));
end
This rule checks if every TaskAssignment assigned to a Worker lies in the
worker's working hours. The problem is that score calculator is trying to
pair given Worker with every TaskAssignment. So I have to make set of
TaskAssignment as small as possible. I can acquire that by storing in a
Worker any kind of Set including all assigned TaskAssignments. After this my
domain should looks like this:
* Worker (int id, List<TimePeriod> workingHours, Set<TaskAssignment>
cashedTaskAssignments)
* TaskAssignment (int id, List<TimePeriod> possibleExecutionTime, Duration
leadTime, Worker worker)
and my rule:
rule "ASSIGN_OUT_OF_WORKING_TIME"
when
$w : Worker($id : id != 0, $wh : workingHours, *$cta :
cachedTaskAssignments*)
$ta : TaskAssignment() *from $cta*
not TimePeriod( isBetweenInclusive($ta.getTimeSlot()),
isBetweenInclusive($ta.getEndTimeSlot()) ) from $wh
then
insertLogical(new IntConstraintOccurrence("ASSIGN_OUT_OF_WORKING_TIME",
ConstraintType.NEGATIVE_HARD,
ASSIGN_OUT_OF_WORKING_TIME, $w ));
end
My cloneSolution() method is cloning everything right (deep clone of every
TaskAssignment and Worker). I've checked it via many tests. Anyways I'm
getting:
*Score corruption: the workingScore (-1800hard/0soft) is not the
uncorruptedScore (-1904hard/0soft):*
or similar error.
To sum up:
* my system works fine without any changes in Worker class
* I want to make it faster by caching assigned TaskAssignments in a Worker
objects
* I'm getting 'Score corruption' error
Is my idea possible to play out?
--
View this message in context: http://drools.46999.n3.nabble.com/Planner-DRL-Changable-problem-facts-tp4...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 4 months
Guvnor Integration with Eclipse Issue !!
by abhinay_agarwal
hey der !
m currently using GUVNOR v5.3.0
i made some DRLs in my Eclipse loaded them to Guvnor repository and after
loads of changes..i was finally able to build my kbase using the repositoy..
my change set is as foolows :
*<?xml version="1.0" encoding="UTF-8"?>
<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:8089/drools-guvnor/org.drools.guvnor.Guvnor/package/Indi...'
type='DRL' />
</add>
</change-set>*
My package name was Individual and it mainly contained technical rule
assests and one function, as shown in the image below :
http://drools.46999.n3.nabble.com/file/n4018919/drools1.png
now i had a few changes in my POJO model so i updated the model and few
rules directly in the technical rule assest of guvnor, after which i built
the package created a new snapshot and tried running it, but got some error,
as :
1. Unable to Analyse Expression @Modify with($a){setExempt("Exempt
Account"),setQueueName("Auto Classified Accounts")};
2. KnowledgeAgent exception while trying to deserialize
KnowledgeDefinitionsPackage
After going through all the available post, nothing proved to be of any help
!!
Then i thought might be changing the "technical assest" directly from guvnor
is a bad idea...
So, i created a new package named "Individual_New", uploaded the new POJO
model and uploaded just one rule from ECLIPSE(just to check if my kbase
builds or not)..
I uploaded just 1 rule in it, build the package and created a snapshot with
name LATEST, changed the change set as below:
*<?xml version="1.0" encoding="UTF-8"?>
<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:8089/drools-guvnor/org.drools.guvnor.Guvnor/package/Indi...'
type='DRL' />
</add>
</change-set>*
n now when i tried running it, it threw me the following error :
java.lang.RuntimeException: java.io.IOException: Server returned HTTP
response code: 500 for URL:
http://localhost:8089/drools-guvnor/org.drools.guvnor.Guvnor/package/Indi...
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:592)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:701)
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:679)
at
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:979)
at
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:774)
at
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:646)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:192)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:174)
at
com.infy.fcs.drools.DroolsAdapter.readKnowledgeBase(DroolsAdapter.java:241)
at com.infy.fcs.drools.DroolsAdapter.main(DroolsAdapter.java:256)
Caused by: java.io.IOException: Server returned HTTP response code: 500 for
URL:
http://localhost:8089/drools-guvnor/org.drools.guvnor.Guvnor/package/Indi...
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
at org.drools.io.impl.UrlResource.grabStream(UrlResource.java:210)
at org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:146)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:311)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:495)
... 10 more
DEBUG [main] (DroolsAdapter.java:246) - java.io.IOException: Server returned
HTTP response code: 500 for URL:
http://localhost:8089/drools-guvnor/org.drools.guvnor.Guvnor/package/Indi...
java.lang.RuntimeException: java.io.IOException: Server returned HTTP
response code: 500 for URL:
http://localhost:8089/drools-guvnor/org.drools.guvnor.Guvnor/package/Indi...
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:592)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:701)
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:679)
at
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:979)
at
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:774)
at
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:646)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:192)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:174)
at
com.infy.fcs.drools.DroolsAdapter.readKnowledgeBase(DroolsAdapter.java:241)
at com.infy.fcs.drools.DroolsAdapter.main(DroolsAdapter.java:256)
Caused by: java.io.IOException: Server returned HTTP response code: 500 for
URL:
http://localhost:8089/drools-guvnor/org.drools.guvnor.Guvnor/package/Indi...
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
at org.drools.io.impl.UrlResource.grabStream(UrlResource.java:210)
at org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:146)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:311)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:495)
... 10 more
Any help would be appreciated !!
Thanks,
Abhinay
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-Integration-with-Eclipse-Issue-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 4 months
Guvnor 5.4.0.Final and JBoss AS 7.1.1.Final
by Michael Anstis
Hi,
There have been a few messages recently suggesting there are problems
running Guvnor 5.4.0.Final on JBoss AS 7.1.1.Final.
I had a check and this is what I found:-
1) Downloaded guvnor-5.4.0-Final.zip from Drools website
2) Unzip
3) Deploy guvnor-5.4.0.Final-jboss-as-7.0.war to JBoss AS 7.1.1.Final
"Brontes"
4) Browsed to http://localhost:8080/guvnor-5.4.0.Final-jboss-as-7.0
5) Success.
The only WELD error I encountered was when trying to simultaneously deploy
5.4.0-Final and 5.5.0-SNAPSHOT side-by-side (any two enabled and running
instances would cause the same problem).
Whichever was deployed (and enabled second) barfed with:-
11:11:21,066 ERROR [org.drools.guvnor.server.RepositoryServiceServlet]
(http--127.0.0.1-8080-5) Service method 'public abstract
org.drools.guvnor.client.rpc.Module[]
org.drools.guvnor.client.rpc.ModuleService.listModules()' threw an
unexpected exception: org.jboss.weld.exceptions.WeldException: WELD-000049
Unable to invoke [method] @PostConstruct public
org.drools.guvnor.server.repository.RulesRepositoryManager.createRulesRepository()
on org.drools.guvnor.server.repository.RulesRepositoryManager@d2b7d8:
org.jboss.weld.exceptions.WeldException: WELD-000049 Unable to invoke
[method] @PostConstruct public
org.drools.guvnor.server.repository.RulesRepositoryManager.createRulesRepository()
on org.drools.guvnor.server.repository.RulesRepositoryManager@d2b7d8
at
org.jboss.weld.bean.AbstractClassBean.defaultPostConstruct(AbstractClassBean.java:518)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.postConstruct(ManagedBean.java:174)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:291)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:616)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.bean.AbstractReceiverBean.getReceiver(AbstractReceiverBean.java:73)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.bean.ProducerMethod$1.produce(ProducerMethod.java:131)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:299)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:61)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:616)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:681)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:118)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:703)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:712)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:161)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:157)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:131)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:153)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:290)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.drools.guvnor.server.RepositoryModuleService$Proxy$_$$_WeldClientProxy.listModules(RepositoryModuleService$Proxy$_$$_WeldClientProxy.java)
[guvnor-webapp-core-5.4.0.Final.jar:5.4.0.Final]
at
org.drools.guvnor.server.RepositoryServiceServlet.listModules(RepositoryServiceServlet.java:171)
[guvnor-webapp-core-5.4.0.Final.jar:5.4.0.Final]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[rt.jar:1.6.0_23]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[rt.jar:1.6.0_23]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[rt.jar:1.6.0_23]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_23]
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
[gwt-user-2.3.0.jar:]
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
[gwt-user-2.3.0.jar:]
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
[gwt-user-2.3.0.jar:]
at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
[gwt-user-2.3.0.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
[jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.13.Final.jar:]
at
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.13.Final.jar:]
at
org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
[solder-impl-3.1.1.Final.jar:3.1.1.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.13.Final.jar:]
at
org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
[solder-impl-3.1.1.Final.jar:3.1.1.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[jbossweb-7.0.13.Final.jar:]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
[jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
[jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_23]
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[rt.jar:1.6.0_23]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[rt.jar:1.6.0_23]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[rt.jar:1.6.0_23]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_23]
at
org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.introspector.jlr.WeldMethodImpl.invoke(WeldMethodImpl.java:174)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.jboss.weld.bean.AbstractClassBean.defaultPostConstruct(AbstractClassBean.java:516)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
... 56 more
This was caused by the prior running instance creating JCR's "repository"
folder and "repository.xml" configuration file in the same place as
required by the second installation.
The error was simply remedied by ensuring I only had one instance of Guvnor
enabled and running at a time.
With kind regards,
Mike
12 years, 4 months