Re: [rules-users] Planner 5.3.0 Final - Issue with Local Search / Move

2012-04-19 Thread duggal
>> 1. While looking at the solution created at the end of the local search 
>> phase AND comparing to the moves output in the log file. I see that there 
>> are several instances where the log file shows a move BUT the output 
>> solution has the entity still on the previous planning variable. 
>> This is happening only towards the end of the phase (about last 8 steps)
>> of 
>> the time terminated phase. 
>This sounds like a genuine bug. 
>Could you copy paste some logging output to show the issue more clearly? 
>Can you check if 5.4.0.CR1 still has the issue and create a jira: 
>   https://issues.jboss.org/browse/JBRULES
I have upgraded to 5.4.0CR1 (both planner and drools) and tried both the
generic change move and my custom implementation.
I still have instances where the log (DEBUG) shows tasks moved to new
resources, but the final (best) solution shows the task still on a previous
resource.
Before I create a JIRA for this, I want to show you a sample log output
describing the issue -
To read the planning entity string below: [ 
  ]
where :
[ ]
and :
[ ]

2012-04-20 08:28:05,411 [main] DEBUG DefaultGreedyFitSolverPhase  - Step
index (816), time spend (36875), score (-110hard/32200soft), initialized
planning entity ([817 [49 W502] [19664 TASK817] 19Mar12.03:00 19Mar12.05:00
]).
...
2012-04-20 08:28:12,005 [main] INFO  DefaultGreedyFitSolverPhase  - Phase
constructionHeuristic ended: step total (974), time spend (43469), best
score (-183hard/38700soft)
2012-04-20 08:28:12,536 [main] DEBUG DefaultLocalSearchSolverPhase  -
Step index (0), time spend (44000), score (-183hard/38700soft), best
score (-183hard/38700soft), accepted move size (800) for picked step ([817
[49 W502] [19664 TASK817] 19Mar12.03:00 19Mar12.05:00 ] => [102 W140]).
...
2012-04-20 08:30:01,974 [main] DEBUG DefaultLocalSearchSolverPhase  -
Step index (566), time spend (153438), score (-175hard/39900soft), best
score (-175hard/39900soft), accepted move size (800) for picked step ([817
[102 W140] [19664 TASK817] 19Mar12.03:00 19Mar12.05:00 ] => [94 W132])
...
2012-04-20 08:30:15,880 [main] DEBUG DefaultLocalSearchSolverPhase  -
Step index (637), time spend (167344), score (-175hard/39900soft), best
score (-175hard/39900soft), accepted move size (800) for picked step ([817
[94 W132] [19664 TASK817] 19Mar12.03:00 19Mar12.05:00 ] => [481 608]).
...

You can see that task817 was assigned to resource W502 by the construction
heuristic. Local search (Tabu) then moved this to resource W140, next to
W132 and finally to 608.
When I read the best solution obtained at the end of the local search (time
terminated), then TASK817 is showing as assigned to W140. 
What is strange is that the log file shows a successful move W140-->W132 and
ALSO W132-->608. Why did W132-->608 succeed if the task was still left on
W140?

>> However the final output 
>> shows the constraint still EXISTS between the two entities (even though
>> the 
>> overlap is no longer present). As a result even though the constraints
>> are 
>> actually removed, the score is NOT going down as the planner constraints 
>> still exist. 
>> The rule used by me is as follows (Allocation is the planning entity and
>> ...
>Smells like a memory corruption in drools-core. There is one fixed for 
>5.4.0.CR1, so 
>First turn on TRACE and see what it outputs.   
>Then upgrade to knowledge-api, drools-core and drools-compiler 5.4.0.CR1. 
On upgrading to 5.4.0CR1, I am facing a new issue in determining which
constraints are broken and hence unable to verify if my original issue is
fixed.
I am using the Drools Score Director and use the GUI hack to determine the
list of constraints met during solving. However the iterator returned is
empty even though I know that a lot of rules are met -
(Iterator) workingMemory.iterateObjects(new
ClassObjectFilter(ConstraintOccurrence.class));
Note that the workingMemory instance is not null, just the iterator returned
has no entries.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Planner-5-3-0-Final-Issue-with-Local-Search-Move-tp3913541p3925199.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] cdi support

2012-04-19 Thread Mark Proctor
On 17/04/2012 11:29, Kelly Goedert wrote:
> Hi,
>
> I asked this same question on seam forum and they told me to ask
> here... does drools support cdi?
not yet.

