Search in sources :

Example 1 with ChocoMapper

use of org.btrplace.scheduler.choco.constraint.ChocoMapper in project scheduler by btrplace.

the class InstanceSolverRunner method makeViews.

private List<ChocoView> makeViews() throws SchedulerException {
    List<ChocoView> l = new ArrayList<>();
    ChocoMapper mapper = params.getMapper();
    origin.getViews().stream().filter(v -> mapper.viewHasMapping(v.getClass())).forEach(v -> l.add(mapper.get(v)));
    return l;
}
Also used : ChocoView(org.btrplace.scheduler.choco.view.ChocoView) LifeCycleViolationException(org.btrplace.scheduler.choco.LifeCycleViolationException) ChocoView(org.btrplace.scheduler.choco.view.ChocoView) Ready(org.btrplace.model.constraint.Ready) MeasuresRecorder(org.chocosolver.solver.search.measure.MeasuresRecorder) SchedulerException(org.btrplace.scheduler.SchedulerException) Node(org.btrplace.model.Node) OptConstraint(org.btrplace.model.constraint.OptConstraint) ContradictionException(org.chocosolver.solver.exception.ContradictionException) Callable(java.util.concurrent.Callable) SolvingStatistics(org.btrplace.scheduler.choco.runner.SolvingStatistics) CObjective(org.btrplace.scheduler.choco.constraint.CObjective) ReconfigurationPlan(org.btrplace.plan.ReconfigurationPlan) DefaultReconfigurationProblemBuilder(org.btrplace.scheduler.choco.DefaultReconfigurationProblemBuilder) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) VM(org.btrplace.model.VM) Running(org.btrplace.model.constraint.Running) SchedulerModelingException(org.btrplace.scheduler.SchedulerModelingException) Measures(org.chocosolver.solver.search.measure.Measures) ReconfigurationProblem(org.btrplace.scheduler.choco.ReconfigurationProblem) IMonitorSolution(org.chocosolver.solver.search.loop.monitors.IMonitorSolution) SearchState(org.chocosolver.solver.search.SearchState) ChocoMapper(org.btrplace.scheduler.choco.constraint.ChocoMapper) SatConstraint(org.btrplace.model.constraint.SatConstraint) Model(org.btrplace.model.Model) Sleeping(org.btrplace.model.constraint.Sleeping) Constraint(org.btrplace.model.constraint.Constraint) Collection(java.util.Collection) SolutionStatistics(org.btrplace.scheduler.choco.runner.SolutionStatistics) Set(java.util.Set) ChocoConstraint(org.btrplace.scheduler.choco.constraint.ChocoConstraint) Cause(org.chocosolver.solver.Cause) Parameters(org.btrplace.scheduler.choco.Parameters) IntVar(org.chocosolver.solver.variables.IntVar) List(java.util.List) Killed(org.btrplace.model.constraint.Killed) Metrics(org.btrplace.scheduler.choco.runner.Metrics) ChocoViews(org.btrplace.scheduler.choco.view.ChocoViews) Solution(org.chocosolver.solver.Solution) Optional(java.util.Optional) Instance(org.btrplace.model.Instance) ChocoMapper(org.btrplace.scheduler.choco.constraint.ChocoMapper) ArrayList(java.util.ArrayList)

Example 2 with ChocoMapper

use of org.btrplace.scheduler.choco.constraint.ChocoMapper in project scheduler by btrplace.

the class InstanceSolverRunner method build.

/**
 * Build a sat constraint
 *
 * @param cstr the model-side constraint
 * @return the solver-side constraint
 * @throws SchedulerException if the process failed
 */
private ChocoConstraint build(Constraint cstr) throws SchedulerException {
    ChocoMapper mapper = params.getMapper();
    ChocoConstraint cc = mapper.get(cstr);
    if (cc == null) {
        throw new SchedulerModelingException(origin, "No implementation mapped to '" + cstr.getClass().getSimpleName() + "'");
    }
    return cc;
}
Also used : ChocoMapper(org.btrplace.scheduler.choco.constraint.ChocoMapper) ChocoConstraint(org.btrplace.scheduler.choco.constraint.ChocoConstraint) SchedulerModelingException(org.btrplace.scheduler.SchedulerModelingException)

Aggregations

SchedulerModelingException (org.btrplace.scheduler.SchedulerModelingException)2 ChocoConstraint (org.btrplace.scheduler.choco.constraint.ChocoConstraint)2 ChocoMapper (org.btrplace.scheduler.choco.constraint.ChocoMapper)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Callable (java.util.concurrent.Callable)1 Instance (org.btrplace.model.Instance)1 Model (org.btrplace.model.Model)1 Node (org.btrplace.model.Node)1 VM (org.btrplace.model.VM)1 Constraint (org.btrplace.model.constraint.Constraint)1 Killed (org.btrplace.model.constraint.Killed)1 OptConstraint (org.btrplace.model.constraint.OptConstraint)1 Ready (org.btrplace.model.constraint.Ready)1 Running (org.btrplace.model.constraint.Running)1 SatConstraint (org.btrplace.model.constraint.SatConstraint)1