Package org.drools.planner.examples.travelingtournament.domain

Examples of org.drools.planner.examples.travelingtournament.domain.TravelingTournament


    private List<Move> cachedMoveList;

    @Override
    public void phaseStarted(LocalSearchSolverPhaseScope localSearchSolverPhaseScope) {
        TravelingTournament travelingTournament = (TravelingTournament) localSearchSolverPhaseScope.getWorkingSolution();
        cachedMoveList = new ArrayList<Move>(travelingTournament.getMatchList().size() / 2);
        addCachedHomeAwaySwapMoves(travelingTournament);
    }
View Full Code Here


public class SimpleTravelingTournamentMoveFactory extends CachedMoveFactory {

    public List<Move> createCachedMoveList(Solution solution) {
        List<Move> moveList = new ArrayList<Move>();
        TravelingTournament travelingTournament = (TravelingTournament) solution;
        for (Match match : travelingTournament.getMatchList()) {
            for (Day day : travelingTournament.getDayList()) {
                moveList.add(new DayChangeMove(match, day));
            }
        }
        return moveList;
    }
View Full Code Here

            }
        }
    }

    public List<Move> createMoveList(Solution solution) {
        TravelingTournament travelingTournament = (TravelingTournament) solution;
        List<Move> moveList = new ArrayList<Move>();
        moveList.addAll(cachedMoveList);
        RotationMovesFactory rotationMovesFactory = new RotationMovesFactory(travelingTournament);
        logger.trace("Reused {} moves for N1 neighborhood.", moveList.size());
        int oldSize = moveList.size();
View Full Code Here

        return (TravelingTournament) solutionBusiness.getSolution();
    }

    public void resetPanel() {
        removeAll();
        TravelingTournament travelingTournament = getTravelingTournament();
        Map<Day, DayPanel> dayPanelMap = new HashMap<Day, DayPanel>();
        for (Day day : travelingTournament.getDayList()) {
            TravelingTournamentPanel.DayPanel dayPanel = new DayPanel();
            add(dayPanel);
            dayPanelMap.put(day, dayPanel);
        }
        for (Match match : travelingTournament.getMatchList()) {
            TravelingTournamentPanel.DayPanel dayPanel = dayPanelMap.get(match.getDay());
            dayPanel.addMatch(match);
        }
    }
View Full Code Here

    }

    public abstract class TravelingTournamentInputBuilder extends TxtInputBuilder {

        public Solution readSolution() throws IOException {
            TravelingTournament travelingTournament = new TravelingTournament();
            travelingTournament.setId(0L);
            int n = readN();
            List<Team> teamList = readTeamList(n);
            travelingTournament.setTeamList(teamList);
            List<Day> dayList = constructDayList(n);
            travelingTournament.setDayList(dayList);
            List<List<Integer>> outerDistanceList = readOuterDistanceList();
            List<Match> matchList = constructMatchListAndSetDistancesInTeamList(teamList, outerDistanceList);
            travelingTournament.setMatchList(matchList);
            initializeMatchDays(travelingTournament);
            return travelingTournament;
        }
View Full Code Here

    private List<Move> cachedMoveList;

    @Override
    public void solvingStarted(LocalSearchSolverScope localSearchSolverScope) {
        TravelingTournament travelingTournament = (TravelingTournament) localSearchSolverScope.getWorkingSolution();
        cachedMoveList = new ArrayList<Move>(travelingTournament.getMatchList().size() / 2);
        addCachedHomeAwaySwapMoves(travelingTournament);
    }
View Full Code Here

            }
        }
    }

    public List<Move> createMoveList(Solution solution) {
        TravelingTournament travelingTournament = (TravelingTournament) solution;
        List<Move> moveList = new ArrayList<Move>();
        moveList.addAll(cachedMoveList);
        RotationMovesFactory rotationMovesFactory = new RotationMovesFactory(travelingTournament);
        logger.debug("Reused {} moves for N1 neighborhood.", moveList.size());
        int oldSize = moveList.size();
View Full Code Here

public class SimpleTravelingTournamentMoveFactory implements MoveListFactory {

    public List<Move> createMoveList(Solution solution) {
        List<Move> moveList = new ArrayList<Move>();
        TravelingTournament travelingTournament = (TravelingTournament) solution;
        for (Match match : travelingTournament.getMatchList()) {
            for (Day day : travelingTournament.getDayList()) {
                moveList.add(new DayChangeMove(match, day));
            }
        }
        return moveList;
    }
View Full Code Here

// TODO rename to MatchRotationMoveFactory
public class SmartTravelingTournamentMoveFactory implements MoveListFactory {

    public List<Move> createMoveList(Solution solution) {
        TravelingTournament travelingTournament = (TravelingTournament) solution;
        List<Move> moveList = new ArrayList<Move>();
        RotationMovesFactory rotationMovesFactory = new RotationMovesFactory(travelingTournament);
        rotationMovesFactory.addDayRotation(moveList);
        rotationMovesFactory.addTeamRotation(moveList);
        return moveList;
View Full Code Here

import org.drools.planner.examples.travelingtournament.solver.smart.move.MatchSwapMove;

public class MatchSwapMoveFactory implements MoveListFactory {

    public List<Move> createMoveList(Solution solution) {
        TravelingTournament travelingTournament = (TravelingTournament) solution;
        List<Match> matchList = travelingTournament.getMatchList();
        List<Move> moveList = new ArrayList<Move>(matchList.size() / 2);
        for (Match firstMatch : matchList) {
            for (Match secondMatch : matchList) {
                if (firstMatch.getHomeTeam().equals(secondMatch.getAwayTeam())
                        && firstMatch.getAwayTeam().equals(secondMatch.getHomeTeam())
View Full Code Here

TOP

Related Classes of org.drools.planner.examples.travelingtournament.domain.TravelingTournament

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.