mark
>
> Thanks
>
> Kelly
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Remote debug as Drools App on Eclipse

2012-04-19 Thread rogelio_sevilla1

Good day everyone, sorry if this is a basic question. 

I'm using eclipse and I know that you can debug an App as a Drools
application to be able to debug the .drl contents. I have always used this
feature on apps that reside on my local machine.

I have also used the "Debug as a Remote Java Application" feature within
eclipse, however, I honestly don't know how to Debug a Remote App as a
Drools  Application;  is it possible??


Thanks a lot in advance for your time.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Remote-debug-as-Drools-App-on-Eclipse-tp3924515p3924515.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Exception when building a template

2012-04-19 Thread Sean Su
Apparently, the value of the column (name) must be one word. In the case I
have, "Lower Range" is not valid.

value Lower Range is not a valid column definition.

Question for the Guvnor development team: is there any other place we can
set the column name as "natural language"? Or this is bug?

Sean

On Thu, Apr 19, 2012 at 3:31 PM, Sean Su  wrote:

> I am using 5.4.0.CR1 to build a template (decision table) but regardless
> what I do, I will get this exception from the first column.
>
> Are we aware of any known issues in this build? Or the way I am using the
> tool is wrong? I can provide the repository if it helps.
>
> Thanks
>
> Sean
>
> ERROR 19-04 15:25:31,518 (LoggingHelper.java:error:74)  Unable to
> build asset.
> java.lang.IllegalArgumentException: value Lower Range is not a valid
> column definition
> at
> org.drools.template.parser.ColumnFactory.getColumn(ColumnFactory.java:34)
> at
> org.drools.template.parser.DefaultTemplateContainer.parseTemplate(DefaultTemplateContainer.java:93)
> at
> org.drools.template.parser.DefaultTemplateContainer.(DefaultTemplateContainer.java:47)
> at
> org.drools.template.DataProviderCompiler.compile(DataProviderCompiler.java:56)
> at
> org.drools.guvnor.server.util.BRDRTPersistence.marshal(BRDRTPersistence.java:57)
> at
> org.drools.guvnor.server.contenthandler.drools.BRLContentHandler.getSourceDRL(BRLContentHandler.java:84)
> at
> org.drools.guvnor.server.contenthandler.drools.BRLContentHandler.compile(BRLContentHandler.java:61)
> at
> org.drools.guvnor.server.builder.PackageAssemblerBase.compile(PackageAssemblerBase.java:88)
> at
> org.drools.guvnor.server.builder.PackageAssemblerBase.buildAsset(PackageAssemblerBase.java:72)
> at
> org.drools.guvnor.server.builder.AssetItemValidator$BuilderValidator.validate(AssetItemValidator.java:57)
> at
> org.drools.guvnor.server.builder.AssetItemValidator.validate(AssetItemValidator.java:44)
> at
> org.drools.guvnor.server.RepositoryAssetOperations.validateAsset(RepositoryAssetOperations.java:142)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:44)
> at
> org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
> at
> org.drools.guvnor.server.RepositoryAssetOperations$Proxy$_$$_WeldClientProxy.validateAsset(RepositoryAssetOperations$Proxy$_$$_WeldClientProxy.java)
> at
> org.drools.guvnor.server.RepositoryAssetService.validateAsset(RepositoryAssetService.java:338)
> at
> org.drools.guvnor.server.RepositoryAssetService$Proxy$_$$_WeldClientProxy.validateAsset(RepositoryAssetService$Proxy$_$$_WeldClientProxy.java)
> at
> org.drools.guvnor.server.RepositoryServiceServlet.validateAsset(RepositoryServiceServlet.java:388)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
> at
> com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
> at
> com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
> at
> com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
> at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>

[rules-users] Exception when building a template

2012-04-19 Thread Sean Su
I am using 5.4.0.CR1 to build a template (decision table) but regardless
what I do, I will get this exception from the first column.

Are we aware of any known issues in this build? Or the way I am using the
tool is wrong? I can provide the repository if it helps.

Thanks

Sean

