rule-engine

How to pass a collection from a rule to a java method

独自空忆成欢 提交于 2019-12-25 05:12:29
问题 I have a collection of Type Cars which I need to pass from the ILOG Jrules to my Java evaluation method. My Java evaluation method can accept an Object, so a collection can be accepted. I need to process the collection of cars in my Java XOM and then return some output to ILOG. But how do I create a collection of cars from my ILOG JRules? And for DVS testing, how do I pass the collection of cars from my DVS Scenario Excel sheet? 回答1: To clarify Tito's comment on the first answer: Well, it

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

How to return a list from inside of accumulate in drl Drools?

大憨熊 提交于 2019-12-24 23:09:47
问题 Here is my rule rule "Multiple bookings via same mobile" when (stayDateGroupingIteration : StayDateGroupingDto($stayGroupedBookings : stayGroupedBookings)) and (QueryTypeDto( queryType == "multiple" )) $travellerCount :Number() from accumulate(BookingSummaryDtoList( $bookingSummaryDtoList : bookingSummaryDtoList) from $stayGroupedBookings, init( int count=0; List<String> globalList= new ArrayList(); Set<String> duplicateSet=new HashSet();), action( for(Object bookingSummary :

How to start working with a large decision table

删除回忆录丶 提交于 2019-12-23 19:58:27
问题 Today I've been presented with a fun challenge and I want your input on how you would deal with this situation. So the problem is the following (I've converted it to demo data as the real problem wouldn't make much sense without knowing the company dictionary by heart). We have a decision table that has a minimum of 16 conditions. Because it is an impossible feat to manage all of them (2^16 possibilities) we've decided to only list the exceptions. Like this: As an example I've only added 10

Does OptaPlanner support optimizations and constraints on continuous variables?

喜你入骨 提交于 2019-12-23 10:26:14
问题 I'm reading contradictory things in the documentation. On one hand, this passage seems to indicate that continuous planning variables are possible: A planning value range is the set of possible planning values for a planning variable. This set can be a discrete (for example row 1, 2, 3 or 4) or continuous (for example any double between 0.0 and 1.0). On the other hand, when defining a Planning Variable, you must specify a ValueRangeProvider annotation on a field to use for the value set: The

How can I calculate an expression parameter in run time?

ぐ巨炮叔叔 提交于 2019-12-23 05:15:12
问题 The problem I need to solve is to run data through IF statements. The IF statements are generated by a SQL table on run time. I've managed to do this by using expressions and Lambda expressions. My table has memberName; Operator; Target. So for example I get "Age", "GreaterThan" and "40" from the table, and I compile it. var rule = new Rule(rowRule["memberName"].ToString(), rowRule["Operator"].ToString(), rowRule["Target"].ToString()); Func<User, bool> compiledRule = CompileRule<User>(rule);

Drools Rules Template - first invocation 1000 times slower than subsequence invocations

混江龙づ霸主 提交于 2019-12-22 01:48:20
问题 I have built a Drools Rules Template using Drools 6.4.0.Final It is pretty much identical to the example provided here. I have wrapped it in a Spring RestController and deployed it as a WAR in to Tomcat . I notice that the first call is always very slow to get a result and gets slower as the number of rows in the xls spreadsheet grows. I imagine drools builds an index when the first ever KieSession is created. And that this index is subsequently cached making further calls much faster? I see

Drools disable a rule at runtime

☆樱花仙子☆ 提交于 2019-12-21 09:25:12
问题 I'm starting a project whith Drools and Drools Guvnor. My rules are deployed in drools guvnor. My rule engine instance can access those rules via the pkg file exposed by drools Guvnor when you do a package release build and release. This is all working fine, what I'm looking for is a solution for disabling a rule at runtime. The only solution I have right now is to go to guvnor, archive the rule and do a build + release of the package containing that rule. Isn't there another strategy ? 回答1:

Space-based architecture?

送分小仙女□ 提交于 2019-12-20 08:49:32
问题 One chapter in Pragmatic Programmer recommends looking at a blackboard/space-based architecture + a rules engine as a more flexible alternative to a traditional workflow system. The project I'm working on currently uses a workflow engine, but I'd like to evaluate alternatives. I really feel like a SBA would be a better solution to our business problems, but I'm worried about a total lack of community support/user base/venders/options. JavaSpaces is dead, and the JINI spin-off Apache River

When is a Business Rules Engine used

回眸只為那壹抹淺笑 提交于 2019-12-18 11:31:47
问题 When is a Business Rules Engine used? What is the difference between Business Rules Engines and scripting/configuration/customization 回答1: Rules engines can do forward and backward chaining as well as inferencing. Check out Fair Isaac Blaze, Drools or iLog for implementations. 回答2: A business rules engine, or a business rules management system, should be used when you are trying to implement a decision in your code. But not just any decision. A decision that: Involves lots of rules Has rules