@Test public void testMultipleStates() { Model mo = new DefaultModel(); VM vm0 = mo.newVM(); Node n0 = mo.newNode(); mo.getMapping().ready(vm0).on(n0); ReconfigurationProblem rp = new DefaultReconfigurationProblemBuilder(mo) .setNextVMsStates(new HashSet<>(Arrays.asList(vm0)), new HashSet<>(Arrays.asList(vm0)), new HashSet<>(Arrays.asList(vm0)), new HashSet<>(Arrays.asList(vm0)) ).build(); Assert.assertNull(rp.solve(2, false)); }
@Override public ReconfigurationPlan solve(int timeLimit, boolean optimize) throws SchedulerException { if (!distinctVMStates()) { return null; } if (!optimize) { solvingPolicy = ResolutionPolicy.SATISFACTION; } linkCardinalityWithSlices(); addContinuousResourceCapacities(); getRequiredView(Packing.VIEW_ID).beforeSolve(this); getRequiredView(Cumulatives.VIEW_ID).beforeSolve(this); getRequiredView(AliasedCumulatives.VIEW_ID).beforeSolve(this); if (timeLimit > 0) { solver.limitTime(timeLimit * 1000L); } if (solver.getSearch() == null) { defaultHeuristic(); } solver.plugMonitor((IMonitorSolution) () -> { Solution s = new Solution(csp); s.record(); solutions.add(s); }); if (solvingPolicy == ResolutionPolicy.SATISFACTION) { solver.findSolution(); } else { solver.findOptimalSolution(objective, solvingPolicy.equals(ResolutionPolicy.MAXIMIZE)); } if (solver.isFeasible() == ESat.UNDEFINED) { throw new UnstatableProblemException(model, timeLimit); } return makeResultingPlan(); }
DefaultReconfigurationProblem implements ReconfigurationProblem { @Override public ReconfigurationPlan solve(int timeLimit, boolean optimize) throws SchedulerException { if (!distinctVMStates()) { return null; } if (!optimize) { solvingPolicy = ResolutionPolicy.SATISFACTION; } linkCardinalityWithSlices(); addContinuousResourceCapacities(); getRequiredView(Packing.VIEW_ID).beforeSolve(this); getRequiredView(Cumulatives.VIEW_ID).beforeSolve(this); getRequiredView(AliasedCumulatives.VIEW_ID).beforeSolve(this); if (timeLimit > 0) { solver.limitTime(timeLimit * 1000L); } if (solver.getSearch() == null) { defaultHeuristic(); } solver.plugMonitor((IMonitorSolution) () -> { Solution s = new Solution(csp); s.record(); solutions.add(s); }); if (solvingPolicy == ResolutionPolicy.SATISFACTION) { solver.findSolution(); } else { solver.findOptimalSolution(objective, solvingPolicy.equals(ResolutionPolicy.MAXIMIZE)); } if (solver.isFeasible() == ESat.UNDEFINED) { throw new UnstatableProblemException(model, timeLimit); } return makeResultingPlan(); } }
DefaultReconfigurationProblem implements ReconfigurationProblem { @Override public ReconfigurationPlan solve(int timeLimit, boolean optimize) throws SchedulerException { if (!distinctVMStates()) { return null; } if (!optimize) { solvingPolicy = ResolutionPolicy.SATISFACTION; } linkCardinalityWithSlices(); addContinuousResourceCapacities(); getRequiredView(Packing.VIEW_ID).beforeSolve(this); getRequiredView(Cumulatives.VIEW_ID).beforeSolve(this); getRequiredView(AliasedCumulatives.VIEW_ID).beforeSolve(this); if (timeLimit > 0) { solver.limitTime(timeLimit * 1000L); } if (solver.getSearch() == null) { defaultHeuristic(); } solver.plugMonitor((IMonitorSolution) () -> { Solution s = new Solution(csp); s.record(); solutions.add(s); }); if (solvingPolicy == ResolutionPolicy.SATISFACTION) { solver.findSolution(); } else { solver.findOptimalSolution(objective, solvingPolicy.equals(ResolutionPolicy.MAXIMIZE)); } if (solver.isFeasible() == ESat.UNDEFINED) { throw new UnstatableProblemException(model, timeLimit); } return makeResultingPlan(); } DefaultReconfigurationProblem(Model m,
                                  Parameters ps,
                                  Set<VM> ready,
                                  Set<VM> running,
                                  Set<VM> sleeping,
                                  Set<VM> killed,
                                  Set<VM> preRooted); }
DefaultReconfigurationProblem implements ReconfigurationProblem { @Override public ReconfigurationPlan solve(int timeLimit, boolean optimize) throws SchedulerException { if (!distinctVMStates()) { return null; } if (!optimize) { solvingPolicy = ResolutionPolicy.SATISFACTION; } linkCardinalityWithSlices(); addContinuousResourceCapacities(); getRequiredView(Packing.VIEW_ID).beforeSolve(this); getRequiredView(Cumulatives.VIEW_ID).beforeSolve(this); getRequiredView(AliasedCumulatives.VIEW_ID).beforeSolve(this); if (timeLimit > 0) { solver.limitTime(timeLimit * 1000L); } if (solver.getSearch() == null) { defaultHeuristic(); } solver.plugMonitor((IMonitorSolution) () -> { Solution s = new Solution(csp); s.record(); solutions.add(s); }); if (solvingPolicy == ResolutionPolicy.SATISFACTION) { solver.findSolution(); } else { solver.findOptimalSolution(objective, solvingPolicy.equals(ResolutionPolicy.MAXIMIZE)); } if (solver.isFeasible() == ESat.UNDEFINED) { throw new UnstatableProblemException(model, timeLimit); } return makeResultingPlan(); } DefaultReconfigurationProblem(Model m,
                                  Parameters ps,
                                  Set<VM> ready,
                                  Set<VM> running,
                                  Set<VM> sleeping,
                                  Set<VM> killed,
                                  Set<VM> preRooted); @Override ReconfigurationPlan solve(int timeLimit, boolean optimize); @Override List<ReconfigurationPlan> getComputedSolutions(); @Override @SuppressWarnings("squid:S3346") ReconfigurationPlan buildReconfigurationPlan(Solution s, Model src); @Override final VMState getFutureState(VM v); @Override VMState getSourceState(VM v); @Override NodeState getSourceState(Node n); @Override int getCurrentVMLocation(int vmIdx); @Override List<IntVar> getNbRunningVMs(); @Override final ChocoView getView(String id); @Override Collection<String> getViews(); @Override boolean addView(ChocoView v); @Override Solver getSolver(); @Override org.chocosolver.solver.Model getModel(); @Override IntVar makeHostVariable(Object... n); @Override IntVar makeCurrentHost(VM vmId, Object... n); @Override IntVar makeCurrentNode(Node nId, Object... n); @Override IntVar makeUnboundedDuration(Object... n); @Override IntVar makeDuration(int ub, int lb, Object... n); @Override final String makeVarLabel(Object... lbl); @Override IntVar fixed(int v, Object... lbl); @Override Set<VM> getManageableVMs(); @Override Logger getLogger(); @Override List<NodeTransition> getNodeActions(); @Override DurationEvaluators getDurationEvaluators(); @Override List<Node> getNodes(); @Override List<VM> getVMs(); @Override Model getSourceModel(); @Override Set<VM> getFutureRunningVMs(); @Override Set<VM> getFutureReadyVMs(); @Override Set<VM> getFutureSleepingVMs(); @Override Set<VM> getFutureKilledVMs(); @Override IntVar getStart(); @Override IntVar getEnd(); @Override int getVM(VM vm); @Override VM getVM(int idx); @Override int getNode(Node n); @Override Node getNode(int idx); @Override List<VMTransition> getVMActions(); @Override List<VMTransition> getVMActions(Collection<VM> ids); @Override VMTransition getVMAction(VM id); @Override NodeTransition getNodeAction(Node id); @Override VM cloneVM(VM vm); @Override IntVar getObjective(); @Override void setObjective(boolean b, IntVar v); @Override ResolutionPolicy getResolutionPolicy(); @Override void stop(); }
