}
private int computeC_A() {
int C_A = 0;
for (int i = 1; i <= shiftContainer.getShiftNum(); i++) {
Shift s = shiftContainer.getShiftById(i);
if (s.getParent() == null) {
Place actualPlace = s.getBeginPlace();
int actualTime = s.getTime().getBegin();
int worktime = 0;
for (int j = 0; j < s.getAssignedTasks().size(); j++) {
Task t = s.getAssignedTasks().get(j);
int time = t.getCompletionTime().getEnd() -
t.getCompletionTime().getBegin()
+ trafficProperties.getDistance(actualPlace, t.getPlace(), actualTime);
worktime += time;
actualTime = t.getCompletionTime().getEnd();
actualPlace = t.getPlace();
}
worktime += trafficProperties.getDistance(actualPlace, s.getEndPlace(), actualTime);
int time;
if (s.getAssignedTasks().isEmpty()) {
time = s.getTime().getEnd() - s.getTime().getBegin();
}
else {
Task t = s.getAssignedTasks().lastElement();
int max1 = t.getCompletionTime().getEnd() + trafficProperties.getDistance(t.getPlace(),
s.getEndPlace(), t.getCompletionTime().getEnd());
int max2 = s.getTime().getEnd();
int max = (max1 > max2) ? max1 : max2;
time = max - s.getTime().getBegin();
}
if (time < worktime) {
// System.out.println(s + "\ntime: " + time + "\nworktime: " + worktime + "\n");
}
C_A += (time - worktime) * s.getStandCost();
}
}
// System.out.println("miva");
// System.out.println(C_A);