Examples of VrpSchedule


Examples of org.drools.planner.examples.vehiclerouting.domain.VrpSchedule

        private int capacity;
        private Map<Long, VrpLocation> locationMap;
        private List<VrpDepot> depotList;

        public Solution readSolution() throws IOException {
            schedule = new VrpSchedule();
            schedule.setId(0L);
            readHeaders();
            readLocationList();
            readCustomerList();
            readDepotList();
View Full Code Here

Examples of org.drools.planner.examples.vehiclerouting.domain.VrpSchedule

        }
        addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                // TODO Not thread-safe during solving
                VrpSchedule schedule = VehicleRoutingWorldPanel.this.vehicleRoutingPanel.getSchedule();
                if (schedule != null) {
                    resetPanel(schedule);
                }
            }
        });
View Full Code Here

Examples of org.drools.planner.examples.vehiclerouting.domain.VrpSchedule

    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        HttpSession session = req.getSession();
        VrpSchedule shownSolution = (VrpSchedule) session.getAttribute(VrpSessionAttributeName.SHOWN_SOLUTION);
        Dimension size = new Dimension(800, 600);
        BufferedImage image;
        if (shownSolution == null) {
            schedulePainter.createCanvas(size.width, size.height);
        } else {
View Full Code Here

Examples of org.drools.planner.examples.vehiclerouting.domain.VrpSchedule

                "/org/drools/planner/examples/vehiclerouting/solver/vehicleRoutingSolverConfig.xml");
        Solver solver = solverFactory.buildSolver();
        session.setAttribute(VrpSessionAttributeName.SOLVER, solver);

        URL unsolvedSolutionURL = getClass().getResource("/org/drools/planner/webexamples/vehiclerouting/A-n33-k6.vrp");
        VrpSchedule unsolvedSolution = (VrpSchedule) new VehicleRoutingSolutionImporter()
                .readSolution(unsolvedSolutionURL);
        session.setAttribute(VrpSessionAttributeName.SHOWN_SOLUTION, unsolvedSolution);
    }
View Full Code Here

Examples of org.drools.planner.examples.vehiclerouting.domain.VrpSchedule

    }


    public void solve(final HttpSession session) {
        final Solver solver = (Solver) session.getAttribute(VrpSessionAttributeName.SOLVER);
        VrpSchedule unsolvedSolution = (VrpSchedule) session.getAttribute(VrpSessionAttributeName.SHOWN_SOLUTION);

        solver.setPlanningProblem(unsolvedSolution);
        solver.addEventListener(new SolverEventListener() {
            public void bestSolutionChanged(BestSolutionChangedEvent event) {
                VrpSchedule bestSolution = (VrpSchedule) event.getNewBestSolution();
                session.setAttribute(VrpSessionAttributeName.SHOWN_SOLUTION, bestSolution);
            }
        });
        solvingExecutor.submit(new Runnable() {
            public void run() {
View Full Code Here

Examples of org.drools.planner.examples.vehiclerouting.domain.VrpSchedule

        schedulePainter = new VehicleRoutingSchedulePainter();
        addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                // TODO Not thread-safe during solving
                VrpSchedule schedule = VehicleRoutingWorldPanel.this.vehicleRoutingPanel.getSchedule();
                if (schedule != null) {
                    resetPanel(schedule);
                }
            }
        });
View Full Code Here

Examples of org.drools.planner.examples.vehiclerouting.domain.VrpSchedule

    public VrpSchedule getSchedule() {
        return (VrpSchedule) solutionBusiness.getSolution();
    }

    public void resetPanel(Solution solution) {
        VrpSchedule schedule = (VrpSchedule) solution;
        vehicleRoutingWorldPanel.resetPanel(schedule);
        resetNextLocationId();
    }
View Full Code Here

Examples of org.drools.planner.examples.vehiclerouting.domain.VrpSchedule

        nextLocationId = highestLocationId + 1L;
    }

    @Override
    public void updatePanel(Solution solution) {
        VrpSchedule schedule = (VrpSchedule) solution;
        vehicleRoutingWorldPanel.updatePanel(schedule);
    }
View Full Code Here

Examples of org.drools.planner.examples.vehiclerouting.domain.VrpSchedule

        newLocation.setLongitude(longitude);
        newLocation.setLatitude(latitude);
        logger.info("Scheduling insertion of newLocation ({}).", newLocation);
        solutionBusiness.doProblemFactChange(new ProblemFactChange() {
            public void doChange(ScoreDirector scoreDirector) {
                VrpSchedule solution = (VrpSchedule) scoreDirector.getWorkingSolution();
                scoreDirector.beforeProblemFactAdded(newLocation);
                solution.getLocationList().add(newLocation);
                scoreDirector.afterProblemFactAdded(newLocation);
                VrpCustomer newCustomer = new VrpCustomer();
                newCustomer.setId(newLocation.getId());
                newCustomer.setLocation(newLocation);
                // Demand must not be 0
                newCustomer.setDemand(demandRandom.nextInt(10) + 1);
                scoreDirector.beforeEntityAdded(newCustomer);
                solution.getCustomerList().add(newCustomer);
                scoreDirector.afterEntityAdded(newCustomer);
            }
        });
        updatePanel(solutionBusiness.getSolution());
    }
View Full Code Here

Examples of org.drools.planner.examples.vehiclerouting.domain.VrpSchedule

        private int capacity;
        private Map<Long, VrpLocation> locationMap;
        private List<VrpDepot> depotList;

        public Solution readSolution() throws IOException {
            schedule = new VrpSchedule();
            schedule.setId(0L);
            readHeaders();
            readLocationList();
            readCustomerList();
            readDepotList();
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.