Re: [rules-users] How to create a drl file or decision table dynamically?
Hi Michael, Thank you for your reply~ Now, I understand some mechanism of building dynamic class. Back to my question, if I understand correct, those methods you mentioned is to add a drl file(exist) to the knowledgeBase dynamically, right? But how about the file? I mean if I need to write Condition 1 AND Condition 2 OR Condition 3 into the file, does drool have API to do it. Because the content that I write into the file is also dynamic. What I really want to do is how to make the drl file exist first? Does it mean I have to create the file myself, and after finished creation I can add it dynamically? -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3776811.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] How to create a drl file or decision table dynamically?
You don't need a file, you need a String (not to say you couldn't use a File if you really, really wanted - just that you don't have to). Other than the Fluent API already mentioned there is no Drools API to construct a DRL String. Read the manual, understand *your* data and build DRL applicable. I get the feeling you don't know what DRL actually is nor how to use Drools to any extent. Please do read the excellent documentation I am sure things will become clearer to you. sent on the move On 26 Feb 2012 11:37, shawn youngxiao...@hotmail.com wrote: Hi Michael, Thank you for your reply~ Now, I understand some mechanism of building dynamic class. Back to my question, if I understand correct, those methods you mentioned is to add a drl file(exist) to the knowledgeBase dynamically, right? But how about the file? I mean if I need to write Condition 1 AND Condition 2 OR Condition 3 into the file, does drool have API to do it. Because the content that I write into the file is also dynamic. What I really want to do is how to make the drl file exist first? Does it mean I have to create the file myself, and after finished creation I can add it dynamically? -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3776811.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 create a drl file or decision table dynamically?
Thank you ~ I will learn the documentation more. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3777002.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] How to create a drl file or decision table dynamically?
Sorry, I forget to mention one thing. What's really difficult for me is to translate the AND,OR(Condition 1 AND Condition 2 OR Condition 3) to the drool. Because someone will send the request with the expression(Condition 1 AND Condition 2 OR Condition 3) to me. For each request the expression is different. They hope I can translate the AND,OR to rule file automatically. They don't want drool to parse the expression(maybe string) to pick AND, OR. This is why they want to have a rule file for each request. They want to trigger the function to make a rule file when they are making the expression, not only simply send me the expression and verify it.. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3777057.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] [Drools Planner] Hard constraint appears to be ignored
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
Re: [rules-users] How to create a drl file or decision table dynamically?
A (dynamic) request with a logical expression that is to be evaluated as a rule is very much like a (dynamic) SQL query to be evaluated on a database. Are you sure that Drools is the right platform? If someone wants to send a logical expression in a formal language of their own, you'll have to parse that expression and translate it into the Drools Rule Language (aka DRL). Perhaps a Domain Specific Language might help, but there's no telling from the very sparse information you've provided. (In any case someone and Drools will have to agree on the data model and the way to refer to the data, or else you'll have to do more work.) -W On 26 February 2012 16:00, shawn youngxiao...@hotmail.com wrote: Sorry, I forget to mention one thing. What's really difficult for me is to translate the AND,OR(Condition 1 AND Condition 2 OR Condition 3) to the drool. Because someone will send the request with the expression(Condition 1 AND Condition 2 OR Condition 3) to me. For each request the expression is different. They hope I can translate the AND,OR to rule file automatically. They don't want drool to parse the expression(maybe string) to pick AND, OR. This is why they want to have a rule file for each request. They want to trigger the function to make a rule file when they are making the expression, not only simply send me the expression and verify it.. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3777057.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] Loading rules performance problem in 5.4.0.Beta2 compare to 5.0.1
Appreciate for the useful info, Mark. -- View this message in context: http://drools.46999.n3.nabble.com/Loading-rules-performance-problem-in-5-4-0-Beta2-compare-to-5-0-1-tp3768609p3777289.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
Hi David, Op 24-02-12 16:26, davidglassborow schreef: Some more details on my problem: Here is an example of a vehicle routing solution, 2 crews and 4 Jobs A, B, C and D. The print out below is the solver and solutions found at each step (it prints out each chain of jobs) As you can see the initial solution is valid. What do you mean by initial solution? The setPlanningProblem() aka the uninitialed solution or the solution after the construction heuristic (aka the initialized solution) The next and last solutions are invalid though, with the same job appearing more than once in a chain. At 109: What's 109? B = Crew1 D = Crew2 A = B = Crew1 C = A = B = Crew1 2012-02-24 15:20:39,160 [main] DEBUG Step index (3), time spend (110), score (0hard/-17soft), initialized planning entity (Job D ( linked to Crew Crew2)). Ok, if it's invalid here, it's invalid during the construction heuristic already. 2012-02-24 15:20:39,160 [main] INFO Phase construction heuristic ended: step total (4), time spend (110), best score (0hard/-17soft). 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() C = A = B = Crew1 2012-02-24 15:20:39,177 [main] DEBUG Step index (0), time spend (127), score (0hard/-15soft), new best score (0hard/-15soft), accepted move size (18) for picked step (Job B ( linked to Crew Crew1) = Job A ( linked to Job B)). 2012-02-24 15:20:39,191 [main] DEBUG Step index (1), time spend (141), score (0hard/-15soft), best score (0hard/-15soft), accepted move size (14) for picked step (Job D ( linked to Crew Crew2) = Crew1). 2012-02-24 15:20:39,206 [main] DEBUG Step index (2), time spend (156), score (0hard/-16soft), best score (0hard/-15soft), accepted move size (10) for picked step (Job C ( linked to Job A) = Job B ( linked to Job A)). 2012-02-24 15:20:39,223 [main] DEBUG Step index (3), time spend (173), score (0hard/-16soft), best score (0hard/-15soft), accepted move size (5) for picked step (Job A ( linked to Job B) = Job B ( linked to Job A)). 2012-02-24 15:20:39,239 [main] WARN Cancelled step index (4), time spend (189): there is no doable move. Terminating phase early. 2012-02-24 15:20:39,239 [main] INFO Phase local search ended: step total (4), time spend (189), best score (0hard/-15soft). 2012-02-24 15:20:39,239 [main] INFO Solving ended: time spend (189), best score (0hard/-15soft), average calculate count per second (1089). Best: D = Crew2 A = B = Crew1 C = A = B = Crew1 B = A = B = B = Crew1 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. I am working on a vehicle routing example next, you might want to compare code with that one as soon as it's done. -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-routing-problems-tp3772797p3772841.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
Re: [rules-users] [Drools Planner] Hard constraint appears to be ignored
1) If you haven't already, can you turn on environmentModeTRACE/... 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 -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to create a drl file or decision table dynamically?
Thank your for your reply~ I am developing the Identity and Access management. I have finished the basic requirement, but the pre-condition part is what I am doing. The website sends the pre-condition(like what IP address or the time period can user access) that user sets. The pre-conditions are what I mentioned (expression). The difficulty is one expression may consist of several pre-conditions and every condition may be related to different rules. So here is the problem, how to verify users' authorization based on the expression which contains many operators(AND, OR). The number of AND, OR in the expression are set by users. This is why I thought to create a rule file for each expression when the expression is created. In this case, I won't bother how many AND, OR a expression contains. By the way, I also thought about parsing the expression in Java, then inserting every single condition into working memory. But it seems Drool can not be fully used in this way. Because it only looks like a if-else block Do you have any other solution for this requirement? Cheers -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3777389.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] How to create a drl file or decision table dynamically?
Thank your for your reply~ I am developing the Identity and Access management. I have finished the basic requirement, but the pre-condition part is what I am doing. The website sends the pre-condition(like what IP address or the time period can user access) that user sets. The pre-conditions are what I mentioned (expression). The difficulty is one expression may consist of several pre-conditions and every condition may be related to different rules. So here is the problem, how to verify users' authorization based on the expression which contains many operators(AND, OR). The number of AND, OR in the expression are set by users. This is why I thought to create a rule file for each expression when the expression is created. In this case, I won't bother how many AND, OR a expression contains. By the way, I also thought about parsing the expression in Java, then inserting every single condition into working memory. But it seems Drool can not be fully used in this way. Because it only looks like a if-else block Do you have any other solution for this requirement? Cheers laune wrote A (dynamic) request with a logical expression that is to be evaluated as a rule is very much like a (dynamic) SQL query to be evaluated on a database. Are you sure that Drools is the right platform? If someone wants to send a logical expression in a formal language of their own, you'll have to parse that expression and translate it into the Drools Rule Language (aka DRL). Perhaps a Domain Specific Language might help, but there's no telling from the very sparse information you've provided. (In any case someone and Drools will have to agree on the data model and the way to refer to the data, or else you'll have to do more work.) -W On 26 February 2012 16:00, shawn lt;youngxiao121@gt; wrote: Sorry, I forget to mention one thing. What's really difficult for me is to translate the AND,OR(Condition 1 AND Condition 2 OR Condition 3) to the drool. Because someone will send the request with the expression(Condition 1 AND Condition 2 OR Condition 3) to me. For each request the expression is different. They hope I can translate the AND,OR to rule file automatically. They don't want drool to parse the expression(maybe string) to pick AND, OR. This is why they want to have a rule file for each request. They want to trigger the function to make a rule file when they are making the expression, not only simply send me the expression and verify it.. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3777057.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@.jboss https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@.jboss https://lists.jboss.org/mailman/listinfo/rules-users -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3777398.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, 1) TRACE It did actually crash! java.lang.IllegalStateException: The presumedScore (0hard/-860soft) is corrupted because it is not the realScore (0hard/-858soft). 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) 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 drools-planner-core-5.3.1.Final 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
[rules-users] Deadline Approaching - ACM DEBS 2012
* Apologize for multiple posting - Submission Deadline March 5th * = DEBS2012 6th ACM International Conference on Distributed Event-Based Systems July 16-20, 2012 Freie Universitaet Berlin, Berlin, Germany http://www.csw.inf.fu-berlin.de/debs2012 = The objectives of the 6th ACM International Conference on Distributed Event-Based Systems (DEBS) are to provide a forum dedicated to the dissemination of original research, the discussion of practical insights, and the reporting of relevant experience relating to event-based computing that was previously scattered across several scientific and professional communities. The conference also aims at providing a forum for academia and industry to exchange ideas, for example, through industry papers and demo papers. DEBS 2012 Tracks The conference will consist of the following tracks: - Research track featuring high quality research paper on relevant topics. - Industry track with two sub-tracks: industry full papers and industry experience reports. - Tutorials geared towards either the research or the industrial communities. - Demos and posters. - The DEBS 2012 Grand Challenge is a problem solving competition for commercial and research event-based systems. - Gong show: The gong show will consist of short presentations about visionary and outrageous ideas towards the next generation of event-based systems. The audience will vote for the best idea. - Doctoral workshop Important Dates === - Research, Industry and Tutorial papers submission, and (optional) Industry experience report submission: March 5, 2012 - Grand Challenge problem description: March 7, 2012 - Author notification for tutorials, research and Industry papers, and Industry experience reports: April 30, 2012 - Poster and demo submission: May 2, 2012 - Grand Challenge Solutions including 4 page papers: May 2, 2012 - Doctoral Workshop submission: May 2, 2012 - Grand Challenge abstracts: May 2, 2012 - Author notification for poster, demo, Challenge, PhD papers: May 16, 2012 - Conference: July 16-20, 2012 Paper Submission === Submissions will be accepted in the following tracks: Research track; Industry track; Tutorials Track; Demos Posters; Grand Challenge; Doctoral Workshop. All submissions must be original and unpublished. Accepted papers will be published by ACM and disseminated through the ACM Digital Library. More information about the tracks and submission information can be found on the DEBS 2012 website: http://www.csw.inf.fu-berlin.de/debs2012/calls.html Scope of the Conference === The topics addressed by the conference include (but are not limited to): Models, Architectures and Paradigms - Event-driven architectures - Basic interaction models - Event algebras, event schemas and type systems - Languages for event correlation and patterns, streaming and continuous queries, data fusion - Models for static and dynamic environments - Complex event processing - Design and programming methodologies - Event-based business process management and modeling - Experimental methodologies - Performance modeling and prediction based on analytic approaches - Functional Reactive Programming Middleware Infrastructures for Event-Based Computing - Federated event-based systems - Middleware for actuator and sensor networks - Algorithms and protocols - Optimization techniques for event-based (or streaming) systems - Event dissemination based on p2p systems - Context and location awareness - Fault-tolerance, reliability, availability, and recovery - Security issues - (Self-)Management - Mobility and resource constrained device support - Streaming queries, transformations, or correlation engines - Logic-based event processing - Semantic event processing - Business Process Management with events Applications, Experiences, and Requirements - Use cases and applications of event-based systems - Real-world application deployments using event-based middleware - Domain-specific deployments of event-based systems - Real-world data characterizing event-based applications - Benchmarks, performance evaluations, and testbeds - Application requirements for next-generation event-based solutions - Relation to other architectures - Enterprise application integration - Event-driven business process management - Information logistics - Seamless integration of event-based mechanisms into middleware platforms -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools (Planner) getting confused between list and map access
I am trying to find the total of an attribute of`SubjectTeacherPeriod`. The `numAttributeMap`property (a map with `String` keys and `int` values) stores the value. But trying to access it is problematic as Drools thinks that `$num_value[$attribute]` is a list operation, not a map operation. I listed my rule and runtime errors: rule insertAttributeDayTotal //salience 1 // Do these rules first (optional, for performance) when $sum_regression_constraint : SumRegressionConstraint( $class : class_, $attribute : attribute//, //$weight : weight; ) $day_of_week : DayOfWeek() $attribute_day_total : Number() from accumulate( SubjectTeacherPeriod( //period != null, period.class_ == $class, period.dayOfWeek == $day_of_week, $num_value : numAttributeMap //$total : num_attribute_map.get($attribute) ), sum($num_value[$attribute]) //PROBLEM LINE?? ) then //System.out.println(BUCKET TOTAL +$id+ +$bucket_total.intValue()); insertLogical(new AttributeDaySum($class, $attribute, $day_of_week, $attribute_day_total.intValue())); end *Errors:* jesvin@Jesvin-Technovia:~/dev/drools/timetabler$ java -server in.co.technovia.timetabler.TimeTableApp Exception in thread main java.lang.IllegalStateException: There are errors in the scoreDrl's: Rule Compilation error : [Rule name='insertAttributeDayTotal'] in/co/technovia/timetabler/domain/Rule_insertAttributeDayTotal_fd3f7d4f98084049887c1596f5a56805.java (9:1093) : The type of the expression must be an array type but it resolved to Map in/co/technovia/timetabler/domain/Rule_insertAttributeDayTotal_fd3f7d4f98084049887c1596f5a56805.java (9:1104) : Type mismatch: cannot convert from String to int at org.drools.planner.config.solver.SolverConfig.buildRuleBase(SolverConfig.java:238) at org.drools.planner.config.solver.SolverConfig.buildSolver(SolverConfig.java:170) at org.drools.planner.config.XmlSolverConfigurer.buildSolver(XmlSolverConfigurer.java:103) at in.co.technovia.timetabler.TimeTableApp.createSolver(TimeTableApp.java:55) at in.co.technovia.timetabler.TimeTableApp.main(TimeTableApp.java:39) -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-getting-confused-between-list-and-map-access-tp3779757p3779757.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] 5.4.0.Beta2 parse error in consequence /* in string
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