drools

ArrayList size not working properly in Drools 6.2

余生长醉 提交于 2019-12-25 05:43:40
问题 I was using Drools 6.1 for rules development. I was using array list size() method in rule to check. i.e. $x : X( list.size == 1) where list is an attribute of Collection type. Now I migrated to Drools 6.2. However this condition is not working and rule is not getting fired. When I changed this rule as below, $x : X( list.size > 0 , list.size < 2 ) , this rule is working fine. Please have a look on this. Is there any issue in Drools 6.2 version. Thanks Shorav 来源: https://stackoverflow.com

Drools constraint object does not exist whose member field contains a value other than P

ぐ巨炮叔叔 提交于 2019-12-25 04:33:14
问题 I realize the title is crazy, but it really is the best I could think of. If anyone has better suggestions please leave them in the comments and I'll edit. This question is a followup to the question asked here : Drools Constraint object other than P is found in collection For those who don't want to click, that post describes the solution to the situation in which you want to know if there is a fact of CustomType which has a member field containing a value other than P. The Solution to this

Are Drools global variables session-bound?

江枫思渺然 提交于 2019-12-25 04:07:03
问题 When declaring and using global variables within Drools, are globals entirely bound to the session in the sense that once the session is closed, the globals are disposed of too? Is there some way of storing data in drools memory that can be accessed by numerous sessions at any one time without needing it to be reloaded each time? 回答1: A DRL global is a POJO, which exists as long as there exists at least one reference to it. After setGlobal, a session keeps one (additional) reference, which is

Deploying project JAR to artifactory programmatically

梦想与她 提交于 2019-12-25 03:58:12
问题 Deploy programatically created KIE-Drools-Artifact to Maven repository has come closest to what I'm trying to do. I have artifactory set up as a remote repository for a project, and what I want to do is deploy snapshot releases to the libs-shapshot-local repository from one project so that they can be accessed via others. As for my code, I'm working with Drools/java and I am able to create a JAR file and deploy it to the local .m2 repository from inside the program(thanks to the above

How to define variable in side drools and add values to them

妖精的绣舞 提交于 2019-12-25 03:37:14
问题 How to define variable and add values to it inside DRL file that can be used between the rules as a static resource. I tried to use global keyword but when add I add values to it i will not be effected inside Working Memory as it mentioned in documentation. And in my case i conn't add it from Application side. Example : global java.util.List myList; function java.util.List initMyList() { List list = new ArrayList(); list.add(1); return list; } rule "initListRule" salience 1001 when eval

Can optaplanner solve partly pre-assigned planning entities using Drools rules?

跟風遠走 提交于 2019-12-25 03:15:46
问题 We are using the time dependent vehicle routing problem example of Optaplanner 6.2. In our case the domain model consists of activities (corresponding to customers) and technicians (corresponding to vehicles). Is it possible to initialize an optimization with partly pre-assigned activities to certain technicians, whereby the rest of activities is not assigned? This would correspond to the case of optaplanner (cvrptw-case) when we stop the solving or wait for the solution, and then add at the

Maintain separate rule files in drools

浪子不回头ぞ 提交于 2019-12-25 02:26:28
问题 I have a use-case where I need to maintain separate drl file for separate entities. For example, entity 1 has a set of facts which should be driven by drl1 entity 2 has a set of facts which should be driven by drl2 How should I implement this? Load the drl's and corresponding facts in separate Knowledge base and sessions Load all drl's and facts in single session. I do not know how to achieve 2 回答1: If you build your Knowledge Base along the lines given below, you can repeat adding another

Creating rules having complex conditions using multiple data objects

坚强是说给别人听的谎言 提交于 2019-12-25 02:22:59
问题 Assume that I have two data objects Person and Address . Person object has the fields name and gender and Address object has the fields city and state . Now I want to take some action based on this condition : when (person.name == 'jayram' && address.city == 'barhiya') || (person.gender == 'M' && address.state == 'bihar') then do something How to accomplish this in drools rule file? 回答1: Maybe this should be the solution: package com.sample dialect "mvel" import com.sample.Person; import com

Setting global variables in working memory in Drools planner

孤人 提交于 2019-12-25 01:39:31
问题 How do I add a global variable to working memory in drools planner's solver to be able to use in scores drool. This is similar to https://issues.jboss.org/browse/JBRULES-2700 but couldn't find a solution though. 回答1: First some preaching: Using a service (set as a global) to calculate part of the score will break delta based score calculation (read the manual section on that topic), resulting in much less score calculations per second (say 50 instead of 5000 per second on big data sets). Then

Drools - Is there a direct correlation between number of rules and permgen space?

怎甘沉沦 提交于 2019-12-25 01:35:22
问题 I ran drools decision table with 100 rules and it worked fine. But as soon as I increased the number of rules to 1000, I started getting permgen space error. I had to increase permgen to 256MB for my process to accommodate the 3000 rules. My concern is as I keep adding the rules, I might need more and more permgen. I am thinking of not using drools and develop a custom solution due to this issue. Is this correct observation or am I doing something wrong causing the perm gen space requirement