@Override
    public void resetWorkingSolution(CheapTimeSolution solution) {
        this.cheapTimeSolution = solution;
        hardScore = 0L;
        mediumScore = 0L;
        softScore = 0L;
        if (solution.getGlobalPeriodRangeFrom() != 0) {
            throw new IllegalStateException("The globalPeriodRangeFrom (" + solution.getGlobalPeriodRangeFrom()
                    + ") should be 0.");
        }
        resourceListSize = solution.getResourceList().size();
        globalPeriodRangeTo = solution.getGlobalPeriodRangeTo();
        List<Machine> machineList = solution.getMachineList();
        List<PeriodPowerPrice> periodPowerPriceList = solution.getPeriodPowerPriceList();
        machineToMachinePeriodListMap = new MachinePeriodPart[machineList.size()][];
        for (Machine machine : machineList) {
            MachinePeriodPart[] machinePeriodList = new MachinePeriodPart[globalPeriodRangeTo];
            for (int period = 0; period < globalPeriodRangeTo; period++) {
                machinePeriodList[period] = new MachinePeriodPart(machine, periodPowerPriceList.get(period));
            }
            machineToMachinePeriodListMap[machine.getIndex()] = machinePeriodList;
        }
        unassignedMachinePeriodList = new MachinePeriodPart[globalPeriodRangeTo];
        for (int period = 0; period < globalPeriodRangeTo; period++) {
            unassignedMachinePeriodList[period] = new MachinePeriodPart(null, periodPowerPriceList.get(period));
        }
        for (TaskAssignment taskAssignment : solution.getTaskAssignmentList()) {
            // Do not do modifyMachine(taskAssignment, null, taskAssignment.getMachine());
            // because modifyStartPeriod does all its effects too
            modifyStartPeriod(taskAssignment, null, taskAssignment.getStartPeriod());
        }
    }
@Override
    public void resetWorkingSolution(CheapTimeSolution solution) {
        this.cheapTimeSolution = solution;
        hardScore = 0L;
        mediumScore = 0L;
        softScore = 0L;
        if (solution.getGlobalPeriodRangeFrom() != 0) {
            throw new IllegalStateException("The globalPeriodRangeFrom (" + solution.getGlobalPeriodRangeFrom()
                    + ") should be 0.");
        }
        resourceListSize = solution.getResourceList().size();
        globalPeriodRangeTo = solution.getGlobalPeriodRangeTo();
        List<Machine> machineList = solution.getMachineList();
        List<PeriodPowerPrice> periodPowerPriceList = solution.getPeriodPowerPriceList();
        machineToMachinePeriodListMap = new MachinePeriodPart[machineList.size()][];
        for (Machine machine : machineList) {
            MachinePeriodPart[] machinePeriodList = new MachinePeriodPart[globalPeriodRangeTo];
            for (int period = 0; period < globalPeriodRangeTo; period++) {
                machinePeriodList[period] = new MachinePeriodPart(machine, periodPowerPriceList.get(period));
            }
            machineToMachinePeriodListMap[machine.getIndex()] = machinePeriodList;
        }
        unassignedMachinePeriodList = new MachinePeriodPart[globalPeriodRangeTo];
        for (int period = 0; period < globalPeriodRangeTo; period++) {
            unassignedMachinePeriodList[period] = new MachinePeriodPart(null, periodPowerPriceList.get(period));
        }
        for (TaskAssignment taskAssignment : solution.getTaskAssignmentList()) {
            
            
            modifyStartPeriod(taskAssignment, null, taskAssignment.getStartPeriod());
        }
    }
@ Override public void resetWorkingSolution ( CheapTimeSolution solution ) { this . cheapTimeSolution = solution ; hardScore = 0L ; mediumScore = 0L ; softScore = 0L ; if ( solution . getGlobalPeriodRangeFrom ( ) != 0 ) { throw new IllegalStateException ( "The globalPeriodRangeFrom (" + solution . getGlobalPeriodRangeFrom ( ) + ") should be 0." ) ; } resourceListSize = solution . getResourceList ( ) . size ( ) ; globalPeriodRangeTo = solution . getGlobalPeriodRangeTo ( ) ; List < Machine > machineList = solution . getMachineList ( ) ; List < PeriodPowerPrice > periodPowerPriceList = solution . getPeriodPowerPriceList ( ) ; machineToMachinePeriodListMap = new MachinePeriodPart [ machineList . size ( ) ] [ ] ; for ( Machine machine : machineList ) { MachinePeriodPart [ ] machinePeriodList = new MachinePeriodPart [ globalPeriodRangeTo ] ; for ( int period = 0 ; period < globalPeriodRangeTo ; period ++ ) { machinePeriodList [ period ] = new MachinePeriodPart ( machine , periodPowerPriceList . get ( period ) ) ; } machineToMachinePeriodListMap [ machine . getIndex ( ) ] = machinePeriodList ; } unassignedMachinePeriodList = new MachinePeriodPart [ globalPeriodRangeTo ] ; for ( int period = 0 ; period < globalPeriodRangeTo ; period ++ ) { unassignedMachinePeriodList [ period ] = new MachinePeriodPart ( null , periodPowerPriceList . get ( period ) ) ; } for ( TaskAssignment taskAssignment : solution . getTaskAssignmentList ( ) ) { // Do not do modifyMachine(taskAssignment, null, taskAssignment.getMachine()); // because modifyStartPeriod does all its effects too modifyStartPeriod ( taskAssignment , null , taskAssignment . getStartPeriod ( ) ) ; } }
************************************************************************
************************************************************************