DefaultReconfigurationProblem implements ReconfigurationProblem { @Override public ReconfigurationPlan solve(int timeLimit, boolean optimize) throws SchedulerException { if (!distinctVMStates()) { return null; } if (!optimize) { solvingPolicy = ResolutionPolicy.SATISFACTION; } linkCardinalityWithSlices(); addContinuousResourceCapacities(); getRequiredView(Packing.VIEW_ID).beforeSolve(this); getRequiredView(Cumulatives.VIEW_ID).beforeSolve(this); getRequiredView(AliasedCumulatives.VIEW_ID).beforeSolve(this); if (timeLimit > 0) { solver.limitTime(timeLimit * 1000L); } if (solver.getSearch() == null) { defaultHeuristic(); } solver.plugMonitor((IMonitorSolution) () -> { Solution s = new Solution(csp); s.record(); solutions.add(s); }); if (solvingPolicy == ResolutionPolicy.SATISFACTION) { solver.findSolution(); } else { solver.findOptimalSolution(objective, solvingPolicy.equals(ResolutionPolicy.MAXIMIZE)); } if (solver.isFeasible() == ESat.UNDEFINED) { throw new UnstatableProblemException(model, timeLimit); } return makeResultingPlan(); } DefaultReconfigurationProblem(Model m,
                                  Parameters ps,
                                  Set<VM> ready,
                                  Set<VM> running,
                                  Set<VM> sleeping,
                                  Set<VM> killed,
                                  Set<VM> preRooted); @Override ReconfigurationPlan solve(int timeLimit, boolean optimize); @Override List<ReconfigurationPlan> getComputedSolutions(); @Override @SuppressWarnings("squid:S3346") ReconfigurationPlan buildReconfigurationPlan(Solution s, Model src); @Override final VMState getFutureState(VM v); @Override VMState getSourceState(VM v); @Override NodeState getSourceState(Node n); @Override int getCurrentVMLocation(int vmIdx); @Override List<IntVar> getNbRunningVMs(); @Override final ChocoView getView(String id); @Override Collection<String> getViews(); @Override boolean addView(ChocoView v); @Override Solver getSolver(); @Override org.chocosolver.solver.Model getModel(); @Override IntVar makeHostVariable(Object... n); @Override IntVar makeCurrentHost(VM vmId, Object... n); @Override IntVar makeCurrentNode(Node nId, Object... n); @Override IntVar makeUnboundedDuration(Object... n); @Override IntVar makeDuration(int ub, int lb, Object... n); @Override final String makeVarLabel(Object... lbl); @Override IntVar fixed(int v, Object... lbl); @Override Set<VM> getManageableVMs(); @Override Logger getLogger(); @Override List<NodeTransition> getNodeActions(); @Override DurationEvaluators getDurationEvaluators(); @Override List<Node> getNodes(); @Override List<VM> getVMs(); @Override Model getSourceModel(); @Override Set<VM> getFutureRunningVMs(); @Override Set<VM> getFutureReadyVMs(); @Override Set<VM> getFutureSleepingVMs(); @Override Set<VM> getFutureKilledVMs(); @Override IntVar getStart(); @Override IntVar getEnd(); @Override int getVM(VM vm); @Override VM getVM(int idx); @Override int getNode(Node n); @Override Node getNode(int idx); @Override List<VMTransition> getVMActions(); @Override List<VMTransition> getVMActions(Collection<VM> ids); @Override VMTransition getVMAction(VM id); @Override NodeTransition getNodeAction(Node id); @Override VM cloneVM(VM vm); @Override IntVar getObjective(); @Override void setObjective(boolean b, IntVar v); @Override ResolutionPolicy getResolutionPolicy(); @Override void stop();  }