Op 27-11-12 14:16, mr_moe schreef:
Hey,
I have a planning entity, which has one planning variable called startDate.
This variable has a defined discrete value range which is a list of numbers
of the type long. Every number represents a timestamp, which is in between
the number firstPossibleStartDate and lastPossibleStartDate.
During the planning process, the number 0 is sometimes assigned to the
planning variable which is definitely not part of the valueRange. I’ve
printed the list to the console, but all values in the list are fine.
Because every planning entity has its own valueRange, the range is defined
in the entity itself.
At the moment I’ve implemented my own mover, but the problem occurs also
with pre-configured mover.
During my research I’ve stumbled upon the following note in the Planner
Documentation:
ValueRange from planning entity is currently not yet supported by the new
MoveSelectors.
Does this has something to do with my problem?
Yes, this is the one known issue
(regression even) with the new selector
architecture (which has brought many benefits):
It basically breaks @ValueRange(type =
ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY, ...) currently.
I should probably have failed-fast that for 5.5 if that gets used.
I am hoping to resolve this for 6.0 so FROM_PLANNING_ENTITY_PROPERTY
does work in the new selector architecture.
To do that properly, I need to put the construction heuristics on the
new selector architecture first.
Enclosed you will find the code of the planning entity.
@PlanningEntity
public class DroolTask {
private List<Long> startDateList;
private int id;
private String name;
private long duration;
private long firstPossibleStartDate;
private long lastPossibleStartDate;
private String nextTask = "";
private String previousTask = "";
// Planning variables: changes during planning, between score calculations.
private long startDate;
@PlanningVariable
@ValueRange(type = ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY,
planningEntityProperty = "startDateList")
public long getStartDate(){
return startDate;
}
public void setStartDate(long startDate){
this.startDate = startDate;
}
public List<Long> getStartDateList(){
return this.startDateList;
}
public void setStartDateList(){
startDateList = getPossibleStartDate();
}
public List<Long> getPossibleStartDate(){
startDateList = new ArrayList<Long>();
for(long i = firstPossibleStartDate; i<=lastPossibleStartDate; i = i +
60){
startDateList.add(i);
}
return startDateList;
}
public Long getFirstPossibleStartDate(){
return firstPossibleStartDate;
}
public void setFirstPossibleStartDate(long firstPossibleStartDate){
this.firstPossibleStartDate = firstPossibleStartDate;
}
public Long getLastPossibleStartDate(){
return lastPossibleStartDate;
}
public void setLastPossibleStartDate(long lastPossibleEndDate){
this.lastPossibleStartDate = lastPossibleEndDate;
}
[...]
public DroolTask clone(){
DroolTask clone = new DroolTask();
clone.name = name;
clone.duration = duration;
clone.firstPossibleStartDate = firstPossibleStartDate;
clone.lastPossibleStartDate = lastPossibleStartDate;
clone.startDate = startDate;
clone.nextTask = nextTask;
clone.previousTask = previousTask;
clone.startDateList = startDateList;
return clone;
}
[...]
}
It would be great, if someone could give me a hint.
Many thanks,
Moe
--
View this message in context:
http://drools.46999.n3.nabble.com/Drools-Planner-Planning-variable-gets-a...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users