ERROR 19-04 15:25:31,518 (LoggingHelper.java:error:74)  Unable to build
asset.
java.lang.IllegalArgumentException: value Lower Range is not a valid column
definition
at
org.drools.template.parser.ColumnFactory.getColumn(ColumnFactory.java:34)
at
org.drools.template.parser.DefaultTemplateContainer.parseTemplate(DefaultTemplateContainer.java:93)
at
org.drools.template.parser.DefaultTemplateContainer.(DefaultTemplateContainer.java:47)
at
org.drools.template.DataProviderCompiler.compile(DataProviderCompiler.java:56)
at
org.drools.guvnor.server.util.BRDRTPersistence.marshal(BRDRTPersistence.java:57)
at
org.drools.guvnor.server.contenthandler.drools.BRLContentHandler.getSourceDRL(BRLContentHandler.java:84)
at
org.drools.guvnor.server.contenthandler.drools.BRLContentHandler.compile(BRLContentHandler.java:61)
at
org.drools.guvnor.server.builder.PackageAssemblerBase.compile(PackageAssemblerBase.java:88)
at
org.drools.guvnor.server.builder.PackageAssemblerBase.buildAsset(PackageAssemblerBase.java:72)
at
org.drools.guvnor.server.builder.AssetItemValidator$BuilderValidator.validate(AssetItemValidator.java:57)
at
org.drools.guvnor.server.builder.AssetItemValidator.validate(AssetItemValidator.java:44)
at
org.drools.guvnor.server.RepositoryAssetOperations.validateAsset(RepositoryAssetOperations.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:44)
at
org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
at
org.drools.guvnor.server.RepositoryAssetOperations$Proxy$_$$_WeldClientProxy.validateAsset(RepositoryAssetOperations$Proxy$_$$_WeldClientProxy.java)
at
org.drools.guvnor.server.RepositoryAssetService.validateAsset(RepositoryAssetService.java:338)
at
org.drools.guvnor.server.RepositoryAssetService$Proxy$_$$_WeldClientProxy.validateAsset(RepositoryAssetService$Proxy$_$$_WeldClientProxy.java)
at
org.drools.guvnor.server.RepositoryServiceServlet.validateAsset(RepositoryServiceServlet.java:388)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)


-- 
"But beware of the Dark Side. Anger, fear, aggression - the Dark Side of
the Force are they." -Yoda
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] please provide a rule for events timeout cases

2012-04-19 Thread Wolfgang Laun
With this kind of scenario it helps a lot if you retract a matching
pair (R+S, R+F). (If you need the information for further processing,
create another fact.)

And make sure to use '==' when testing for equality!

rule request_success
when
 $req : EventRecord( type == EventRequest, $user: user)
 $resp : EventRecord( type == EventResponseSuccess, user==$user,
this after[0s.10s] $req )
 not EventRecord( type == EventResponseSuccess || == EventResponseFailure,
  user == $user, this before $resp )
then
 // success
 retract( $req );
 retract( $resp );
end

-W


On 19/04/2012, skatta1986  wrote:
> Could you please help out me in this...
>
> modified rules: But it is giving thread exception at runtime
>
> rule event_success_case
>  when
> $req : EventRecord( type=EventRequest, user="katta" )
> and $resp : EventRecord( type=EventResponseSuccess, user="katta",  this
> after[0s, 10s] $req )
> and ( not (EventRecord( type=EventResponseSuccess, user="katta",  this
> after[0s, 10s] $req , this before[0s, 10s] $resp)))
> #and ( not (EventRecord( type=EventResponseSuccess, user="katta", $req
> overlaps this, this overlaps $resp) ))
>  then
>System.out.println("Success case for user " + $req.getUser());
> retract($req);
>  end
>
> rule event_failure_case
>  when
> $req : EventRecord( type=EventRequest, user="katta" )
> and EventRecord( type=EventResponseFailure, user="katta",  this
> after[0s, 10s] $req )
> and ( not (EventRecord( type=EventResponseFailure, user="katta",  this
> after[0s, 10s] $req , this before[0s, 10s] $resp)))
> #and ( not (EventRecord( type=EventResponseFailure, user="katta", $req
> overlaps this, this overlaps $resp) ))
>  then
>System.out.println("Failed case for user " + $req.getUser());
>retract($req);
>  end
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/please-provide-a-rule-for-events-timeout-cases-tp3907955p3923831.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] please provide a rule for events timeout cases

2012-04-19 Thread Vincent LEGENDRE
without the error trace, hard to say why it crashes ...

