Examples of Examination


Examples of org.blueoxygen.pedimedi.Examination

      log.setCreateBy(credentials.getCurrentUser().getId());
      log.setCreateDate(new Timestamp(System.currentTimeMillis()));
      getExamination().setId(null);

    } else {
      Examination category = getExamination();
      setExamination((Examination) manager.getById(Examination.class,
          getExamination().getId()));
      log = getExamination().getLogInformation();
      getExamination().setStartDate(category.getStartDate());
      getExamination().setEndDate(category.getEndDate());
      try {
        PropertyUtils.copyProperties(getExamination(), category);
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      } catch (InvocationTargetException e) {
View Full Code Here

Examples of org.drools.planner.examples.examination.domain.Examination

    private int periodJump = 1;
    private int roomJump = 1;

    public List<Move> createMoveList(Solution solution) {
        Examination examination = (Examination) solution;
        List<Period> periodList = examination.getPeriodList();
        List<Room> roomList = examination.getRoomList();
        List<Move> moveList = new ArrayList<Move>();
        for (Exam exam : examination.getExamList()) {
            if (exam.isCoincidenceLeader()) {
                for (Period period : periodList) {
                    int distance = calculateShortestDistance(
                            period.getPeriodIndex(), exam.getPeriod().getPeriodIndex(), periodList.size());
                    if (distance == periodJump) {
View Full Code Here

Examples of org.drools.planner.examples.examination.domain.Examination

import org.drools.planner.examples.examination.solver.move.ExamSwapMove;

public class ExamSwapMoveFactory extends CachedMoveFactory {

    public List<Move> createCachedMoveList(Solution solution) {
        Examination examination = (Examination) solution;
        List<Exam> examList = examination.getExamList();
        List<Move> moveList = new ArrayList<Move>();
        for (ListIterator<Exam> leftIt = examList.listIterator(); leftIt.hasNext();) {
            Exam leftExam = leftIt.next();
            for (ListIterator<Exam> rightIt = examList.listIterator(leftIt.nextIndex()); rightIt.hasNext();) {
                Exam rightExam = rightIt.next();
View Full Code Here

Examples of org.drools.planner.examples.examination.domain.Examination

import org.drools.planner.examples.examination.solver.move.RoomChangeMove;

public class RoomChangeMoveFactory extends CachedMoveFactory {

    public List<Move> createCachedMoveList(Solution solution) {
        Examination examination = (Examination) solution;
        List<Room> roomList = examination.getRoomList();
        List<Move> moveList = new ArrayList<Move>();
        for (Exam exam : examination.getExamList()) {
            for (Room room : roomList) {
                moveList.add(new RoomChangeMove(exam, room));
            }
        }
        return moveList;
View Full Code Here

Examples of org.drools.planner.examples.examination.domain.Examination

import org.drools.planner.examples.examination.solver.move.PeriodChangeMove;

public class PeriodChangeMoveFactory extends CachedMoveFactory {

    public List<Move> createCachedMoveList(Solution solution) {
        Examination examination = (Examination) solution;
        List<Period> periodList = examination.getPeriodList();
        List<Move> moveList = new ArrayList<Move>();
        for (Exam exam : examination.getExamList()) {
            if (exam.isCoincidenceLeader()) {
                for (Period period : periodList) {
                    moveList.add(new PeriodChangeMove(exam, period));
                }
            }
View Full Code Here

Examples of org.drools.planner.examples.examination.domain.Examination

    private static final int PERIOD_JUMP = 2;
    private static final int ROOM_JUMP = 2;

    public List<Move> createMoveList(Solution solution) {
        Examination examination = (Examination) solution;
        List<Period> periodList = examination.getPeriodList();
        List<Room> roomList = examination.getRoomList();
        List<Move> moveList = new ArrayList<Move>();
        for (Exam exam : examination.getExamList()) {
            if (exam.isCoincidenceLeader()) {
                for (Period period : periodList) {
                    int distance = calculateShortestDistance(
                            period.getPeriodIndex(), exam.getPeriod().getPeriodIndex(), periodList.size());
                    if (distance <= PERIOD_JUMP) {
View Full Code Here

Examples of org.drools.planner.examples.examination.domain.Examination

        return (Examination) solutionBusiness.getSolution();
    }

    public void resetPanel(Solution solution) {
        removeAll();
        Examination examination = (Examination) solution;
        gridLayout.setColumns(examination.getRoomList().size() + 1);
        JLabel headerCornerLabel = new JLabel("Period         \\         Room");
        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 (Room room : examination.getRoomList()) {
            JLabel roomLabel = new JLabel(room.toString());
            roomLabel.setBorder(BorderFactory.createCompoundBorder(
                    BorderFactory.createLineBorder(Color.DARK_GRAY),
                    BorderFactory.createEmptyBorder(2, 2, 2, 2)));
            roomLabel.setBackground(HEADER_COLOR);
            roomLabel.setOpaque(true);
            add(roomLabel);
        }
        Map<Period, Map<Room, PeriodRoomPanel>> periodRoomPanelMap = new HashMap<Period, Map<Room, PeriodRoomPanel>>();
        for (Period period : examination.getPeriodList()) {
            JLabel periodLabel = new JLabel(period.toString() + " " + period.getStartDateTimeString());
            periodLabel.setBorder(BorderFactory.createCompoundBorder(
                    BorderFactory.createLineBorder(Color.DARK_GRAY),
                    BorderFactory.createEmptyBorder(2, 2, 2, 2)));
            periodLabel.setBackground(HEADER_COLOR);
            periodLabel.setOpaque(true);
            add(periodLabel);
            Map<Room, PeriodRoomPanel> roomPanelMap = new HashMap<Room, PeriodRoomPanel>();
            periodRoomPanelMap.put(period, roomPanelMap);
            for (Room room : examination.getRoomList()) {
                PeriodRoomPanel periodRoomPanel = new PeriodRoomPanel();
                add(periodRoomPanel);
                roomPanelMap.put(room, periodRoomPanel);
            }
        }
        for (Exam exam : examination.getExamList()) {
            Period period = exam.getPeriod();
            Room room = exam.getRoom();
            if (period != null && room != null) {
                PeriodRoomPanel periodRoomPanel = periodRoomPanelMap.get(period).get(room);
                periodRoomPanel.addExam(exam);
View Full Code Here

Examples of org.drools.planner.examples.examination.domain.Examination

        examSwapMoveFactory.phaseStarted(localSearchSolverPhaseScope);
        createCachedExamToMoveMap(localSearchSolverPhaseScope);
    }

    private void createCachedExamToMoveMap(LocalSearchSolverPhaseScope localSearchSolverPhaseScope) {
        Examination examination = (Examination) localSearchSolverPhaseScope.getWorkingSolution();
        int examListSize = examination.getExamList().size();
        List<Move> cachedPeriodChangeMoveList = periodChangeMoveFactory.getCachedMoveList();
        List<Move> cachedRoomChangeMoveList = roomChangeMoveFactory.getCachedMoveList();
        List<Move> cachedExamSwapMoveList = examSwapMoveFactory.getCachedMoveList();
        cachedExamToMoveMap = new HashMap<Exam, List<Move>>(cachedPeriodChangeMoveList.size()
                + cachedRoomChangeMoveList.size() + cachedExamSwapMoveList.size());
View Full Code Here

Examples of org.drools.planner.examples.examination.domain.Examination

    }

    public class ExaminationInputBuilder extends TxtInputBuilder {

        public Solution readSolution() throws IOException {
            Examination examination = new Examination();
            examination.setId(0L);

            readTopicListAndStudentList(examination);
            readPeriodList(examination);
            readRoomList(examination);

            String line = bufferedReader.readLine();
            if (!line.equals("[PeriodHardConstraints]")) {
                throw new IllegalStateException("Read line (" + line
                        + " is not the expected header ([PeriodHardConstraints])");
            }
            readPeriodPenaltyList(examination);
            readRoomPenaltyList(examination);
            readInstitutionalWeighting(examination);
            tagFrontLoadLargeTopics(examination);
            tagFrontLoadLastPeriods(examination);

            createExamList(examination);

            logger.info("Examination with {} students, {} topics/exams, {} periods, {} rooms, {} period constraints" +
                    " and {} room constraints.",
                    new Object[]{examination.getStudentList().size(), examination.getTopicList().size(),
                            examination.getPeriodList().size(), examination.getRoomList().size(),
                            examination.getPeriodPenaltyList().size(),
                            examination.getRoomPenaltyList().size()});
            int possibleForOneExamSize = examination.getPeriodList().size() * examination.getRoomList().size();
            BigInteger possibleSolutionSize = BigInteger.valueOf(possibleForOneExamSize).pow(
                    examination.getTopicList().size());
            String flooredPossibleSolutionSize = "10^" + (possibleSolutionSize.toString().length() - 1);
            logger.info("Examination with flooredPossibleSolutionSize ({}) and possibleSolutionSize ({}).",
                    flooredPossibleSolutionSize, possibleSolutionSize);
            return examination;
        }
View Full Code Here

Examples of org.drools.planner.examples.examination.domain.Examination

    @Test
    public void moveRoom() {
        LocalSearchSolverScope localSearchSolverScope = new LocalSearchSolverScope();
        localSearchSolverScope.setRuleBase(buildRuleBase());
        localSearchSolverScope.setWorkingScoreCalculator(new DefaultHardAndSoftConstraintScoreCalculator());
        Examination examination = (Examination) new ExaminationDaoImpl().readSolution(getClass().getResourceAsStream(
                "/org/drools/planner/examples/examination/data/testExaminationScoreRules.xml"));
        localSearchSolverScope.setWorkingSolution(examination);
        WorkingMemory workingMemory = localSearchSolverScope.getWorkingMemory();

        localSearchSolverScope.calculateScoreFromWorkingMemory();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.