[rules-users] Planner: Is it possible to know which move was selected on step-end?

Geoffrey De Smet ge0ffrey.spam at gmail.com
Fri Feb 22 04:31:35 EST 2013


Op 22-02-13 10:11, Michiel Vermandel schreef:
> Well,
>
> I need to solve - let's say - a complex 2 dimensional puzzle.
> The goal is to fill a 2D rectangle (with fixed dimensions) out of 
> "puzzle pieces" that do not have a fixed shape.
> A puzzle piece is built out of a number of bars of variable length and 
> the bars can slide against each other (to some extend: differs per 
> joint of two bars).
>
> Just shifting and swapping around the "puzzle pieces" is not quite 
> well performing since that will result in many
> violations although a shift or swap could match perfectly if you slide 
> (some of) the bars of the piece at the same time.
In one implementation we added an extra "score level", a subsoft level, 
to make the score function favor "defragmented" solutions (less small 
gaps between items).
This technique is proven to work out well. Too bad that 
HardMediumSoftScore and BendableScore aren't available in 5.5.0.Final 
yet: just copy paste one of them from master into your package structure.

>
> Feeding all possible combinations of shifts and swaps combined with 
> all possible forms of the pieces would result in ... well quite a lot 
> of combinations.
If you create them JIT enabled, that should be fine. Either combing 
existing moveSelectors with cartesianProduct, and make sure they are all 
selectionOrder RANDOM,
or use MoveIteratorFactory (as opposed to MoveListFactory)
> So I want to build a smarter mover that "knows" how to slide a piece 
> in order to fit it in an available place (or swap it with an other 
> piece to improve both pieces match).
> I think the mover would perform far better if I have a "bit-map" that 
> contains the 2D representation of the way everything is placed and 
> which could calculate the best layout of the piece before putting it 
> into the puzzle.
>
> Therefor I would like to know the last change applied so I can 
> incrementally update the bit-map instead of recalculating it entirely 
> every time.
Because doing it in the ScoreDirectory all the time is annoying, I see. 
Makes sense if you want to go this way.
>
> Hey, hmmm... maybe I don't need to know the last accepted move. Just 
> finding the diff between best-solution and previous best-solution 
> might do the trick?!
>
> For finding the best layout of a single piece, ?could I use a second 
> instance of planner that does a "normal" bin-packaging of a single 
> piece in the available container (container is then an available free 
> area or the combination of one or more other pieces and the free space 
> around that other piece)?
>
> Maybe I'm going goofy on this... too many long nights are beginning to 
> cloud my mind.
I seriously doubt this is the right path to go.
- It sounds like you're making everything far more complex than it needs 
to be. Re-examen your domain model. Compare it with the curriculum 
course domain model.
- Trying to guide what local search actually needs to select doesn't 
usually work out well. It often does more harm than good after the 1 
minute of running. If you go down this path, at least give local search 
multiple area's that you're focusing on.
- Given the dilemma, I would strongly prefer "cartesian moves" (= a 
single move that does 2 moves) over "let's see what move local search 
ended up taking and try to now select a companion move in that area". 
That second approach is pretty much doomed in my eyes.
>
> Well, any ideas are welcome.
>
> Regards.
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials
> ------------------------------------------------------------------------
> *From:* Geoffrey De Smet <ge0ffrey.spam at gmail.com>
> *To:* rules-users at lists.jboss.org
> *Sent:* Thursday, February 21, 2013 10:37 AM
> *Subject:* Re: [rules-users] Planner: Is it possible to know which 
> move was selected on step-end?
>
> Officially, in the public api (aka the "user facing api"), there's no 
> such listener.
> Why would you need this at runtime?
> Open an issue: if there's a good reason to need this, we can talk 
> about adding it to the public api.
> https://issues.jboss.org/browse/PLANNER
>
>
> That being said and handled first, the benchmarker actually hacks a 
> step listener if I recall correctly:
> https://github.com/droolsjbpm/drools-planner/tree/master/drools-planner-benchmark/src/main/java/org/drools/planner/benchmark/core/statistic/calculatecount
>
> Op 20-02-13 21:56, Michiel Vermandel schreef:
>> Hi,
>>
>> Is it possible to capture which move was selected on step-end?
>> I don't mean in the logging but by event or custom selector or... ?
>>
>> Thanks
>>
>> Michiel
>> -----------------
>> http://www.codessentials.com - Your essential software, for free!
>> Follow us at http://twitter.com/#!/Codessentials
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org  <mailto:rules-users at lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130222/8330b967/attachment-0001.html 


More information about the rules-users mailing list