Creating selection filter for PlanningEntity with 4 planning variables

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating selection filter for PlanningEntity with 4 planning variables

maciekpob
Hi all,

Does anybody know how to create selectionfilter for PlanningEntity with many PlanningVariables?


Thanks,
Maciek
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Creating selection filter for PlanningEntity with 4 planning variables

ge0ffrey
Administrator
What do you wish to filter? Entites, values or moves?

Don't see how the number of planning variables on the entity makes a
difference.
http://docs.jboss.org/drools/release/latest/optaplanner-docs/html_single/index.html#filteredSelection


On 31-10-13 16:52, maciekpob wrote:

> Hi all,
>
> Does anybody know how to create selectionfilter for PlanningEntity with many
> PlanningVariables?
>
>
> Thanks,
> Maciek
>
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Creating-selection-filter-for-PlanningEntity-with-4-planning-variables-tp4026575.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
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Creating selection filter for PlanningEntity with 4 planning variables

maciekpob
I'd like to filter out planning values that are incoherent between each other.
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Creating selection filter for PlanningEntity with 4 planning variables

ge0ffrey
Administrator
Can you give an example?

This sounds like just another hard constraint.

On 04-11-13 12:27, maciekpob wrote:

> I'd like to filter out planning values that are incoherent between each
> other.
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Creating-selection-filter-for-PlanningEntity-with-4-planning-variables-tp4026575p4026618.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
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Creating selection filter for PlanningEntity with 4 planning variables

maciekpob
We are developing an application whose PlanningEntity has multiple planning variables, in fact 4.  There are some moves that we do not want to select. To ensure that the values proposed (moves) for the 4 different variables do not break a constraint (between them).  We wanted to filter out inacceptable move configurations instead of using the score function to check the constraints.

We studied the MoveSelector and SelectorFilter APIs and we implemented a ChangeMove SelectionFilter as an UnionMoveSelector of ChangeMoves of the four variables.   The SelectionFilter is written to accept or refuse the values (of the 4 variables) proposed.

 

However we encounter problems:

-          The same ChangeMove (with same values of the 4 variables)  are proposed in consecutive moves and hence invocations of SelectionFilter

-          The SelectionFilter rejects the values since it breaks constraints

Then the we get a warning : “Bailing out of neverEnding selector ({}) to avoid infinite loop”.

 

Hence we have been unable to implement the SelectionFilter for our purposes.

Could you advise us?

Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Creating selection filter for PlanningEntity with 4 planning variables

ge0ffrey
Administrator

On 07-11-13 16:21, maciekpob wrote:

> We are developing an application whose PlanningEntity has multiple planning
> variables, in fact 4.  There are some moves that we do not want to select.
> To ensure that the values proposed (moves) for the 4 different variables do
> not break a constraint (between them).  We wanted to filter out inacceptable
> move configurations instead of using the score function to check the
> constraints.
>
> We studied the MoveSelector and SelectorFilter APIs and we implemented a
> ChangeMove SelectionFilter as an UnionMoveSelector of ChangeMoves of the
> four variables.   The SelectionFilter is written to accept or refuse the
> values (of the 4 variables) proposed.
>
>  
>
> However we encounter problems:
>
> -          The same ChangeMove (with same values of the 4 variables)  are
> proposed in consecutive moves and hence invocations of SelectionFilter
A) First, see what happens if you put on the unionMoveSelector
cacheType=PHASE (or STEP).
By using a cacheType != JIT you guarantee that the same ChangeMove
cannot be selected twice.

I would expect you to go out of memory in that case.
If that's not the case - then see C).

B) Next, see what happens if you put the cacheType=PHASE (or STEP) on
every changeMove, but not in unionMoveSelector.
This probably fixes the problem and might be your favorite way to do things.
But I want to know why you're getting the bailout, so do figure that out
and reply :)
>
> -          The SelectionFilter rejects the values since it breaks
> constraints
>
> Then the we get a warning : “Bailing out of neverEnding selector ({}) to
> avoid infinite loop”.
C) Bailout is normally almost impossible to occur. Let me explain bailout.
Bailout only applies with filtering for cacheType=JIT, because JIT
selectors are neverEnding.
Bailout happens if it's has selected (size * 10) moves (so if there are
1 million possible moves, it must have selected 10 million moves)
AND not a single one of them was accepted by the filter.

Given the fact that it keeps selecting the same move - and that move is
not accepted, that might explain this though.
So the real question is why does it keep selecting the same move? Is
there only 1 move?


PS: what version are you using?
I remember fixing a bailout related problem in one of the CR's. Make
sure you're using 6.0.0.CR5 or higher.
>  
>
> Hence we have been unable to implement the SelectionFilter for our purposes.
>
> Could you advise us?



>
>
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Creating-selection-filter-for-PlanningEntity-with-4-planning-variables-tp4026575p4026679.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
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Creating selection filter for PlanningEntity with 4 planning variables

maciekpob
Hello again,

