Optaplanner Shadow variable

时间:2019-04-17 02:12:52

标签: java optaplanner

I am using "chained through time pattern" for our optimization project where following the example TaskAssignment but for the shadow variable instead of using Integer start time, using TimeGrain (from meeting example).

The Domain Problem is: for each Schedule (within a day) one or more Service (PlanningEntity) need to be assigned one after another immediately after the previous one is completed.

Here, I am using TimeGrain as a shadow variable (because availability of the resources are defined for each TimeGrain)

@CustomShadowVariable(variableListenerClass = AssignmentVariableListener.class,
                           sources = { @PlanningVariableReference(variableName = "previousAssignment"), 
                                       @PlanningVariableReference(variableName = "scheduleAssignment")
                                      }
                          )
public TimeGrain getTimeGrain() {
    return timeGrain;
}

I am setting the shadow variable in the variable listener, but do I have to always initialize the shadow variable first before start solving ?

In the TaskAssignment example, the end time is calculated based on the start time, but the start time initially would be null. How does this get initialized ?

Thank you, Karthik

0 个答案:

没有答案