<div dir="ltr">Bad choice of words. Entities. :-)<div><br></div><div>I've got three classes:</div><div><br></div><div><div>@PlanningEntity(movableEntitySelectionFilter = MovableWorkersSelectionFilter.class)</div><div>public class Person extends Property {</div>
<div><br></div><div> String signature;</div><div> String name;</div><div> Desk desk;</div><div> boolean movable;<br></div><div> ...</div><div>}</div><div><br></div><div>Fact:</div><div><br></div><div>public class Desk extends Property {<br>
</div><div><div><br></div><div> double x;</div><div> double y;</div><div><br></div><div> public Desk() {</div><div> }</div></div><div> ...</div><div>}</div><div><br><div class="gmail_extra">Solution:</div><div class="gmail_extra">
<br></div><div class="gmail_extra"><div class="gmail_extra">@PlanningSolution</div><div class="gmail_extra">public class DeskAssignmentSolution implements Solution<HardSoftScore> {</div><div class="gmail_extra"><br>
</div><div class="gmail_extra"> private List<Person> persons;</div><div class="gmail_extra"> private List<Desk> desks;</div><div class="gmail_extra"> private HardSoftScore score;</div><div class="gmail_extra">
<br></div><div class="gmail_extra"> @PlanningEntityCollectionProperty</div><div class="gmail_extra"> public List<Person> getPersons() {</div><div class="gmail_extra"> return persons;</div><div class="gmail_extra">
}</div><div class="gmail_extra"><br></div><div class="gmail_extra"> public void setPersons(List<Person> persons) {</div><div class="gmail_extra"> this.persons = persons;</div><div class="gmail_extra"> }</div>
<div class="gmail_extra"><br></div><div class="gmail_extra"> public void setDesks(List<Desk> desks) {</div><div class="gmail_extra"> this.desks = desks;</div><div class="gmail_extra"> }</div><div class="gmail_extra">
<br></div><div class="gmail_extra"> @ValueRangeProvider(id="deskRange")</div><div class="gmail_extra"> public List<Desk> getDesks() {</div><div class="gmail_extra"> return desks;</div><div class="gmail_extra">
}</div><div class="gmail_extra"> ...</div><div class="gmail_extra"><br></div><div class="gmail_extra">}</div><div class="gmail_extra"><br></div><div class="gmail_extra">A desk is assigned to a person and makes up a desk assignment solution. </div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Certain desks should not be assigned since the are all ready occupied. The are correctly assigned to the right person in the initial solution.</div><div class="gmail_extra">
<br></div><div class="gmail_extra">Does the SelectionFilter prevent the desk being assigned somehow? I thought a SelectionFilter<Person> would only prevent a move of the Person but it's the Desk being assigned?</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Regards,</div><div class="gmail_extra">Mats</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div><div class="gmail_extra"><div class="gmail_quote">
On Fri, Dec 13, 2013 at 9:32 AM, Geoffrey De Smet <span dir="ltr"><<a href="mailto:ge0ffrey.spam@gmail.com" target="_blank">ge0ffrey.spam@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<br>
<div>On 12-12-13 18:11, Mats Norén wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Hi,<br>
I've got a domain with the following entities:<br>
</div>
</div>
</blockquote>
entities? you mean classes?<br>
<blockquote type="cite">
<div dir="ltr">
<div>- Person (planning entity)<br>
- Desk (planning variable)<br>
</div>
</div>
</blockquote>
a class cannot be a variable. This probably a problem fact that and
person.getDesk() nor DeskAssignement.getPerson() is the planning
variables.<br>
<blockquote type="cite">
<div dir="ltr">
<div>- DeskAssignment (solution)<br>
</div>
</div>
</blockquote>
Now I am totally confused :)<br>
in the official examples, something called Assignment is a planning
entity.<br>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
<div>All persons should be assigned to a desk according to some
rules. <br>
</div>
<div>What I would like to do is to make certain Persons and
their Desk immovable, ie, they are assigned a desk in the
initial solution and should be fixed there. They are only
there for the score calculation. <br>
</div>
</div>
</blockquote>
agreed, "immovable" is the correct concept to use for that<br>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
<div>I looked at 14.3.1 Immovable planning entities but couldn't
really see how I would apply it to my use case. <br>
</div>
</div>
</blockquote>
Take a look at the course scheduling example.<br>
Here's a demo of immovable planning entities in that example:<br>
<a href="http://www.youtube.com/watch?v=4meWIhPRVn8" target="_blank">http://www.youtube.com/watch?v=4meWIhPRVn8</a><br>
<blockquote type="cite">
<div dir="ltr">
<div>Why is the filter applied at the planning entity level?
Since it's the planning variable that changes I thought that I
should somehow filter the allowed values for the Desk. <br>
</div>
</div>
</blockquote>
Don't mix the concept of "(im)movable entities" (which is what you
want) with the concept of "limiting value ranges per entity" or the
concept of "filtering specific move selectors" (which is overkill
and convoluted for your needs).<br>
<blockquote type="cite">
<div dir="ltr">
<div>
</div>
<div><br>
</div>
<div>Regards, <br>
</div>
<div>Mats<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div> <br>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
</blockquote>
<br>
</div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br></div></div></div></div>