[rules-users] Drools Planner: what if possible values of a PlanningVariable are dependent of another one?

dBijkoo bijkerkrick at hotmail.com
Fri May 9 05:20:52 EDT 2014


ge0ffrey wrote
> On 08-05-14 14:38, dBijkoo wrote:
>> ge0ffrey wrote
>>> In OptaPlanner's architecture current philosophy, this is not legal:
>>> a value range should be stable for each variable (of each entity) during
>>> solving.
>>> This not guaranteed to work (and it is guaranteed not to work if you do
>>> phase caching of moves:
>>> it will invalidly exclude part of the search space).
>> So if I understand you correctly phase caching moves is the way to go?
> No
> Phase caching moves is definitely NOT the way to go :)
> Phase caching means it caches as moves at the beginning of the solver
> phase.
> So as some variables change value in steps, the possible move set doesn't.

Ah yes I see, misread it.


ge0ffrey wrote
> Anyway, what is the recommended solution?
> Not sure.
> 
> A) Either just allow all combinations, that will work.
> 
> B) Or try
> @Entity class Observation {
>    @Variable block;
> }
> @Entity class Block {
>     @Variable("periodRange) period;
>     @VariableProvider("periodRange") getPeriodRange();
> }
> 
> Not sure if this matches for your case - multiple Observations might 
> share the same Block for a different period...
> 
> This is allowed - (it's called ValueRange from planning entity) and more 
> deeply supported (although it does have a few limits too).
> 
> C) Or try
> 
> class BlockPeriod {
>     Block;
>     Period;
> }
> @Entity class Observation {
>      @Variable BlockPeriod;
> }
> 
> Hmm. I like alternative C!

I thought of option B myself aswell, a valid solution (since multiple
Observations should be using the same block) but couldnt get it working.
>From what I understand it should be used like this:

@ValueRange(type = ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY)

But the only time I have seen the above used was in a version 5.5 or lower
(I'm using 6.0.1.Final) and my optaplanner-core dependency can't find
@ValueRange annotation.

I however did notice use of something similiar in the 6.0.1 documentation
(http://docs.jboss.org/drools/release/6.0.1.Final/optaplanner-docs/html_single/index.html#d0e2678)
look for "4.3.5.2.2. ValueRangeProvider on a planning entity". But can't
seem to find the code for this in the 6.0.1.Final code example.

So basically my question comes down to how do i use "ValueRange from
planning entity" I tried searching for it but couldn't find it anywehere
except on version 5.5 or below as describer above.



--
View this message in context: http://drools.46999.n3.nabble.com/rules-users-Drools-Planner-what-if-possible-values-of-a-PlanningVariable-are-dependent-of-another-on-tp4021175p4029492.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list