All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.optaplanner.examples.machinereassignment.persistence.MachineReassignmentSolutionFileIO Maven / Gradle / Ivy

package org.optaplanner.examples.machinereassignment.persistence;

import java.io.File;

import org.optaplanner.examples.common.persistence.AbstractJsonSolutionFileIO;
import org.optaplanner.examples.machinereassignment.domain.MachineReassignment;
import org.optaplanner.examples.machinereassignment.domain.MrMachine;

public class MachineReassignmentSolutionFileIO extends AbstractJsonSolutionFileIO {

    public MachineReassignmentSolutionFileIO() {
        super(MachineReassignment.class);
    }

    @Override
    public MachineReassignment read(File inputSolutionFile) {
        MachineReassignment machineReassignment = super.read(inputSolutionFile);
        /*
         * Replace the duplicate MrMachine instances in the machineMoveCostMap by references to instances from
         * the machineList.
         */
        deduplicateEntities(machineReassignment, MachineReassignment::getMachineList, MrMachine::getId,
                MrMachine::getMachineMoveCostMap, MrMachine::setMachineMoveCostMap);
        return machineReassignment;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy