使用 Optaplanner,是否可以同时定义一个类作为计划实体和计划变量?
例子 :
@PlanningEntity(difficultyComparatorClass = NodeDifficultyComparator.class)
public class Node extends ProcessChain {
// Planning variables: changes during planning, between score calculations.
private List<Node> parents;
private List<Node> childs;
@PlanningVariable(valueRangeProviderRefs = {"nodeRange"})
public List<Node> getParents() {
return parents;
}
@PlanningVariable(valueRangeProviderRefs = {"nodeRange"})
public List<Node> getChilds() {
return childs;
}
public void setParents(List<Node> parents) {
this.parents = parents;
}
public void setChilds(List<Node> childs) {
this.childs = childs;
}
}