Re: [rules-users] [Drools Planner] Hard constraint appears to be ignored
Op 26-02-12 19:47, Reinis schreef: Hello, 1) TRACE It did actually crash! Good :) java.lang.IllegalStateException: The presumedScore (0hard/-860soft) is corrupted because it is not the realScore (0hard/-858soft). It's not crashing on the hard constraint difference, but that probably means it doesn't get there yet. Presumed workingMemory: Score rule (reward Resource consolidation) has count (44) and weight total (44). Real workingMemory: Score rule (reward Resource consolidation) has count (46) and weight total (46). But the rule causing it looks normal to me: rule reward Resource consolidation when $leftAssignment : Assignment($project : project, $leftResource : resource != null, $leftId : id) $rightAssignment : Assignment(project == $project, resource == $leftResource, id != $leftId) eval(new Duration(Math.abs($leftAssignment.getInterval().getStartMillis() - $rightAssignment.getInterval().getStartMillis())).getStandardDays() == 0) Looks good to me. What you could do is make a Assignment.getIntervalStartMillis() and Assignment( ..., $leftStartMillis : intervalStartMillis) and add that rightAssignment's startMillis should be then leftAssignment's $leftStartMillis to avoid the Math.abs and double counting of this constraint. then insertLogical(new IntConstraintOccurrence(reward Resource consolidation, ConstraintType.POSITIVE , 1, $leftAssignment, $rightAssignment)); end 2) drools version and planner version drools-core-5.3.1.Final Can you try TRACE with drools-core, drools-compiler and knowledge-api 5.4.0.Beta2? There was a working memory corruption bug fixed in drools 5.4 over 5.3, not sure if it made 5.3.1. drools-planner-core-5.3.1.Final (No need to upgrade planner itself at this time - as that will force you down the UpgradeRecipe.txt). Thank you for the hints! Is the eval causing all this trouble? br Reinis On 02/26/2012 06:45 PM, Geoffrey De Smet wrote: 1) If you haven't already, can you turn onenvironmentModeTRACE/... and let it run a while (it will be much slower)? Report here if that crashes or not. 2) What drools version and what planner version are you using? Op 26-02-12 17:51, Reinis schreef: Hello, it appears that hard constraint I have defined is being ignored in some rare cases. Here's an example: This is what my application logs after getting best solution after solver has returned from solve(): 2012-02-23 21:28:54,595 [main] INFO Project Project1 assignment 563:[2012-02-27T13:00:00.000/2012-02-27T17:00:00.000] was assigned to John 2012-02-23 21:28:54,597 [main] INFO Project Project2 assignment 508:[2012-02-27T13:00:00.000/2012-02-27T17:00:00.000] was assigned to John (The log says that John was assigned twice in same time period to two different assignments (assignment 563 and assignment 508) Here short explanation of the relevant domain data assignment.id = 563 assignment.interval = 2012-02-27T13:00:00.000/2012-02-27T17:00:00.000 assignment.project = Project1 assignment.resource = John And this is rule that, to my opinion should've prohibited that two assignments get assigned to the same resource: rule only one assignment within interval for the same resource when $leftAssignment : Assignment($leftId : id, $interval : interval, resource != null, $resource : resource) $rightAssignment : Assignment(interval == $interval, resource == $resource, id != $leftId) then insertLogical(new IntConstraintOccurrence(only one assignment within interval for the same resource, ConstraintType.NEGATIVE_HARD, 1, $leftAssignment, $rightAssignment)); end The score looks like this: 2012-02-23 21:28:54,594 [main] DEBUG The hard score is: 0 and the soft score is: -532 So no hard constraints are broken according to planner. My question is not what is wrong with this particular example (unless it is obvious for you), but if you can think of any anti-pattern that would cause this behavior? What I already checked is: - this happens really sporadically (most of the time the result is CORRECT but in 1 from 5 runs I get this kind of error); - I checked, re-checked and re-re-checked all the hashCode, compareTo, solutionHashCode, solutionCompare, clone, ... methods - they appear to be correct; - moves are simple and I tried to keep them consistent with the way moves in drools-planner examples are constructed; Would be great if you could give me a hint to what direction I should look next. br Reinis ___ 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 -- With kind regards, Geoffrey De Smet
Re: [rules-users] Drools Planner: Vehicle routing problems
Hi Ge0ffrey, What do you mean by initial solution? The setPlanningProblem() aka the uninitialed solution or the solution after the construction heuristic (aka the initialized solution) I mean the initialised solution What's 109? Sorry, the number is just the number of milliseconds as returns by the new solution event Ok, if it's invalid here, it's invalid during the construction heuristic already. so at this point the solution is valid, its later steps where I get the problem At 127: D = Crew2 A = B = Crew1 B = A = B = Crew1 How is this possible? That means that B is pointing both to A and to Crew1 ? It's only a single pointer? VrpCustomer.getPreviousAppereance() Indeed this is my problem. There seems to be more than 1 instance of B. I've debugged my example code, and then issue seems to be: https://github.com/davidglassborow/drools-planner/blob/vehicle_routing/drools-planner-examples/src/main/java/org/drools/planner/examples/vehiclerouting/domain/Job.java#L33 The solver seems to be assigning the visit to be before itself ! If you look at: https://github.com/davidglassborow/drools-planner/blob/vehicle_routing/drools-planner-examples/src/main/java/org/drools/planner/examples/tsp/domain/Visit.java#L59 you'll see I have added a check to your Visit.java, which doesn't display the same problem. So I'm not sure what is happening, domain objects seems to be cloned and assigned to themselves. I have checked and double-checked the code inline with your TSP example, I'm sure it's nothing stupid I've done but can't for the life of me see anything wrong. If you download the branch, and run the VehicleRoutingHelloWorld class, you'll see the problem occuring. I hacked TSP to do multi TSP (see my google+ image), and it worked without a problem, so there must be a difference somewhere in your code. What did you need to change to get that to work ? Was it just a case of adding another domicile, and then removing the return to domicile cost rule ? Cheers for the help, Dave -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-routing-problems-tp3772797p3780139.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] Drools Planner: Vehicle routing problems
Op 27-02-12 10:46, davidglassborow schreef: Hi Ge0ffrey, What do you mean by initial solution? The setPlanningProblem() aka the uninitialed solution or the solution after the construction heuristic (aka the initialized solution) I mean the initialised solution What's 109? Sorry, the number is just the number of milliseconds as returns by the new solution event Ok, if it's invalid here, it's invalid during the construction heuristic already. so at this point the solution is valid, its later steps where I get the problem At 127: D = Crew2 A = B = Crew1 B = A = B = Crew1 How is this possible? That means that B is pointing both to A and to Crew1 ? It's only a single pointer? VrpCustomer.getPreviousAppereance() Indeed this is my problem. There seems to be more than 1 instance of B. I've debugged my example code, and then issue seems to be: https://github.com/davidglassborow/drools-planner/blob/vehicle_routing/drools-planner-examples/src/main/java/org/drools/planner/examples/vehiclerouting/domain/Job.java#L33 The solver seems to be assigning the visit to be before itself ! If you look at: https://github.com/davidglassborow/drools-planner/blob/vehicle_routing/drools-planner-examples/src/main/java/org/drools/planner/examples/tsp/domain/Visit.java#L59 you'll see I have added a check to your Visit.java, which doesn't display the same problem. So I'm not sure what is happening, domain objects seems to be cloned and assigned to themselves. Check your Solution's cloning method. If you clone the Visit, you need to make sure that planning variables of each cloned Visit are pointing to the new clones and not the original Visits. See my implementation in TSP. I have checked and double-checked the code inline with your TSP example, I'm sure it's nothing stupid I've done but can't for the life of me see anything wrong. If you download the branch, and run the VehicleRoutingHelloWorld class, you'll see the problem occuring. I hacked TSP to do multi TSP (see my google+ image), and it worked without a problem, so there must be a difference somewhere in your code. What did you need to change to get that to work ? Was it just a case of adding another domicile, and then removing the return to domicile cost rule ? Cheers for the help, Dave -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-routing-problems-tp3772797p3780139.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 -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] CLOUD mode Vs Stream Mode.
Hello, It's clair that to work with thae events we have to put our base configuration into STREAM mode like this: */KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(); config.setOption( EventProcessingOption.STREAM );/* But in my code bellow I didn't use this mode and I didn't use Entry-points, Although my events work very well !! Help please !! -- View this message in context: http://drools.46999.n3.nabble.com/CLOUD-mode-Vs-Stream-Mode-tp3780295p3780295.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] CLOUD mode Vs Stream Mode.
Hello, It's clair that to work with thae events we have to put our base configuration into STREAM mode like this: */KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(); config.setOption( EventProcessingOption.STREAM );/* But in an exemple, I didn't use this mode and I didn't use Entry-points, Although my events work very well !! Help please !! -- View this message in context: http://drools.46999.n3.nabble.com/CLOUD-mode-Vs-Stream-Mode-tp3780297p3780297.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] CLOUD mode Vs Stream Mode.
Hi, What exactly are you doing with events? I think that the temporal operators will work as expected. If you are working in cloud mode you will not have sliding windows, the concept of now and events lifecycle managements as stated in the docs. Cheers On Mon, Feb 27, 2012 at 10:51 AM, Hassan azbak...@gmail.com wrote: Hello, It's clair that to work with thae events we have to put our base configuration into STREAM mode like this: */KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(); config.setOption( EventProcessingOption.STREAM );/* But in my code bellow I didn't use this mode and I didn't use Entry-points, Although my events work very well !! Help please !! -- View this message in context: http://drools.46999.n3.nabble.com/CLOUD-mode-Vs-Stream-Mode-tp3780295p3780295.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 -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Planner: Vehicle routing problems
Geoffrey, Check your Solution's cloning method. If you clone the Visit, you need to make sure that planning variables of each cloned Visit are pointing to the new clones and not the original Visits. See my implementation in TSP. Sure, my clone method is virtually the same as your TSP one (my whole project was basically a copy of TSP): https://github.com/davidglassborow/drools-planner/blob/vehicle_routing/drools-planner-examples/src/main/java/org/drools/planner/examples/tsp/domain/TravelingSalesmanTour.java#L96 and https://github.com/davidglassborow/drools-planner/blob/vehicle_routing/drools-planner-examples/src/main/java/org/drools/planner/examples/vehiclerouting/domain/VehicleRouter.java#L41 Did you have to make any other changes to make multi TSP work ? Was it just a case of adding another domicile, and then removing the return to domicile cost rule ? Cheers, Dave -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-routing-problems-tp3772797p3780331.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] CLOUD mode Vs Stream Mode.
Hi salaboy , Thank for your reply, from the docs: */This mode does not impose any kind of additional requirements on facts. So for instance: There is no notion of time. No requirements clock synchronization. There is no requirement on event ordering. The engine looks at the events as an unnordered cloud against which the engine tries to match rules./* So the engine can not known if this event is after another, for exemple, Despite After work !! thanks ! -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-CLOUD-mode-Vs-Stream-Mode-tp3780299p3780337.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] POJO accessors method in Drools facts
Hi, i have some troubles to undestand how drools processes FACTS. I have a POJO class resulted from an UnMarshal jaxb processing like this: public MyClass { protected String className = Class1; public getClassName(){ return className; } public setClassName(String className){ this.className = className } } Now i have to compose a drl file with a rule like this: when $Class : MyClass() eval ($Class.getClassName() == Class1) then System.out.println(ok!!!); end This syntax doesn't rise errors BUT doesn't match the real name... no ok message are printed. when $Class : MyClass (getClassName() == Class1) then System.out.println(ok!!!); end This syntax raises me a null pointer exception!!! What's the right syntax? Can i use the accessor methods building drools facts? Thanks a lot! -- View this message in context: http://drools.46999.n3.nabble.com/POJO-accessors-method-in-Drools-facts-tp3780363p3780363.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] Drools Planner: Vehicle routing problems
Op 27-02-12 12:07, davidglassborow schreef: Geoffrey, Check your Solution's cloning method. If you clone the Visit, you need to make sure that planning variables of each cloned Visit are pointing to the new clones and not the original Visits. See my implementation in TSP. Sure, my clone method is virtually the same as your TSP one (my whole project was basically a copy of TSP): https://github.com/davidglassborow/drools-planner/blob/vehicle_routing/drools-planner-examples/src/main/java/org/drools/planner/examples/tsp/domain/TravelingSalesmanTour.java#L96 and https://github.com/davidglassborow/drools-planner/blob/vehicle_routing/drools-planner-examples/src/main/java/org/drools/planner/examples/vehiclerouting/domain/VehicleRouter.java#L41 Did you have to make any other changes to make multi TSP work ? Was it just a case of adding another domicile, and then removing the return to domicile cost rule ? Yep and fix the gui not to draw it. Cheers, Dave -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-routing-problems-tp3772797p3780331.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 -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools facts using POJO accessor methods error
Hi, i have some troubles to undestand how drools processes FACTS. I have a POJO class resulted from an UnMarshal jaxb processing like this: public MyClass { protected String className = Class1; public getClassName(){ return className; } public setClassName(String className){ this.className = className } } Now i have to compose a drl file with a rule like this: when $Class : MyClass() eval ($Class.getClassName() == Class1) then System.out.println(ok!!!); end This syntax doesn't rise errors BUT doesn't match the real name... no ok message are printed. when $Class : MyClass (getClassName() == Class1) then System.out.println(ok!!!); end This syntax raises me a null pointer exception!!! What's the right syntax? Can i use the accessor methods building drools facts? Thanks a lot! -- View this message in context: http://drools.46999.n3.nabble.com/Drools-facts-using-POJO-accessor-methods-error-tp3780387p3780387.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] POJO accessors method in Drools facts
Hi I think that yo have to instanciate the object and insert it into the working memory then you fire all rules like this : bMyClass x= new MyClass(); ksession.insert(x); ksession.fireAllRules();/b it will work without problem ! 2012/2/27 aliosha79 alex_orl1...@yahoo.it: Hi, i have some troubles to undestand how drools processes FACTS. I have a POJO class resulted from an UnMarshal jaxb processing like this: public MyClass { protected String className = Class1; public getClassName(){ return className; } public setClassName(String className){ this.className = className } } Now i have to compose a drl file with a rule like this: when $Class : MyClass() eval ($Class.getClassName() == Class1) then System.out.println(ok!!!); end This syntax doesn't rise errors BUT doesn't match the real name... no ok message are printed. when $Class : MyClass (getClassName() == Class1) then System.out.println(ok!!!); end This syntax raises me a null pointer exception!!! What's the right syntax? Can i use the accessor methods building drools facts? Thanks a lot! -- View this message in context: http://drools.46999.n3.nabble.com/POJO-accessors-method-in-Drools-facts-tp3780363p3780363.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 -- Youssef AZBAKH Elève ingénieur en 3ème année informatique. Institut National de Statiqtique et d'Economie Appliquée (INSEA). ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] CLOUD mode Vs Stream Mode.
All events have a timestamp. -W On 27/02/2012, Hassan azbak...@gmail.com wrote: Hi salaboy , Thank for your reply, from the docs: */This mode does not impose any kind of additional requirements on facts. So for instance: There is no notion of time. No requirements clock synchronization. There is no requirement on event ordering. The engine looks at the events as an unnordered cloud against which the engine tries to match rules./* So the engine can not known if this event is after another, for exemple, Despite After work !! thanks ! -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-CLOUD-mode-Vs-Stream-Mode-tp3780299p3780337.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] Drools facts using POJO accessor methods error
As soon as you use eval(), you are in Java-land where String comparisons should not be made using ==. There's nothing wrong with the second form, i.e., you can write (using Drools 5.3.0) MyClass (getClassName() == Class1) although the simpler form is usually preferred: MyClass( className == Class1 ) -W On 27/02/2012, aliosha79 alex_orl1...@yahoo.it wrote: Hi, i have some troubles to undestand how drools processes FACTS. I have a POJO class resulted from an UnMarshal jaxb processing like this: public MyClass { protected String className = Class1; public getClassName(){ return className; } public setClassName(String className){ this.className = className } } Now i have to compose a drl file with a rule like this: when $Class : MyClass() eval ($Class.getClassName() == Class1) then System.out.println(ok!!!); end This syntax doesn't rise errors BUT doesn't match the real name... no ok message are printed. when $Class : MyClass (getClassName() == Class1) then System.out.println(ok!!!); end This syntax raises me a null pointer exception!!! What's the right syntax? Can i use the accessor methods building drools facts? Thanks a lot! -- View this message in context: http://drools.46999.n3.nabble.com/Drools-facts-using-POJO-accessor-methods-error-tp3780387p3780387.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] CLOUD mode Vs Stream Mode.
If you are not using sliding windows and you are not expecting a retraction of your not relevant events, it will work. Cheers On Mon, Feb 27, 2012 at 12:06 PM, Wolfgang Laun wolfgang.l...@gmail.comwrote: All events have a timestamp. -W On 27/02/2012, Hassan azbak...@gmail.com wrote: Hi salaboy , Thank for your reply, from the docs: */This mode does not impose any kind of additional requirements on facts. So for instance: There is no notion of time. No requirements clock synchronization. There is no requirement on event ordering. The engine looks at the events as an unnordered cloud against which the engine tries to match rules./* So the engine can not known if this event is after another, for exemple, Despite After work !! thanks ! -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-CLOUD-mode-Vs-Stream-Mode-tp3780299p3780337.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 -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] AgendaFilter - filter rule based on package name
Thanks Laune, works Kevin -- View this message in context: http://drools.46999.n3.nabble.com/AgendaFilter-filter-rule-based-on-package-name-tp3772193p3780521.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] CLOUD mode Vs Stream Mode.
Hi, Exactly ! But when I want to test if the sliding windows work in both cases (with end without Stream Mode), It doesn't work !! for exemple: this is my rule rule sliding windows when $a : Event1() over window:time(2s) then System.out.println(ok); end these are mu events Event1 ev1=new Event1((long)1,(long)2); // the event will occur in 1s and finish in 3s Event1 ev2=new Event1((long)3,(long)4); // the event will occur in 3s and finish in 4s session.insert(ev1); session.insert(ev2); clock.advanceTime(4, TimeUnit.SECONDS); // we are nom in 4s so only event that happen in [2s,4s] have to fire -ev2-. session.fireAllRules(); // But the probleme that, it gives me 2 ok so the 2 object are fired !! I don't inderstand why ?? 2012/2/27 salaboy [via Drools] ml-node+s46999n3780514...@n3.nabble.com: If you are not using sliding windows and you are not expecting a retraction of your not relevant events, it will work. Cheers On Mon, Feb 27, 2012 at 12:06 PM, Wolfgang Laun [hidden email] wrote: All events have a timestamp. -W On 27/02/2012, Hassan [hidden email] wrote: Hi salaboy , Thank for your reply, from the docs: */This mode does not impose any kind of additional requirements on facts. So for instance: There is no notion of time. No requirements clock synchronization. There is no requirement on event ordering. The engine looks at the events as an unnordered cloud against which the engine tries to match rules./* So the engine can not known if this event is after another, for exemple, Despite After work !! thanks ! -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-CLOUD-mode-Vs-Stream-Mode-tp3780299p3780337.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/rules-users-CLOUD-mode-Vs-Stream-Mode-tp3780299p3780514.html To unsubscribe from [rules-users] CLOUD mode Vs Stream Mode., click here. NAML -- Youssef AZBAKH Elève ingénieur en 3ème année informatique. Institut National de Statiqtique et d'Economie Appliquée (INSEA). -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-CLOUD-mode-Vs-Stream-Mode-tp3780299p3780817.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] CLOUD mode Vs Stream Mode.
I wanna just rectify Event1 ev1=new Event1((long)1000,(long)2000); // occur in 1s and finishes in 2s Event1 ev2=new Event1((long)3000,(long)4000); // occur in 3s and finishes in 4s thanks :) -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-CLOUD-mode-Vs-Stream-Mode-tp3780299p3780882.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] jboss tohu
hi, can someone help me to deploy jboss tohi 1.2.0 into jboss 4.3.2 and eclipse indigo ? thx ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 5.4.0.Beta2 parse error in consequence /* in string
I had created issue JBRULES-3399 for the issue. I tracked it a bit , it is any comment. // or /* , think the lexar expression for comment isn't correct . I am working towards a fix but not a antlr expert. I have used yacc. On Mon, Feb 27, 2012 at 1:38 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: Submitted: JBRULES-3401. -W On 24/02/2012, Benjamin Bennett benbenn...@gmail.com wrote: Just passing on I am using the drools 5.4.0Beta2 The following doesn't compile using the mvel dialect . rule some rule when fact: Fact() then BasicFact fault= new BasicFact( /*); end but rule some rule when fact: Fact() then BasicFact fault= new BasicFact( / *); end does compile some how /* is being parsed as an expression I think and not a string literal. Thanks, Ben ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Sincerely, Benjamin Bennett 314.246.0645 benbenn...@gmail.com For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. Richard Feynman ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools facts using POJO accessor methods error
ok thanks a lot! -- View this message in context: http://drools.46999.n3.nabble.com/Drools-facts-using-POJO-accessor-methods-error-tp3780387p3781136.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] Drools facts using POJO accessor methods error
what would be the right syntax using the second form, if i wanted to use two rows? like the first one? Something like this? when $Class : MyClass() $Class(className() == Class1) ... ? thanks -- View this message in context: http://drools.46999.n3.nabble.com/Drools-facts-using-POJO-accessor-methods-error-tp3780387p3781353.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] A problem in sliding windows.
when I was testing the sliding windows, I was blocked becouse this concept doesn't work for me, It's becouse of my misunderstanding of the concept, I looking for the error which I do: for exemple: == the rule: */ rule sliding windows when $a : Event1() over window:time(2s) then System.out.println(ok); end /* == Events Event1 ev1=new Event1((long)1000,(long)2000); // the event will occur in 1s and finish in 3s Event1 ev2=new Event1((long)3000,(long)4000); // the event will occur in 3s and finish in 4s session.insert(ev1); session.insert(ev2); clock.advanceTime(4, TimeUnit.SECONDS); // we are now in 4s so only event that happen in [2s,4s] have session.fireAllRules(); // to fire -ev2-. // But the probleme that, it gives me 2 ok so the 2 object are fired !! I don't inderstand why ?? -- View this message in context: http://drools.46999.n3.nabble.com/A-problem-in-sliding-windows-tp3781402p3781402.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] Drools facts using POJO accessor methods error
I'm not sure what you're asking, but I'm you'll find the answer easily enough by reading the Expert documentation. -W On 27 February 2012 17:59, aliosha79 alex_orl1...@yahoo.it wrote: what would be the right syntax using the second form, if i wanted to use two rows? like the first one? Something like this? when $Class : MyClass() $Class(className() == Class1) ... ? thanks -- View this message in context: http://drools.46999.n3.nabble.com/Drools-facts-using-POJO-accessor-methods-error-tp3780387p3781353.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] Drools facts using POJO accessor methods error
Precisely i want to turn this form... when $Class : MyClass (className() == Class1) then System.out.println(ok!!!); end in this: when $Class : MyClass() ...($Class.className() == Class1) then System.out.println(ok!!!); end I need to declare the $Class variable separately... is it possible? regards -- View this message in context: http://drools.46999.n3.nabble.com/Drools-facts-using-POJO-accessor-methods-error-tp3780387p3781490.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] Drools facts using POJO accessor methods error
Now this is an interesting use case could you please provide more details on why you're trying to do such a thing? Are you working on some kind of translator/analyzer? Thanks Davide btw, taking constraints out of patterns does not seem the best way to use a RETE engine could you consider something like: when $Class : MyClass() MyClass( this == $Class, className == Class1 ) then ... or its equivalent, based on unification: when $Class := MyClass( ) $Class := MyClass( className == Class1 ) then -- View this message in context: http://drools.46999.n3.nabble.com/Drools-facts-using-POJO-accessor-methods-error-tp3780387p3781515.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] jboss tohu
Hi Olfa, Eclipse indigo is an authoring environment, there's no deployment there, you just need to install the drools plugin from the jboss tools (see docs), create a rule project and include the tohu jars/rule files in the classpath. Once you're ready with your application, you can generate e.g. a war and deploy it in a drools-server running on jbossAS (again, drools-integration docs should help). The Jboss tools should also include plugins to control jbossAS from eclipse, for the initial testing Best Davide btw, isnt' Jboss 4.3.2 a bit outdated? -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-jboss-tohu-tp3780983p3781552.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] Drools facts using POJO accessor methods error
my use case is: XmlDocument --- via JaxbUnmarshaller --- POJO java Document I m implementing a rule editor... This ruleeditor analyzes the xmldocument and graphically allows me to build rules by selecting the document xml tree node... of course i can just build several rules in this way... but for the field which the project is located in, it's sufficient. Now in those xml documents there could be sequences of elements which are turned into java list by Jaxb. The problem is: According to my xml nodes selection (ie the node is a list or not)... i have to be able to write the exact rule. In the rule structure i have to find the constant parts and the variable ones. For a normal node element a possible rule structure is: when $Class : MyClass( property == 123) then do somthing! end For a list instead: when $Class : MyClass ($list :listProperty) ...( this.ListItem.Quantity.Value ==123 ) from $list then do something! end So, i'm trying to find a common form with the minimum variable parts to be changed and to obtain a well written rule for both cases. -- View this message in context: http://drools.46999.n3.nabble.com/Drools-facts-using-POJO-accessor-methods-error-tp3780387p3781622.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] Drools facts using POJO accessor methods error
Maybe you would be better off leveraging Guvnor for the Rules Editing. Then you would just need to develop a hook that calls JAXB to take an XML Schema to a Pojo Object Model within the Guvnor system. Brad Davis Red Hat Consulting Email: bda...@redhat.com | c: 980.226.7865 | http://www.redhat.com - Original Message - From: aliosha79 alex_orl1...@yahoo.it To: rules-users@lists.jboss.org Sent: Monday, February 27, 2012 1:30:41 PM Subject: Re: [rules-users] Drools facts using POJO accessor methods error my use case is: XmlDocument --- via JaxbUnmarshaller --- POJO java Document I m implementing a rule editor... This ruleeditor analyzes the xmldocument and graphically allows me to build rules by selecting the document xml tree node... of course i can just build several rules in this way... but for the field which the project is located in, it's sufficient. Now in those xml documents there could be sequences of elements which are turned into java list by Jaxb. The problem is: According to my xml nodes selection (ie the node is a list or not)... i have to be able to write the exact rule. In the rule structure i have to find the constant parts and the variable ones. For a normal node element a possible rule structure is: when $Class : MyClass( property == 123) then do somthing! end For a list instead: when $Class : MyClass ($list :listProperty) ...( this.ListItem.Quantity.Value ==123 ) from $list then do something! end So, i'm trying to find a common form with the minimum variable parts to be changed and to obtain a well written rule for both cases. -- View this message in context: http://drools.46999.n3.nabble.com/Drools-facts-using-POJO-accessor-methods-error-tp3780387p3781622.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] jboss tohu
hi sir, thank you very much.for your help and your tip. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Constants
If you think of how RETE works, Globals serve as constants at runtime. If you need compile-time constants, you might consider rule templates instead Best Davide -- View this message in context: http://drools.46999.n3.nabble.com/Constants-tp3780878p3782094.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] [Drools Planner] Hard constraint appears to be ignored
Hello, I did all the suggestions from Geoffrey (thanks sir) and now the TRACE is failing with an additional rule: java.lang.IllegalStateException: The presumedScore (0hard/0soft) is corrupted because it is not the realScore (0hard/-1soft). Presumed workingMemory: Score rule (penalize late assignments) has count (11) and weight total (8). Score rule (reward Resource consolidation) has count (7) and weight total (7). Real workingMemory: Score rule (penalize late assignments) has count (11) and weight total (*7*). Score rule (reward Resource consolidation) has count (*8*) and weight total (*8*). The offending rules look like this: rule penalize late Assignments when $project : Project(kickOff != null, $kickOff : kickOff) $assignment : Assignment(project == $project) eval($assignment.getInterval().getStart().isAfter($kickOff)) then insertLogical(new IntConstraintOccurrence(penalize late assignments, ConstraintType.NEGATIVE_SOFT, new Duration($kickOff, $assignment.getInterval().getStart()).toStandardDays().getDays(), $assignment, $project)); end rule reward Resource consolidation when $leftAssignment : Assignment($project : project, $leftResource : resource != null, $leftId : id, $leftIntervalStartMillis : intervalStartMillis) $rightAssignment : Assignment(project == $project, resource == $leftResource, id != $leftId, intervalStartMillis= $leftIntervalStartMillis) eval(new Duration($leftAssignment.getIntervalStartMillis() - $rightAssignment.getIntervalStartMillis()).getStandardDays() == 0) then insertLogical(new IntConstraintOccurrence(reward Resource consolidation, ConstraintType.POSITIVE , 1, $leftAssignment, $rightAssignment)); end * If I comment the reward Resource consolidation rule out, the test case completes successfully. * Is there anything else I can try? br Reinis On 02/27/2012 09:46 AM, Geoffrey De Smet wrote: Op 26-02-12 19:47, Reinis schreef: Hello, 1) TRACE It did actually crash! Good :) java.lang.IllegalStateException: The presumedScore (0hard/-860soft) is corrupted because it is not the realScore (0hard/-858soft). It's not crashing on the hard constraint difference, but that probably means it doesn't get there yet. Presumed workingMemory: Score rule (reward Resource consolidation) has count (44) and weight total (44). Real workingMemory: Score rule (reward Resource consolidation) has count (46) and weight total (46). But the rule causing it looks normal to me: rule reward Resource consolidation when $leftAssignment : Assignment($project : project, $leftResource : resource != null, $leftId : id) $rightAssignment : Assignment(project == $project, resource == $leftResource, id != $leftId) eval(new Duration(Math.abs($leftAssignment.getInterval().getStartMillis() - $rightAssignment.getInterval().getStartMillis())).getStandardDays() == 0) Looks good to me. What you could do is make a Assignment.getIntervalStartMillis() and Assignment( ..., $leftStartMillis : intervalStartMillis) and add that rightAssignment's startMillis should be then leftAssignment's $leftStartMillis to avoid the Math.abs and double counting of this constraint. then insertLogical(new IntConstraintOccurrence(reward Resource consolidation, ConstraintType.POSITIVE , 1, $leftAssignment, $rightAssignment)); end 2) drools version and planner version drools-core-5.3.1.Final Can you try TRACE with drools-core, drools-compiler and knowledge-api 5.4.0.Beta2? There was a working memory corruption bug fixed in drools 5.4 over 5.3, not sure if it made 5.3.1. drools-planner-core-5.3.1.Final (No need to upgrade planner itself at this time - as that will force you down the UpgradeRecipe.txt). Thank you for the hints! Is the eval causing all this trouble? br Reinis On 02/26/2012 06:45 PM, Geoffrey De Smet wrote: 1) If you haven't already, can you turn onenvironmentModeTRACE/... and let it run a while (it will be much slower)? Report here if that crashes or not. 2) What drools version and what planner version are you using? Op 26-02-12 17:51, Reinis schreef: Hello, it appears that hard constraint I have defined is being ignored in some rare cases. Here's an example: This is what my application logs after getting best solution after solver has returned from solve(): 2012-02-23 21:28:54,595 [main] INFO Project Project1 assignment 563:[2012-02-27T13:00:00.000/2012-02-27T17:00:00.000] was assigned to John 2012-02-23 21:28:54,597 [main] INFO Project Project2 assignment 508:[2012-02-27T13:00:00.000/2012-02-27T17:00:00.000] was assigned to John (The log says that John was assigned twice in same time period to two different assignments (assignment 563 and assignment 508) Here short
Re: [rules-users] Constants
@Davide, there is *nothing* in Drools that is a full-fledged replacement for eitherr #define LIMIT 100 as in C, or const magic = 4711; as in Pascal, or..., or... Any modern programming language has this facility, and templates are no replacement, and globals still need Java code for their initialization prior to the insertion of any facts. @Richard Using some sort of parameter fact is another workaround, although this requires an additional CE in rules requiring such a constant. Also, a simple Java class containing just global final statics could alse easily (Java-)compiled and deployed with DRL packages importing these constants. (Besides, many constants are related to Java classes and that's where they ought to be declared anyway.) -W On 27/02/2012, Davide Sottara dso...@gmail.com wrote: If you think of how RETE works, Globals serve as constants at runtime. If you need compile-time constants, you might consider rule templates instead Best Davide -- View this message in context: http://drools.46999.n3.nabble.com/Constants-tp3780878p3782094.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] 5.4.0.Beta2 parse error in consequence /* in string
This is an MVEL issue, which doesn't have a lexer and doesn't use antlr. MVEL just picks up characters from a stream, trying to compact them into tokens, apparently according to some state, in highly brittle code. (I'm not slandering - the author's comment says so, too.) I cannot reproduce the bug using // (5.3.0). -W On 27/02/2012, Benjamin Bennett benbenn...@gmail.com wrote: I had created issue JBRULES-3399 for the issue. I tracked it a bit , it is any comment. // or /* , think the lexar expression for comment isn't correct . I am working towards a fix but not a antlr expert. I have used yacc. On Mon, Feb 27, 2012 at 1:38 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: Submitted: JBRULES-3401. -W On 24/02/2012, Benjamin Bennett benbenn...@gmail.com wrote: Just passing on I am using the drools 5.4.0Beta2 The following doesn't compile using the mvel dialect . rule some rule when fact: Fact() then BasicFact fault= new BasicFact( /*); end but rule some rule when fact: Fact() then BasicFact fault= new BasicFact( / *); end does compile some how /* is being parsed as an expression I think and not a string literal. Thanks, Ben ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Sincerely, Benjamin Bennett 314.246.0645 benbenn...@gmail.com For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. Richard Feynman ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 5.4.0.Beta2 parse error in consequence /* in string
On 27/02/2012 15:44, Benjamin Bennett wrote: I had created issue JBRULES-3399 for the issue. I tracked it a bit , it is any comment. // or /* , think the lexar expression for comment isn't correct . I am working towards a fix but not a antlr expert. I have used yacc. just a reminder to read this page, on how to correctly comment your commits, how to submit pull requests etc: http://www.athico.com/Getting_Involved/gettinginvolved.html Mark On Mon, Feb 27, 2012 at 1:38 AM, Wolfgang Laun wolfgang.l...@gmail.com mailto:wolfgang.l...@gmail.com wrote: Submitted: JBRULES-3401. -W On 24/02/2012, Benjamin Bennett benbenn...@gmail.com mailto:benbenn...@gmail.com wrote: Just passing on I am using the drools 5.4.0Beta2 The following doesn't compile using the mvel dialect . rule some rule when fact: Fact() then BasicFact fault= new BasicFact( /*); end but rule some rule when fact: Fact() then BasicFact fault= new BasicFact( / *); end does compile some how /* is being parsed as an expression I think and not a string literal. Thanks, Ben ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Sincerely, Benjamin Bennett 314.246.0645 benbenn...@gmail.com mailto:benbenn...@gmail.com For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. Richard Feynman ___ 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