o) I completed the changes that you suggested last year concerning the issue that I am encountering with opta planner with our application.
 
   Note that I have at most one or two planning entities in the Solution (in my test case).

   Setting "cacheType=PHASE on UnionMoveSelector level" or "cacheType=STEP on UnionMoveSelector level" results in:

   java.lang.IllegalStateException: The selector (Union([ChangeMoveSelector(Filtering(FromSolutionEntitySelector(CloudPlacement)), FromSolutionPropertyValueSelector(offeredCPU)), ChangeMoveSelector(FromSolutionEntitySelector(CloudPlacement), FromSolutionPropertyValueSelector(offeredDisk)), ChangeMoveSelector(FromSolutionEntitySelector(CloudPlacement), FromSolutionPropertyValueSelector(offeredMemory)), ChangeMoveSelector(FromSolutionEntitySelector(CloudPlacement), FromSolutionPropertyValueSelector(offeredVolume))]))'s non-last childMoveSelector (ChangeMoveSelector(Filtering(FromSolutionEntitySelector(CloudPlacement)), FromSolutionPropertyValueSelector(offeredCPU))) has neverEnding (true) with randomSelection (false).

   Setting cacheType=PHASE for each change move selector results in:

Caused by: java.lang.IllegalStateException: The selector (Caching(ChangeMoveSelector(Filtering(FromSolutionEntitySelector(CloudPlacement)), FromSolutionPropertyValueSelector(offeredCPU)))) has a childMoveSelector (ChangeMoveSelector(Filtering(FromSolutionEntitySelector(CloudPlacement)), FromSolutionPropertyValueSelector(offeredCPU))) with neverEnding (true).

o) Number of moves:

   I obtained the number of evaluated moves from solver and I obtain a number above 7 000 000.

   I also added logs to the MoveFilter that I implement. Different values are being proposed.

 
   But, the MoveFilter is repeatedly invoked (20 times) with the same set of planning values.

   Since this set broke constraints the MoveFilter returns false each time.

   Then "bailing out error" occurs:

               

o) Change Move Filter configuration

   My planning entity CloudPlacement has four planning variables as indicated in the included config file.

   I tried the modifications you suggested over this basic version.

   Could you please check that the configuration is correct?2014.03.14_Config_file.xml

 

Regards

Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Creating selection filter for PlanningEntity with 4 planning variables

ge0ffrey
Administrator

On 18-03-14 11:24, maciekpob wrote:

> Hello again,
>
> o) I completed the changes that you suggested last year concerning the issue
> that I am encountering with opta planner with our application.
>  
>     Note that I have at most one or two planning entities in the Solution (in
> my test case).
>
>     Setting "cacheType=PHASE on UnionMoveSelector level" or "cacheType=STEP
> on UnionMoveSelector level" results in:
>
>     java.lang.IllegalStateException: The selector
> (Union([ChangeMoveSelector(Filtering(FromSolutionEntitySelector(CloudPlacement)),
> FromSolutionPropertyValueSelector(offeredCPU)),
> ChangeMoveSelector(FromSolutionEntitySelector(CloudPlacement),
> FromSolutionPropertyValueSelector(offeredDisk)),
> ChangeMoveSelector(FromSolutionEntitySelector(CloudPlacement),
> FromSolutionPropertyValueSelector(offeredMemory)),
> ChangeMoveSelector(FromSolutionEntitySelector(CloudPlacement),
> FromSolutionPropertyValueSelector(offeredVolume))]))'s non-last
> childMoveSelector
> (ChangeMoveSelector(Filtering(FromSolutionEntitySelector(CloudPlacement)),
> FromSolutionPropertyValueSelector(offeredCPU))) has neverEnding (true) with
> randomSelection (false).
So the union needs to do "original" selection, but one of his childs is
neverEndering.
That's never  a good thing.
>
>     Setting cacheType=PHASE for each change move selector results in:
>
> Caused by: java.lang.IllegalStateException: The selector
> (Caching(ChangeMoveSelector(Filtering(FromSolutionEntitySelector(CloudPlacement)),
> FromSolutionPropertyValueSelector(offeredCPU))))
that's the caching PHASE one wrapping the child.
>   has a childMoveSelector
> (ChangeMoveSelector(Filtering(FromSolutionEntitySelector(CloudPlacement)),
> FromSolutionPropertyValueSelector(offeredCPU))) with neverEnding (true).
Hmm, why is this child neverEnding?
Is the entitySelector or valueSelector explicitly set to selectionOrder
RANDOM?

This would make no sense:
<changeMoveSelector>
<cacheType>PHASE</cacheType>
    <valueSelector>
        <selectionOrder>RANDOM</selectionOrder><!-- What's the point of
making it RANDOM if it's wrapped in a move cacheType PHASE? -->
        ...
    </valueSelector>
</changeMoveSelector>


this would make more sense to shuffle on the phase level:

<changeMoveSelector>
<cacheType>PHASE</cacheType>
    <selectionOrder>SHUFFLED</selectionOrder>
    <valueSelector>
        ...
    </valueSelector>
</changeMoveSelector>

>
> o) Number of moves:
>
>     I obtained the number of evaluated moves from solver and I obtain a
> number above 7 000 000.
>
>     I also added logs to the MoveFilter that I implement. Different values
> are being proposed.
>
>  
>     But, the MoveFilter is repeatedly invoked (20 times) with the same set of
> planning values.
>
>     Since this set broke constraints the MoveFilter returns false each time.
>
>     Then "bailing out error" occurs:
>
>                  
>
> o) Change Move Filter configuration
>
>     My planning entity CloudPlacement has four planning variables as
> indicated in the included config file.
>
>     I tried the modifications you suggested over this basic version.
>
>     Could you please check that the configuration is correct?
> 2014.03.14_Config_file.xml
> <http://drools.46999.n3.nabble.com/file/n4028776/2014.03.14_Config_file.xml>
>
>  
>
> Regards
>
>
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Creating-selection-filter-for-PlanningEntity-with-4-planning-variables-tp4026575p4028776.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