But your rules can be simplified/clarified :
   - "and" to connect conditions is not needed
   - in your first 'not' condition, which you add to test that no other event 
takes place between the two objects matched in previous patterns, you should 
test the two response types, as you don't want *any* response ...
   - again in your first 'not' condition, the after/before should not be in a 
interval. Why not using after/before only ? For timeout ? Should be a third 
rule to me ... and should add a rule to handle response coming after the 
timeout too.
   - I cant see the utility of you second 'not' pattern (may be because of my 
previous remarks)

Another question : why don't you retract the response too ? Is it because you 
want to keep them ?
To me it is better to retract it, especially if it takes place between another 
initial EventRequest and its response. at least mark the response as treated 
and ignore the treated responses in your conditions
 

So, your rules will become 2 groups of rules : first group to handle the 
response that correspond to a request, second group to handle the timeout cases 
:

rule event_success_case 
 when 
$req : EventRecord( type=EventRequest, $user : user ) 
$resp : EventRecord( type=EventResponseSuccess, user=$user,  this after 
$req ) 
not (EventRecord( type=EventResponseSuccess || EventResponseFailure, 
user=$user,  
  this != $resp, this after $req , this before $resp)))
# 'this != $resp' is not mandatory as you test after/before (which are 
strict), but it does not harm ...
 then 
System.out.println("Success case for user " + $req.getUser()); 
retract($req); 
retract($resp);  
end 
 
rule event_failure_case : same but testing the other status


rule event_timeout_case
 when 
$req : EventRecord( type=EventRequest, $user : user ) 
not (EventRecord( type=EventResponseSuccess || EventResponseFailure, 
user=$user,  
  this after[0,10s] $req))) // assuming 10s for timeout
 then 
System.out.println("Timeout case for user " + $req.getUser()); 
retract($req); 
end 



rule event_response_after_timeout_case
 when 
$resp: EventRecord( type=EventResponseSuccess || EventResponseFailure, 
$user : user ) 
not (EventRecord( type=EventRequest, user=$user,  
  this before $resp)))
 then 
System.out.println("Response coming after timeout case for user " + 
$req.getUser()); 
retract($resp); 
end 


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] please provide a rule for events timeout cases

2012-04-19 Thread skatta1986
Could you please help out me in this...

modified rules: But it is giving thread exception at runtime

rule event_success_case 
 when 
$req : EventRecord( type=EventRequest, user="katta" ) 
and $resp : EventRecord( type=EventResponseSuccess, user="katta",  this
after[0s, 10s] $req ) 
and ( not (EventRecord( type=EventResponseSuccess, user="katta",  this
after[0s, 10s] $req , this before[0s, 10s] $resp)))
#and ( not (EventRecord( type=EventResponseSuccess, user="katta", $req
overlaps this, this overlaps $resp) ))
 then 
   System.out.println("Success case for user " + $req.getUser()); 
retract($req); 
 end 
 
rule event_failure_case 
 when 
$req : EventRecord( type=EventRequest, user="katta" ) 
and EventRecord( type=EventResponseFailure, user="katta",  this
after[0s, 10s] $req ) 
and ( not (EventRecord( type=EventResponseFailure, user="katta",  this
after[0s, 10s] $req , this before[0s, 10s] $resp)))
#and ( not (EventRecord( type=EventResponseFailure, user="katta", $req
overlaps this, this overlaps $resp) ))
 then 
   System.out.println("Failed case for user " + $req.getUser()); 
   retract($req); 
 end 

--
View this message in context: 
http://drools.46999.n3.nabble.com/please-provide-a-rule-for-events-timeout-cases-tp3907955p3923831.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Performace Issues drools

2012-04-19 Thread Welsh, Armand
This may no longer be the case, but my understanding is that when you use from 
to query data from a member list of another object in working memory, that 
those members are not indexed by Rete.

I think every time the rule evaluates, it has to iterate through the entire 
member list (collection) to find the matching facts that are extracted for 
additional evaluation.

With that said, if you have one rule that extracts the facts, and inserts them 
into working memory, they will be indexed and now many operations on the fact 
type will be pre-computed at the time of insert, improving performance 
dramatically.  I don't know if this makes sense, but consider the following:


CONDITION:
$pt: Patient ( )
LabTest( ) from $pt.labTests
$numTests: Number ( ) from accumulate (  LabTest($type: type == "lab"), 
count($type) )

