tag:blogger.com,1999:blog-5869426.post8014722417833233797..comments2024-03-25T09:15:58.430+00:00Comments on Drools & jBPM: Chained: the trick behind solving TSP and VRP in Planner with minimal codeMark Proctorhttp://www.blogger.com/profile/03304277188725220501noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-5869426.post-43685974036726987052013-04-12T10:50:25.103+01:002013-04-12T10:50:25.103+01:00@Anonymous Read the quick start in the documentati...@Anonymous Read the quick start in the documentation:<br />http://docs.jboss.org/drools/release/6.0.0.Beta1/optaplanner-docs/html_single/index.htmlGeoffrey De Smethttps://www.blogger.com/profile/14668727421421215806noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-7323247909536903712013-04-12T09:53:17.513+01:002013-04-12T09:53:17.513+01:00Im new to drools planner.could you please teach me...Im new to drools planner.could you please teach me the work flow of tsp sample example in drools.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5869426.post-82479807602787858792012-03-29T07:47:41.304+01:002012-03-29T07:47:41.304+01:00@Chris Interesting use case :)
The JobSlot idea s...@Chris Interesting use case :)<br /><br />The JobSlot idea sounds like a good idea, presuming that it doesn't matter that a certain Job is executed twice (as they can start in parallel). I don't think you even need chaining in that implementation, as the JobSlots are naturally chained per Service. This will make the implementation simpler. Question is how will you score the same Job running on 2 Services at the same time?<br /><br />Another alternative is to look at real-time planning (see the chapter in the Planner manual): If a Job fails, you could create a PlanningFactChangeEvent, adding a restriction that that failed Job should not be scheduled on the Service it failed on. Then replanning will schedule the Job on another Service.Geoffrey De Smethttps://www.blogger.com/profile/14668727421421215806noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-22521335446324816852012-03-28T22:02:50.510+01:002012-03-28T22:02:50.510+01:00Geoffrey,
My model is a collection of Jobs with v...Geoffrey,<br /><br />My model is a collection of Jobs with varying priorities, durations and requirements. They will be processed by a heterogeneous pool of Services which request jobs from the collection (i.e. a pull behavior). My optimization problem is deciding which job to hand to a Service that asks, favoring jobs that are likely to succeed, favoring high-priority jobs, favoring jobs that are nearing deadline, favoring jobs that have been sitting in the pool a long time.<br /><br />My initial thought was to model the problem as one chain per Service. The chain is composed of JobEntry entities and each JobEntry holds one Job. I want to pre-compute the chains before the Services ask for better latency. Because Services can crash or otherwise behave unpredictably, I can't risk putting a Job in just one chain because the Service for that chain might never ask for a Job.<br /><br />In the end, I'm instead considering modeling the problem as an N x M grid of JobSlot entities where N is the number of Jobs and M is the number of Services. Then Job is the planning variable.Chris Dolanhttps://www.blogger.com/profile/09832193193198230518noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-8580555070903113542012-03-28T19:08:56.628+01:002012-03-28T19:08:56.628+01:00@Chris no, not if you only use 1 @PlanningVariable...@Chris no, not if you only use 1 @PlanningVariable.<br />An entity with a @PlanningVariable(chained = true) cannot exist in more than one chain for that variable.<br /><br />How do you see your domain model?<br />For example: the class Visit has a method getPreviousAppearance() which returns a single Appearance instance, which is either another Visit or a Domicile instance. If a Visit can be assigned to multiple chains, then of what type would your getter of your @PlanningVariable be?<br /><br />Using multiple @PlanningVariable(chained = true) works (although test coverage is still low for it). So you could create Visit.getPreviousAppearance1() and .getPreviousAppearance2().Geoffrey De Smethttps://www.blogger.com/profile/14668727421421215806noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-57752285065077541832012-03-28T16:17:57.307+01:002012-03-28T16:17:57.307+01:00Can an entity exist in more than one chain?
In my...Can an entity exist in more than one chain?<br /><br />In my current problem, I want to put a work item into one or more queues and whichever queue gets to the item first does the work. (My rules prevent the work items from being placed in incompatible queues but sometimes I don't care which queue performs the work)Chris Dolanhttps://www.blogger.com/profile/09832193193198230518noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-36513336063450087942012-03-04T13:06:52.116+00:002012-03-04T13:06:52.116+00:00@triceo Good point. As was your suggestion to call...@triceo Good point. As was your suggestion to call it simply "chained" instead of "triggerChainingCorrection" :)<br />Not sure how to re-phrase it. Got any suggestion? Would stating "A chain is not a tree, it is a line" be less falsely implying that a tree cannot be a line?Geoffrey De Smethttps://www.blogger.com/profile/14668727421421215806noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-41980481261887225122012-03-03T20:03:11.674+00:002012-03-03T20:03:11.674+00:00"A chain is never a tree, it is always a line..."A chain is never a tree, it is always a line."<br /><br />Technically, a "line" is also a tree - you may want to re-phrase that sentence.Anonymousnoreply@blogger.com