Package org.drools.planner.examples.pas.domain

Examples of org.drools.planner.examples.pas.domain.PatientAdmissionSchedule


        private Map<Integer, Equipment> indexToEquipmentMap = null;
        private Map<Long, Room> idToRoomMap = null;
        private Map<Integer, Night> indexToNightMap = null;

        public Solution readSolution() throws IOException {
            patientAdmissionSchedule = new PatientAdmissionSchedule();
            patientAdmissionSchedule.setId(0L);
            readSizes();
            readEmptyLine();
            readEmptyLine();
            readSpecialismList();
View Full Code Here


import org.drools.planner.examples.pas.solver.move.BedDesignationSwapMove;

public class BedDesignationSwapMoveFactory implements MoveListFactory {

    public List<Move> createMoveList(Solution solution) {
        PatientAdmissionSchedule patientAdmissionSchedule = (PatientAdmissionSchedule) solution;
        List<BedDesignation> bedDesignationList = patientAdmissionSchedule.getBedDesignationList();
        List<Move> moveList = new ArrayList<Move>();
        for (ListIterator<BedDesignation> leftIt = bedDesignationList.listIterator(); leftIt.hasNext();) {
            BedDesignation leftBedDesignation = leftIt.next();
            for (ListIterator<BedDesignation> rightIt = bedDesignationList.listIterator(leftIt.nextIndex());
                    rightIt.hasNext();) {
View Full Code Here

import org.apache.commons.lang.builder.CompareToBuilder;

public class BedDesignationPillarPartSwapMoveFactory implements MoveListFactory {

    public List<Move> createMoveList(Solution solution) {
        PatientAdmissionSchedule patientAdmissionSchedule = (PatientAdmissionSchedule) solution;

        Map<Bed, List<BedDesignation>> bedToBedDesignationList = new HashMap<Bed, List<BedDesignation>>(
                patientAdmissionSchedule.getBedList().size());
        for (BedDesignation bedDesignation : patientAdmissionSchedule.getBedDesignationList()) {
            List<BedDesignation> bedDesignationListPerBed = bedToBedDesignationList.get(bedDesignation.getBed());
            if (bedDesignationListPerBed == null) {
                // Note: the initialCapacity is probably to high,
                // which is bad for memory, but the opposite is bad for performance (which is worse)
                bedDesignationListPerBed = new ArrayList<BedDesignation>(
                        patientAdmissionSchedule.getNightList().size());
                bedToBedDesignationList.put(bedDesignation.getBed(), bedDesignationListPerBed);
            }
            bedDesignationListPerBed.add(bedDesignation);
        }
        for (List<BedDesignation> bedDesignationListPerBed : bedToBedDesignationList.values()) {
            Collections.sort(bedDesignationListPerBed, new Comparator<BedDesignation>() {
                public int compare(BedDesignation a, BedDesignation b) {
                    // This comparison is sameBedInSameNight safe.
                    return new CompareToBuilder()
                            .append(a.getAdmissionPart().getFirstNight(), b.getAdmissionPart().getFirstNight())
                            .append(a.getAdmissionPart().getLastNight(), b.getAdmissionPart().getLastNight())
                            .append(a.getAdmissionPart(), b.getAdmissionPart())
                            .toComparison();
                }
            });
        }

        List<Bed> bedList = patientAdmissionSchedule.getBedList();
        List<Move> moveList = new ArrayList<Move>();

        // For every 2 distinct beds
        for (ListIterator<Bed> leftBedIt = bedList.listIterator(); leftBedIt.hasNext();) {
            Bed leftBed = leftBedIt.next();
View Full Code Here

import org.drools.planner.examples.pas.solver.move.BedChangeMove;

public class BedChangeMoveFactory implements MoveListFactory {

    public List<Move> createMoveList(Solution solution) {
        PatientAdmissionSchedule patientAdmissionSchedule = (PatientAdmissionSchedule) solution;
        List<Bed> bedList = patientAdmissionSchedule.getBedList();
        List<Move> moveList = new ArrayList<Move>();
        for (BedDesignation bedDesignation : patientAdmissionSchedule.getBedDesignationList()) {
            for (Bed bed : bedList) {
                moveList.add(new BedChangeMove(bedDesignation, bed));
            }
        }
        return moveList;
View Full Code Here

    protected final transient Logger logger = LoggerFactory.getLogger(getClass());

    private boolean checkSameBedInSameNight = true;

    public void changeWorkingSolution(ScoreDirector scoreDirector) {
        PatientAdmissionSchedule patientAdmissionSchedule = (PatientAdmissionSchedule)
                scoreDirector.getWorkingSolution();
        initializeBedDesignationList(scoreDirector, patientAdmissionSchedule);
    }
View Full Code Here

        return (PatientAdmissionSchedule) solutionBusiness.getSolution();
    }

    public void resetPanel(Solution solution) {
        removeAll();
        PatientAdmissionSchedule patientAdmissionSchedule = (PatientAdmissionSchedule) solution;
        gridLayout.setColumns(patientAdmissionSchedule.getNightList().size() + 1);
        JLabel headerCornerLabel = new JLabel("Department_Room_Bed  \\  Night");
        headerCornerLabel.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createLineBorder(Color.DARK_GRAY),
                BorderFactory.createEmptyBorder(2, 2, 2, 2)));
        headerCornerLabel.setBackground(HEADER_COLOR);
        headerCornerLabel.setOpaque(true);
        add(headerCornerLabel);
        for (Night night : patientAdmissionSchedule.getNightList()) {
            JLabel nightLabel = new JLabel(night.toString());
            nightLabel.setBorder(BorderFactory.createCompoundBorder(
                    BorderFactory.createLineBorder(Color.DARK_GRAY),
                    BorderFactory.createEmptyBorder(2, 2, 2, 2)));
            nightLabel.setBackground(HEADER_COLOR);
            nightLabel.setOpaque(true);
            add(nightLabel);
        }
        Map<Bed, Map<Night, BedNightPanel>> bedNightPanelMap = new HashMap<Bed, Map<Night, BedNightPanel>>();
        for (Bed bed : patientAdmissionSchedule.getBedList()) {
            createBedLine(patientAdmissionSchedule, bedNightPanelMap, bed);
        }
        createBedLine(patientAdmissionSchedule, bedNightPanelMap, null);
        for (BedDesignation bedDesignation : patientAdmissionSchedule.getBedDesignationList()) {
            for (Night night : patientAdmissionSchedule.getNightList()) {
                if (bedDesignation.getAdmissionPart().getFirstNight().getIndex() <= night.getIndex()
                        && night.getIndex() <= bedDesignation.getAdmissionPart().getLastNight().getIndex()) {
                    BedNightPanel bedNightPanel = bedNightPanelMap.get(bedDesignation.getBed()).get(night);
                    bedNightPanel.addBedDesignation(bedDesignation);
                }
View Full Code Here

import org.drools.planner.examples.pas.domain.Room;

public class BedDesignationDifficultyWeightFactory implements PlanningEntityDifficultyWeightFactory {

    public Comparable createDifficultyWeight(Solution solution, Object planningEntity) {
        PatientAdmissionSchedule schedule = (PatientAdmissionSchedule) solution;
        BedDesignation bedDesignation = (BedDesignation) planningEntity;
        int disallowedCount = 0;
        for (Room room : schedule.getRoomList()) {
            disallowedCount += (room.countDisallowedAdmissionPart(bedDesignation.getAdmissionPart())
                    * room.getCapacity());
        }
        return new BedDesignationDifficultyWeight(bedDesignation, disallowedCount);
    }
View Full Code Here

TOP

Related Classes of org.drools.planner.examples.pas.domain.PatientAdmissionSchedule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.