Drools first collects all the Patient facts and for each Patient it extracts 
the collections of tests.  Now the collection of patients are already known by 
Rete, so this has been pre-computed at time of fact insert.
Next, for each Patient fact, drools extracts the collection of LabTests 
performed. These are not indexed by Rete to they are not actually in working 
memory.  Each time this rule is evaluated, the collection of LabTests must be 
generated.
Next the accumulate evaluates the LabTest facts to find those that have a 
getType() == "lab".  Since the facts do not exist in working memory, accumulate 
iterates all the LabTest fact and extracts just the ones where getType == 
"lab".  If the rule file 10 times, that's 10 iterations of the collection.

If you break this into two rules:

CONDITION:
$pt: Patient ( )
$test : LabTest( ) from $pt.labTests
CONSEQUENCE
Insert($test);

CONDITION:
$numTests: Number ( ) from accumulate (  LabTest($type: type == "lab"), 
count($type) )


In this scenario, Drools only extracts the LabTest facts once, and inserts them 
in working memory, so that when the 2nd rule is evaluated, it is already known 
which LabTest facts are in memory that exist, and the iteration only happened 
once, at insert time, instead at every rule evaluation.

My understanding may be obsolete, and inaccurate as it applies to Drools 5.4, 
but this is the type of coding changes I have made in the past to improve 
performance.  The key is knowing how to control the insertion rule, so it does 
not insert duplicates, or refire unexpectedly.

Care must be taken to ensure you are properly binding your facts when you do 
this though... But the most speed benefit in drools comes from using the rete 
engine to avoid multiple iterations of the same collection...

-Original Message-
From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of sanal
Sent: Tuesday, April 17, 2012 4:27 AM
To: rules-users@lists.jboss.org
Subject: Re: [rules-users] Performace Issues drools

Hi,
Still Iam facing some issues with the accumulte.Please see the below
senario.I am trying to explain with the below example.

 


Suppose Glucose is a OrderedComponent which is under Labgroup.

 

PackageComponent(Rule)

--
LABGroup (ComponentKey=100)   qtyLimit(2)


OrderedComponent

---
Order1   Glucose (ComponentKey=101)   Ordered qty (1)   
ParentKey(100), ParentKey(4)
Order2   Glucose (ComponentKey=101)   Ordered qty (1)   
ParentKey(100) ,ParentKey(4)
Order3   Glucose (ComponentKey=101)   Ordered qty (1)   
ParentKey(100), ParentKey(4)

 

Rule execution flow which i require.

 

1) I need to check any rule exist for Orderedcomponent.If exist Execute the
Rule.
 
   In this case no rule exist for glucose.

 

 

2) If no rule is found for the Orderedcomponent.I need to Check if any rule
exist for its parent(group).
   I am trying to achive this by changing the component key. The component
key is changed to that of 
   the parent and the rules are executed once again.This process is
contiuned until any rules exist for the group

  or root parent is reached(tree format).

 


   
   1st Issue
   Here  parent of glucose is Lab. And Lab has got rule.So the Parent rule
of lab should get executed.
   In this senario only 2 glucose orders should go under package. 3rd one
should not go under package.
   With my existing Drl all the 3 are going inside the package.How can i
correct this?
   
   2nd Issue
   While accumulating with lab group,all ordered items whose parent group is
lab should be summed up.
   
   
   The salience is used in such a manner because i need to execute the rules
for the services first
   and later the rules for its parents group.
   


   Please find the modified drl as per your suggestion.


 


package com.his.billing.domain;

import com.his.clinical.domain.PackageDefinition;
import com.his.clinical.domain.PackageComponent;
import com.his.billing.domain.OrderedComponent;
import com.his.billing.do

Re: [rules-users] please provide a rule for events timeout cases

2012-04-19 Thread Wolfgang Laun
"Immediate response" is one way of saying that there is no other
response between a request and a response for one user. Simply add
this condition, testing for both kinds of response.

-W

On 19/04/2012, skatta1986  wrote:
> Hi,
>
> Now time out is working fine.
>
> But facing issues for correlating success and failure events which doesnot
> have unique id. I want to correlate an event request followed by its
> immediate event response.
>
> Ex: Consider the events in below order
> EventRecord( type=EventRequest, user="katta" )
> EventRecord( type=EventResponseFailure, user="katta" )
>
> EventRecord( type=EventRequest, user="katta" )
> EventRecord( type=EventResponseSuccess, user="katta" )
>
> Rules:
>
> rule event_success_case
> when
>$req : EventRecord( type=EventRequest, user="katta" )
>and EventRecord( type=EventResponseSuccess, user="katta",  this after[0s,
> 10s] $req )
> then
>   System.out.println("Success case for user " + $req.getUser());
>retract($req);
> end
>
> rule event_failure_case
> when
>$req : EventRecord( type=EventRequest, user="katta" )
>and EventRecord( type=EventResponseFailure, user="katta",  this after[0s,
> 10s] $req )
> then
>   System.out.println("Failed case for user " + $req.getUser());
>   retract($req);
> end
>
> In the above example I don't have any unique identity to correlate request
> and response. I need to correlate only based on events order.
>
>
> In the above example events order is EventRequest --> EventResponseFailure
> and then EventRequest --> EventResponseSuccess. So my expected output is:
> Failed case for user katta
> Success case for user katta
>
> But I am getting below response:
> Success case for user katta
> Success case for user katta
>
> First EventRequest and second EventRequest are correlating with second
> response EventResponseSuccess as this response is within 0 to 10sec for both
> events.
>
> Note: I am getting expected result only when I send few events. If I insert
> around 50 events at time into Working Memory, I face this kind of unexpected
> result.
>
> I need to work on live trafic, where I receive hurends of messages per
> second.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/please-provide-a-rule-for-events-timeout-cases-tp3907955p3922235.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] StatefulSession finalize() memory question

2012-04-19 Thread sefarm
I'm just beginning at a project that is using Drools in a Desktop
application, currently V 5.2.0.  
This is my first contact with Drools.

My first task was to analyze the application's memory usage.  I noticed that
there were quite a number of 
ReteooStatefulSession's hanging around on the Finalizer queue--they never do
get GC'd (at least not in
normal operation).  My question is the motivation for implementing
StatefulSession's with a finalize() 
method.  My understanding is that it is best practice to call dispose() in
any case, when finished with the
session.

I built drools-core here locally and removed the finalize() method which had
the desired effect--no Sessions
on the Finalizer queue.

The application uses rules as the logic behind data entry masks.  One rule
per mask type, one session per
mask instance.  There may be several instances of a mask type active at any
time.

Thanks,

Steve

--
View this message in context: 
http://drools.46999.n3.nabble.com/StatefulSession-finalize-memory-question-tp3922586p3922586.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] please provide a rule for events timeout cases

2012-04-19 Thread skatta1986
Hi,

Now time out is working fine. 

But facing issues for correlating success and failure events which doesnot
have unique id. I want to correlate an event request followed by its
immediate event response.

Ex: Consider the events in below order
EventRecord( type=EventRequest, user="katta" ) 
EventRecord( type=EventResponseFailure, user="katta" ) 

EventRecord( type=EventRequest, user="katta" ) 
EventRecord( type=EventResponseSuccess, user="katta" ) 

Rules: 

rule event_success_case 
when 
   $req : EventRecord( type=EventRequest, user="katta" ) 
   and EventRecord( type=EventResponseSuccess, user="katta",  this after[0s,
10s] $req ) 
then 
  System.out.println("Success case for user " + $req.getUser());
   retract($req);
end

rule event_failure_case 
when 
   $req : EventRecord( type=EventRequest, user="katta" ) 
   and EventRecord( type=EventResponseFailure, user="katta",  this after[0s,
10s] $req ) 
then 
  System.out.println("Failed case for user " + $req.getUser());
  retract($req);
end

In the above example I don't have any unique identity to correlate request
and response. I need to correlate only based on events order. 


In the above example events order is EventRequest --> EventResponseFailure
and then EventRequest --> EventResponseSuccess. So my expected output is:
Failed case for user katta
Success case for user katta

But I am getting below response:
Success case for user katta
Success case for user katta

First EventRequest and second EventRequest are correlating with second
response EventResponseSuccess as this response is within 0 to 10sec for both
events. 

Note: I am getting expected result only when I send few events. If I insert
around 50 events at time into Working Memory, I face this kind of unexpected
result.

I need to work on live trafic, where I receive hurends of messages per
second.



--
View this message in context: 
http://drools.46999.n3.nabble.com/please-provide-a-rule-for-events-timeout-cases-tp3907955p3922235.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users