[rules-users] How to add generated rules (from templates) to a KB on the fly?
Hi, I use Drools (6.0.0) with KIE-api and I have a method to generate drl rules from templates+hashmaps. These rules are stored in a ListString. Now, I would to pack up these generated rules and make them available to a preexistant KieSession. Thus, a KieSession could access to standard KieBases (with rules stored in resource directories) AND to these generated rules (stored in an object, in memory). Is it possible to do that? I precise I don't want to use org.drools.internal.* classes. Regards, Alexandre -- View this message in context: http://drools.46999.n3.nabble.com/How-to-add-generated-rules-from-templates-to-a-KB-on-the-fly-tp4027695.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] KnowledgeAgent fallback FROM local cache?
URLResource caches things to a given location, that can be controlled via system property, and has a default. In theory once cached, it should be able to read from the cache without Guvnor being needed to available - even after restart. Look at the CACHE_DIR, and how it’s created and used: https://github.com/droolsjbpm/drools/blob/5.6.x/drools-core/src/main/java/org/drools/io/impl/UrlResource.java There are some fixes in 5.6, related to last read times, which may fix the issue you are having. If the issue continues it’s unlikely we’d fix this, unless it becomes a product requirement. 5.x is now in maintenance, so things will only be fixed if paying customers request it. This is not an issue in 6.0, as we use maven and the local m2 repo now. Mark On 15 Jan 2014, at 17:10, dunnlow dunn...@yahoo.com wrote: I am using drools 5.5 with Guvnor and the Integration Server. My integration server uses a knowledgeagent that pulls the package from guvnor and I have set the drools.resource.urlcache for a local cache in case Guvnor is unavailable. If Guvnor is available at startup, the KAgent sees any deployed changes to my package from then on. If guvnor is NOT available, the local cache is used and everything works fine UNTIL I make a change to Guvnor. The KAgent seems to never fall back to checking for Guvnor's availability. I'd like the KnowledgeAgent to use the local cache until Guvnor is available again. Is there an (existing) way to make this happen? If not, any thought about implementing a solution? Thanks, - J -- View this message in context: http://drools.46999.n3.nabble.com/KnowledgeAgent-fallback-FROM-local-cache-tp4027696.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] How to add generated rules (from templates) to a KB on the fly?
Just change your rules, increase the project version and build the jar. Then either add the jar manually to KieRepository or make it available through maven, with kie-ci on the class path. Once the new jar is reachable, you can just call KieContainer.updateToVersion Make sure you read this thoroughly: http://docs.jboss.org/drools/release/6.0.1.Final/drools-docs/html/KIEChapter.html Mark On 15 Jan 2014, at 14:01, Shinsekai aren...@genoscope.cns.fr wrote: Hi, I use Drools (6.0.0) with KIE-api and I have a method to generate drl rules from templates+hashmaps. These rules are stored in a ListString. Now, I would to pack up these generated rules and make them available to a preexistant KieSession. Thus, a KieSession could access to standard KieBases (with rules stored in resource directories) AND to these generated rules (stored in an object, in memory). Is it possible to do that? I precise I don't want to use org.drools.internal.* classes. Regards, Alexandre -- View this message in context: http://drools.46999.n3.nabble.com/How-to-add-generated-rules-from-templates-to-a-KB-on-the-fly-tp4027695.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] permgen leak
Hi Mark/Davide Is there a work around to this problem in 5.4?. Thanks and regards, Adarsh CHAINI SENIOR LEAD DEVELOPMENT SPECIALIST | HSBC Bank Plc 8 Canada Square, London E14 5HQ, UK ___ Phone Int: (0)79914720 Ext: +44 (0)20 79914720 Mobile +44(0)7595530105 Email adarsh.cha...@hsbcib.com ___ Protect our environment - please only print this if you have to! From: Mark Proctor mproc...@codehaus.org To: Rules Users List rules-users@lists.jboss.org Date: 08/01/2014 04:46 Subject: Re: [rules-users] permgen leak Sent by: rules-users-boun...@lists.jboss.org For anyone interested. The commit involves addressing two needs. 1) Enforcing MVEL reflection mode throughout - MVEL ASM optimiser can NEVER be used for anything (it doesn?t add much value anyway). 2) Avoiding giving the template system the root class loader(which we use for dynamic stuff), as those templates are statically cached. https://github.com/sotty/drools/commit/1b75d4785861e72338cc5ea1280610a7937be017 Mark On 8 Jan 2014, at 00:53, Mark Proctor mproc...@codehaus.org wrote: The root of the perm gen leak has now be solved, thanks to some heroic work by community developer Davide Sottara. This is just in time for the 5.6 release going out this week. You will not need to use the kbase.dispose() work around. Mark On 6 Jan 2014, at 20:50, Mark Proctor mproc...@codehaus.org wrote: The 5.6 approach should be considered a work around, not a fix. Somewhere a ref is being held, that shouldn?t be - we just haven?t found it yet. Mark On 6 Jan 2014, at 19:17, Davide Sottara dso...@gmail.com wrote: I have run pmander's tests, and reported in a previous email. The leak in 5.x is due to the nature of the composite classloader, and dispose() forces the memory to be released. I don't remember if that fix was in 5.6.CR1 (probably not), so you may have to try 5.6.0-SNAPSHOT or wait for the end of the week. 6.x does not suffer from the same problem, but has a different issue - no way to unload kie modules once they are cached - which Mario has been working on. In either case, pmander's test works fine in both 5.6.x and 6.x after these fixes Davide On 01/06/2014 07:56 PM, Mark Proctor wrote: I?ve been told 5.6 will be released this week. This is because the JCR2GIT migration tool, in 5.6 is needed for our 6.0 product. Davide's current kbase.dispose() method, on the concrete class, should just be considered a work around for the problem. Unless this is fixed by someone in the community, I don?t think any core developers will have time to address this. At least not for 5.x; we?ll continue to look into it for 6.x. Mark On 6 Jan 2014, at 16:14, brachi brach...@sapiens.com wrote: see previous messages, pmander attached a unit test -- View this message in context: http://drools.46999.n3.nabble.com/permgen-leak-tp4027038p4027539.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 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 HSBC Bank plc may be solicited in the course of its placement efforts for a new issue, by investment clients of the firm for whom the Bank as a firm already provides other services. It may equally decide to allocate to its own proprietary book or with an associate of HSBC Group. This represents a potential conflict of interest. HSBC Bank plc has internal arrangements designed to ensure that the firm would give unbiased and full advice to the corporate finance client about the valuation and pricing of the offering as well as internal systems, controls and procedures to identify and manage conflicts of interest. HSBC Bank plc Registered Office: 8 Canada Square, London E14 5HQ, United Kingdom Registered in England - Number 14259 Authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and the Prudential Regulation Authority HSBC Bank plc may be solicited in the course of its placement efforts for a new issue, by investment clients of the firm for whom the Bank as a firm already provides other services. It may equally decide to allocate to
Re: [rules-users] permgen leak
You can try setting everything to the MVEL dialect, and also forcing MVEL to reflection via the system property (turning off jit) http://mvel.codehaus.org/Disabling+the+JIT+Compiler Mark On 15 Jan 2014, at 18:23, adarsh.cha...@hsbcib.com wrote: Hi Mark/Davide Is there a work around to this problem in 5.4?. Thanks and regards, Adarsh CHAINI SENIOR LEAD DEVELOPMENT SPECIALIST | HSBC Bank Plc 8 Canada Square, London E14 5HQ, UK ___ Phone Int: (0)79914720 Ext: +44 (0)20 79914720 Mobile+44(0)7595530105 Email adarsh.cha...@hsbcib.com ___ Protect our environment - please only print this if you have to! From: Mark Proctor mproc...@codehaus.org To: Rules Users List rules-users@lists.jboss.org Date: 08/01/2014 04:46 Subject: Re: [rules-users] permgen leak Sent by: rules-users-boun...@lists.jboss.org For anyone interested. The commit involves addressing two needs. 1) Enforcing MVEL reflection mode throughout - MVEL ASM optimiser can NEVER be used for anything (it doesn’t add much value anyway). 2) Avoiding giving the template system the root class loader(which we use for dynamic stuff), as those templates are statically cached. https://github.com/sotty/drools/commit/1b75d4785861e72338cc5ea1280610a7937be017 Mark On 8 Jan 2014, at 00:53, Mark Proctor mproc...@codehaus.org wrote: The root of the perm gen leak has now be solved, thanks to some heroic work by community developer Davide Sottara. This is just in time for the 5.6 release going out this week. You will not need to use the kbase.dispose() work around. Mark On 6 Jan 2014, at 20:50, Mark Proctor mproc...@codehaus.org wrote: The 5.6 approach should be considered a work around, not a fix. Somewhere a ref is being held, that shouldn’t be - we just haven’t found it yet. Mark On 6 Jan 2014, at 19:17, Davide Sottara dso...@gmail.com wrote: I have run pmander's tests, and reported in a previous email. The leak in 5.x is due to the nature of the composite classloader, and dispose() forces the memory to be released. I don't remember if that fix was in 5.6.CR1 (probably not), so you may have to try 5.6.0-SNAPSHOT or wait for the end of the week. 6.x does not suffer from the same problem, but has a different issue - no way to unload kie modules once they are cached - which Mario has been working on. In either case, pmander's test works fine in both 5.6.x and 6.x after these fixes Davide On 01/06/2014 07:56 PM, Mark Proctor wrote: I’ve been told 5.6 will be released this week. This is because the JCR2GIT migration tool, in 5.6 is needed for our 6.0 product. Davide's current kbase.dispose() method, on the concrete class, should just be considered a work around for the problem. Unless this is fixed by someone in the community, I don’t think any core developers will have time to address this. At least not for 5.x; we’ll continue to look into it for 6.x. Mark On 6 Jan 2014, at 16:14, brachi brach...@sapiens.com wrote: see previous messages, pmander attached a unit test -- View this message in context: http://drools.46999.n3.nabble.com/permgen-leak-tp4027038p4027539.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 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 HSBC Bank plc may be solicited in the course of its placement efforts for a new issue, by investment clients of the firm for whom the Bank as a firm already provides other services. It may equally decide to allocate to its own proprietary book or with an associate of HSBC Group. This represents a potential conflict of interest. HSBC Bank plc has internal arrangements designed to ensure that the firm would give unbiased and full advice to the corporate finance client about the valuation and pricing of the offering as well as internal systems, controls and procedures to identify and manage conflicts of interest. HSBC Bank plc Registered Office: 8 Canada Square, London E14 5HQ, United Kingdom Registered in England - Number 14259 Authorised by the Prudential Regulation Authority and regulated
[rules-users] Problem when creating KieModuleModel
Hi Guys! I am having a problem using drools 6 in my project. And I was able to reproduce it in one of the examples.. I just got this example: https://github.com/droolsjbpm/drools/tree/master/drools-examples-api/kiemodulemodel-example built the 2 dependant projects, kiebase inclusion and namedkiesession. Then, run the org.drools.example.api.kiemodulemodel.KieModuleModelExample in my eclipse, and I get the following: SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder. SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread main java.lang.NullPointerException at org.drools.compiler.kie.builder.impl.KieBuilderImpl.generateKieModuleMetaInfo(KieBuilderImpl.java:222) at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:194) at org.drools.example.api.kiemodulemodel.KieModuleModelExample.go(KieModuleModelExample.java:39) at org.drools.example.api.kiemodulemodel.KieModuleModelExample.main(KieModuleModelExample.java:63) Exactly the same happens when I do the same in my project. Any ideas? Thanks! Demian ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Problem when creating KieModuleModel
http://bit.ly/1eKm7lC Mark On 15 Jan 2014, at 19:35, Demian Calcaprina calcacue...@gmail.com wrote: Hi Guys! I am having a problem using drools 6 in my project. And I was able to reproduce it in one of the examples.. I just got this example: https://github.com/droolsjbpm/drools/tree/master/drools-examples-api/kiemodulemodel-example built the 2 dependant projects, kiebase inclusion and namedkiesession. Then, run the org.drools.example.api.kiemodulemodel.KieModuleModelExample in my eclipse, and I get the following: SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder. SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread main java.lang.NullPointerException at org.drools.compiler.kie.builder.impl.KieBuilderImpl.generateKieModuleMetaInfo(KieBuilderImpl.java:222) at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:194) at org.drools.example.api.kiemodulemodel.KieModuleModelExample.go(KieModuleModelExample.java:39) at org.drools.example.api.kiemodulemodel.KieModuleModelExample.main(KieModuleModelExample.java:63) Exactly the same happens when I do the same in my project. Any ideas? Thanks! Demian ___ 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] Problem when creating KieModuleModel
Thanks Mark, very instructive. On Wed, Jan 15, 2014 at 5:21 PM, Mark Proctor mproc...@codehaus.org wrote: http://bit.ly/1eKm7lC Mark On 15 Jan 2014, at 19:35, Demian Calcaprina calcacue...@gmail.com wrote: Hi Guys! I am having a problem using drools 6 in my project. And I was able to reproduce it in one of the examples.. I just got this example: https://github.com/droolsjbpm/drools/tree/master/drools-examples-api/kiemodulemodel-example built the 2 dependant projects, kiebase inclusion and namedkiesession. Then, run the org.drools.example.api.kiemodulemodel.KieModuleModelExample in my eclipse, and I get the following: SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder. SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread main java.lang.NullPointerException at org.drools.compiler.kie.builder.impl.KieBuilderImpl.generateKieModuleMetaInfo(KieBuilderImpl.java:222) at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:194) at org.drools.example.api.kiemodulemodel.KieModuleModelExample.go(KieModuleModelExample.java:39) at org.drools.example.api.kiemodulemodel.KieModuleModelExample.main(KieModuleModelExample.java:63) Exactly the same happens when I do the same in my project. Any ideas? Thanks! Demian ___ 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Planner with a list of planning variables
I have a related question and I'd like to ask it by extending the domain described here. Say that instead of the solution being one recipe, I am building a multiple-course meal of recipes. The problem will define the course slots including the maximum number of ingredients that can be used and the list of ingredients allowed for the slots of that course. Not all courses must have a recipe built. If the constraints of the guests can be satisfied with fewer courses, the caterer saves money. Each course is one recipe as described here: a list of ingredients (in my case i don't particularly care about the order of the ingredients within the recipe). Certainly each recipe does not need to use it's maximum number of ingredients. In my current implementation, I have a flattened list of assignment Planning Entities where each assignment represents an ingredient slot of a course mapped ingredient). For example if the first course has a maximum of 5 ingredients, the second course has a maximum of 10 ingredients, and the third has a maximum of 3 ingredients, my problem would have a list containing 18 Planning Entities all in one list. The trouble with this approach is that each slot is a separate entity. This means that assigning the ingredient to each of the 5 possible slots of first course is considered a separate solution when in reality it doesn't matter which slot of the course the ingredient ends up in. This makes the search space much larger than it needs to be and results in a lot of swapping of ingredient assignments within the same course which results in no change in score. Is there a recommended pattern to model this domain efficiently? Is there a modification that I can apply to my current representation of this domain which will allow an ingredient assigned to any slot of a course to be considered the same? Thanks, Jon -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Planner-with-a-list-of-planning-variables-tp4024088p4027704.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] permgen leak
why not just update to 5.6, it’s fixed there. http://downloads.jboss.org/drools/release/5.6.0.Final/ You can specify dialect at the top of the drl file, to be applied to all rules in that file. But that’s about it. Mark On 15 Jan 2014, at 20:51, adarsh.cha...@hsbcib.com wrote: Is this possible to set everything to MVEL Dialect as we are using JavaDialect in all our rules. We had this few times before and we managed to avoid it with usage of CMSClassUnlaoadingEnabled . But this has again comeback recently because the rate at which the classes are produced with load,CMS is unable to collect the permgen space at same rate so it trips Thanks and regards, Adarsh CHAINI SENIOR LEAD DEVELOPMENT SPECIALIST | HSBC Bank Plc 8 Canada Square, London E14 5HQ, UK ___ Phone Int: (0)79914720 Ext: +44 (0)20 79914720 Mobile+44(0)7595530105 Email adarsh.cha...@hsbcib.com ___ Protect our environment - please only print this if you have to! From: Mark Proctor mproc...@codehaus.org To: Rules Users List rules-users@lists.jboss.org Date: 15/01/2014 18:27 Subject: Re: [rules-users] permgen leak Sent by: rules-users-boun...@lists.jboss.org You can try setting everything to the MVEL dialect, and also forcing MVEL to reflection via the system property (turning off jit) http://mvel.codehaus.org/Disabling+the+JIT+Compiler Mark On 15 Jan 2014, at 18:23, adarsh.cha...@hsbcib.com wrote: Hi Mark/Davide Is there a work around to this problem in 5.4?. Thanks and regards, Adarsh CHAINI SENIOR LEAD DEVELOPMENT SPECIALIST | HSBC Bank Plc 8 Canada Square, London E14 5HQ, UK ___ Phone Int: (0)79914720 Ext: +44 (0)20 79914720 Mobile+44(0)7595530105 Email adarsh.cha...@hsbcib.com ___ Protect our environment - please only print this if you have to! From: Mark Proctor mproc...@codehaus.org To: Rules Users List rules-users@lists.jboss.org Date: 08/01/2014 04:46 Subject: Re: [rules-users] permgen leak Sent by: rules-users-boun...@lists.jboss.org For anyone interested. The commit involves addressing two needs. 1) Enforcing MVEL reflection mode throughout - MVEL ASM optimiser can NEVER be used for anything (it doesn’t add much value anyway). 2) Avoiding giving the template system the root class loader(which we use for dynamic stuff), as those templates are statically cached. https://github.com/sotty/drools/commit/1b75d4785861e72338cc5ea1280610a7937be017 Mark On 8 Jan 2014, at 00:53, Mark Proctor mproc...@codehaus.org wrote: The root of the perm gen leak has now be solved, thanks to some heroic work by community developer Davide Sottara. This is just in time for the 5.6 release going out this week. You will not need to use the kbase.dispose() work around. Mark On 6 Jan 2014, at 20:50, Mark Proctor mproc...@codehaus.org wrote: The 5.6 approach should be considered a work around, not a fix. Somewhere a ref is being held, that shouldn’t be - we just haven’t found it yet. Mark On 6 Jan 2014, at 19:17, Davide Sottara dso...@gmail.com wrote: I have run pmander's tests, and reported in a previous email. The leak in 5.x is due to the nature of the composite classloader, and dispose() forces the memory to be released. I don't remember if that fix was in 5.6.CR1 (probably not), so you may have to try 5.6.0-SNAPSHOT or wait for the end of the week. 6.x does not suffer from the same problem, but has a different issue - no way to unload kie modules once they are cached - which Mario has been working on. In either case, pmander's test works fine in both 5.6.x and 6.x after these fixes Davide On 01/06/2014 07:56 PM, Mark Proctor wrote: I’ve been told 5.6 will be released this week. This is because the JCR2GIT migration tool, in 5.6 is needed for our 6.0 product. Davide's current kbase.dispose() method, on the concrete class, should just be considered a work around for the problem. Unless this is fixed by someone in the community, I don’t think any core developers will have time to address this. At least not for 5.x; we’ll continue to look into it for 6.x. Mark On 6 Jan 2014, at 16:14, brachi brach...@sapiens.com wrote: see previous messages, pmander attached a unit test -- View this message in context: http://drools.46999.n3.nabble.com/permgen-leak-tp4027038p4027539.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
[rules-users] Ability to use Any of the Following (OR) with DSLs
Hi, I have created multiple DSLs. I now want to be able to create a rule which says: 1. For any of the following: DSL 1 DSL 2 2. For any of the following: DSL 3 DSL 2 DSL 4 3. For any of the following: DSL 3 How can I currently do this? Appreciate any pointers. Thanks, Nikita ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Inconsistent output when @PropertyReactive is used
Below is a test to demonstrate it, also add the @PropertyReactive property to MyClass() package com.sample; rule base when m : MyClass(data == null) then end rule 2 extends base when String() MyClass(value != test) from m then System.out.println(2 fired); end rule 1 extends base salience 1 when MyClass(value == null) from m then System.out.println(1 fired); insert(new String()); modify(m) { setValue(test) } end The test above should output 1 fired and 2 fired. Although we have set the value to test, rule 2 supposes to not fire, but it is in fact expected to fire due to the non-reactive property of CE from, and the result confirms this. But if we reorder the code in rule 1 to rule 1 extends base salience 1 when MyClass(value == null) from m then System.out.println(1 fired); modify(m) { setValue(test) } insert(new String()); end Then you get only 1 fired, as if CE from is reactive again. This only happens when you have the @PropertyReactive property added to MyClass() Version tested are 5.5.0.Final and 5.6.0.Final Could the Drools team review this? Thank you. -- View this message in context: http://drools.46999.n3.nabble.com/Inconsistent-output-when-PropertyReactive-is-used-tp4027709.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] Inconsistent output when @PropertyReactive is used
property reactive will not work with ‘from’. Mark On 15 Jan 2014, at 23:33, Sonata plz.write...@gmail.com wrote: Below is a test to demonstrate it, also add the @PropertyReactive property to MyClass() package com.sample; rule base when m : MyClass(data == null) then end rule 2 extends base when String() MyClass(value != test) from m then System.out.println(2 fired); end rule 1 extends base salience 1 when MyClass(value == null) from m then System.out.println(1 fired); insert(new String()); modify(m) { setValue(test) } end The test above should output 1 fired and 2 fired. Although we have set the value to test, rule 2 supposes to not fire, but it is in fact expected to fire due to the non-reactive property of CE from, and the result confirms this. But if we reorder the code in rule 1 to rule 1 extends base salience 1 when MyClass(value == null) from m then System.out.println(1 fired); modify(m) { setValue(test) } insert(new String()); end Then you get only 1 fired, as if CE from is reactive again. This only happens when you have the @PropertyReactive property added to MyClass() Version tested are 5.5.0.Final and 5.6.0.Final Could the Drools team review this? Thank you. -- View this message in context: http://drools.46999.n3.nabble.com/Inconsistent-output-when-PropertyReactive-is-used-tp4027709.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] Inconsistent output when @PropertyReactive is used
Mark Proctor wrote property reactive will not work with ‘from’. Mark Yes I am aware of that and I stated that on my post already. But this will not work with ‘from’ is not consistence, making the result unpredictable. -- View this message in context: http://drools.46999.n3.nabble.com/Inconsistent-output-when-PropertyReactive-is-used-tp4027709p4027712.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] Inconsistent output when @PropertyReactive is used
ordering matters, it’s not inconsistent. The from is applied in the alpha network, it stops reactive of pattern modify. The insert joins with the ‘from’ in the beta network and propagates - @PR is not applied at that level. When ‘insert’ is first, there is nothing for it to join with; so the insert does nothing. The later modify is ignored during @PR. When the insert is after, while the @PR is ignored for the modify the insert will now join with MyClass and propagate. This is the expected behaviour. Mark On 16 Jan 2014, at 00:08, Sonata plz.write...@gmail.com wrote: Mark Proctor wrote property reactive will not work with ‘from’. Mark Yes I am aware of that and I stated that on my post already. But this will not work with ‘from’ is not consistence, making the result unpredictable. -- View this message in context: http://drools.46999.n3.nabble.com/Inconsistent-output-when-PropertyReactive-is-used-tp4027709p4027712.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] Inconsistent output when @PropertyReactive is used
Actually (and arguably) I think that the behavior is consistent. In the first case, you insert a MyClass instance: base is eligible for activation, and so is rule 1. When rule 1 fires, it inserts a String which continues the previous propagation through rule 2. At this point, value is still != test and an activation for rule 2 is created. Now the modify: since the only @PR pattern is MyClass( data == null ) in rule base and you are setting the property value, the (re)propagation is blocked. This prevents the previous activation of rule 2 from being overwritten and cancelled, so rule 2 fires. In the second example, things are slightly different. Rule 1 activates as in the previous case, firing. This time, you modify m first, but since no String is in the WM, there is nothing to (re)propagate or cancel for rule 2. However, there is indeed a MyClass instance in the WM. When you insert the String, the modification has already been propagated: this time the String simply joins with the existing MyClass and continues its propagation. The next node is a from which checks the current value: it is now test, so the alpha constraint blocks the propagation. Rule 1 does not fire as expected, but it has little do do with @PR. Davide On 01/16/2014 12:33 AM, Sonata wrote: Below is a test to demonstrate it, also add the @PropertyReactive property to MyClass() package com.sample; rule base when m : MyClass(data == null) then end rule 2 extends base when String() MyClass(value != test) from m then System.out.println(2 fired); end rule 1 extends base salience 1 when MyClass(value == null) from m then System.out.println(1 fired); insert(new String()); modify(m) { setValue(test) } end The test above should output 1 fired and 2 fired. Although we have set the value to test, rule 2 supposes to not fire, but it is in fact expected to fire due to the non-reactive property of CE from, and the result confirms this. But if we reorder the code in rule 1 to rule 1 extends base salience 1 when MyClass(value == null) from m then System.out.println(1 fired); modify(m) { setValue(test) } insert(new String()); end Then you get only 1 fired, as if CE from is reactive again. This only happens when you have the @PropertyReactive property added to MyClass() Version tested are 5.5.0.Final and 5.6.0.Final Could the Drools team review this? Thank you. -- View this message in context: http://drools.46999.n3.nabble.com/Inconsistent-output-when-PropertyReactive-is-used-tp4027709.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] Inconsistent output when @PropertyReactive is used
Thanks very much for the detailed explanation Mark Proctor and Davide Sottara! I really wouldn't have thought that the ordering of code matters here while they are logically equivalent. And to understand that is actually required to be at very low level... So to sum up, when you have @PropertyReactive 1. from conditions are not re-evaluated 2. unless it has another non from condition preceding it and that condition is re-evaluated (by insert or modify) and this is expected behaviour. -- View this message in context: http://drools.46999.n3.nabble.com/Inconsistent-output-when-PropertyReactive-is-used-tp4027709p4027715.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] permgen leak
Hi, This may be a very basic question, but I'm using drools 5.1.1 and when I invoke a stateful session and that session ends I receive back all of the facts that were created during that session and I translate those into an EDI transaction. As an example I might have a few objects of types 2700*LX,2750* N1,2750* REF, and 2750*DTP. I know my rules fired create objects like: LX*1 N1*75*CMSEC REF*17*A DTP*007*D8*20140114 LX*2 N1*75*STATUS REF*17*AFTNM DTP*007*D8*20140114 Each of these lines is an object of the type I mentioned above. My task is to make sure that the different object types stick together when I put them in the .x12 file so that they are formatted above. What I do internally is I keep track that I have two of each of these objects, but I don't know if there is some type of timestamp that is on them that I could keep the first LX, N1, REF, DTP together or not. In one example I have a rule that inserts them in the order you see, yes, it literally inserts 8 objects/facts into memory. And I need to know the order they were inserted so that I can properly form a file out of them on the backend. Any thoughts? Thanks, Dean ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] permgen leak
Please don’t reply to existing posts, to start new discussions, it screws up the threads. Please read: http://www.jboss.org/drools/lists Anti-patterns to be ignored or attract abuse from others: 12. Reply to an existing thread but starting a new topic Mark On 16 Jan 2014, at 03:40, Dean Whisnant d...@basys.com wrote: Hi, This may be a very basic question, but I'm using drools 5.1.1 and when I invoke a stateful session and that session ends I receive back all of the facts that were created during that session and I translate those into an EDI transaction. As an example I might have a few objects of types 2700*LX,2750* N1,2750* REF, and 2750*DTP. I know my rules fired create objects like: LX*1 N1*75*CMSEC REF*17*A DTP*007*D8*20140114 LX*2 N1*75*STATUS REF*17*AFTNM DTP*007*D8*20140114 Each of these lines is an object of the type I mentioned above. My task is to make sure that the different object types stick together when I put them in the .x12 file so that they are formatted above. What I do internally is I keep track that I have two of each of these objects, but I don't know if there is some type of timestamp that is on them that I could keep the first LX, N1, REF, DTP together or not. In one example I have a rule that inserts them in the order you see, yes, it literally inserts 8 objects/facts into memory. And I need to know the order they were inserted so that I can properly form a file out of them on the backend. Any thoughts? Thanks, Dean ___ 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] Planner with a list of planning variables
On 15-01-14 21:36, jonathan.labin wrote: I have a related question and I'd like to ask it by extending the domain described here. Say that instead of the solution being one recipe, I am building a multiple-course meal of recipes. The problem will define the course slots including the maximum number of ingredients that can be used and the list of ingredients allowed for the slots of that course. Not all courses must have a recipe built. If the constraints of the guests can be satisfied with fewer courses, the caterer saves money. Each course is one recipe as described here: a list of ingredients (in my case i don't particularly care about the order of the ingredients within the recipe). Certainly each recipe does not need to use it's maximum number of ingredients. In my current implementation, I have a flattened list of assignment Planning Entities where each assignment represents an ingredient slot of a course mapped ingredient). For example if the first course has a maximum of 5 ingredients, the second course has a maximum of 10 ingredients, and the third has a maximum of 3 ingredients, my problem would have a list containing 18 Planning Entities all in one list. The trouble with this approach is that each slot is a separate entity. This means that assigning the ingredient to each of the 5 possible slots of first course is considered a separate solution when in reality it doesn't matter which slot of the course the ingredient ends up in. This makes the search space much larger than it needs to be and results in a lot of swapping of ingredient assignments within the same course which results in no change in score. The curriculum course example had the same problem: Lectures (= entities) belonging to the same course are interchangeable. Therefore, I configured the swapMoveSelector as such: swapMoveSelector filterClassorg.optaplanner.examples.curriculumcourse.solver.move.DifferentCourseSwapMoveFilter/filterClass /swapMoveSelector Is there a recommended pattern to model this domain efficiently? Is there a modification that I can apply to my current representation of this domain which will allow an ingredient assigned to any slot of a course to be considered the same? This cannot (currently) be expressed declaratively on the domain. We might want to support that in the future (so the filterClass is automatically applied on the swapMoveSelector etc), feel free to create a jira. Thanks, Jon -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Planner-with-a-list-of-planning-variables-tp4024088p4027704.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