Package solver.exception

Examples of solver.exception.SolverException


     * @param mask         type of event
     * @throws solver.exception.ContradictionException if a contradiction occurs
     */
    public void propagate(int idxVarInProp, int mask) throws ContradictionException {
        if (reactToFineEvt) {
            throw new SolverException(this + " has been declared to ignore which variable is modified.\n" +
                    "To change the configuration, consider:\n" +
                    "- to set 'reactToFineEvt' to false or,\n" +
                    "- to override the following methode:\n" +
                    "\t'public void propagate(int idxVarInProp, int mask) throws ContradictionException'." +
                    "The latter enables incrementality but also to delay calls to complex filtering algorithm (see the method 'forcePropagate(EventType evt)'.");
View Full Code Here


     *
     * @param solver      the target solver
     * @param identitymap a map to ensure uniqueness of objects
     */
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        throw new SolverException("The propagator cannot be duplicated: the method is not defined.");
    }
View Full Code Here

    public final IndexedObject getObject(final int index) {
        return idxToObjects[list[index]];
    }

    public final int set(final int index, final int val) {
        throw new SolverException("setting an element is not permitted on this structure");
    }
View Full Code Here

            } else if (operator == Operator.GT) {
                return ESat.eval(Math.abs(vars[0].getValue() - vars[1].getValue()) > cste);
            } else if (operator == Operator.NQ) {
                return ESat.eval(Math.abs(vars[0].getValue() - vars[1].getValue()) != cste);
            } else {
                throw new SolverException("operator not known");
            }
        }
        return ESat.UNDEFINED;
    }
View Full Code Here

     *
     * @param variable
     */
    public void unassociates(Variable variable) {
        if (variable.getNbProps() > 0) {
            throw new SolverException("Try to remove a variable (" + variable.getName() + ")which is still involved in at least one constraint");
        }
        int idx = 0;
        for (; idx < vIdx; idx++) {
            if (variable == vars[idx]) break;
        }
View Full Code Here

     * @param c constraint to add
     */
    public void postTemp(Constraint c) throws ContradictionException {
        _post(false, c);
        if (engine == NoPropagationEngine.SINGLETON || !engine.isInitialized()) {
            throw new SolverException("Try to post a temporary constraint while the resolution has not begun.\n" +
                    "A call to Solver.post(Constraint) is more appropriate.");
        }
        for (Propagator propagator : c.getPropagators()) {
            PropagationTrigger.execute(propagator, engine);
        }
View Full Code Here

            }
            if (cs[i].isReified()) {
                try {
                    cs[i].reif().setToTrue(Cause.Null);
                } catch (ContradictionException e) {
                    throw new SolverException("post a constraint whose reification BoolVar is already set to false: no solution can exist");
                }
            }
        }
    }
View Full Code Here

     * @param policy    optimization policy, among ResolutionPolicy.MINIMIZE and ResolutionPolicy.MAXIMIZE
     * @param objective the variable to optimize
     */
    public void findOptimalSolution(ResolutionPolicy policy, IntVar objective) {
        if (policy == ResolutionPolicy.SATISFACTION) {
            throw new SolverException("Solver.findOptimalSolution(...) cannot be called with ResolutionPolicy.SATISFACTION.");
        }
        if (objective == null) {
            throw new SolverException("No objective variable has been defined");
        }
        if (!getObjectiveManager().isOptimization()) {
            set(new ObjectiveManager<IntVar, Integer>(objective, policy, true));
        }
        set(new LastSolutionRecorder(new Solution(), true, this));
View Full Code Here

                set(new AllSolutionsRecorder(this));
                findAllSolutions();
            }
        } else {
            if (policy == ResolutionPolicy.SATISFACTION) {
                throw new SolverException("Solver.findAllOptimalSolutions(...) cannot be called with ResolutionPolicy.SATISFACTION.");
            }
            if (objective == null) {
                throw new SolverException("No objective variable has been defined");
            }
            if (!getObjectiveManager().isOptimization()) {
                set(new ObjectiveManager<IntVar, Integer>(objective, policy, false));
            }
            set(new BestSolutionsRecorder(objective));
View Full Code Here

     * @param policy     optimization policy, among ResolutionPolicy.MINIMIZE and ResolutionPolicy.MAXIMIZE
     * @param objectives the variables to optimize. BEWARE they should all respect the SAME optimization policy
     */
    public void findParetoFront(ResolutionPolicy policy, IntVar... objectives) {
        if (policy == ResolutionPolicy.SATISFACTION) {
            throw new SolverException("Solver.findParetoFront(...) cannot be called with ResolutionPolicy.SATISFACTION.");
        }
        if (objectives == null || objectives.length == 0) {
            throw new SolverException("No objective variable has been defined");
        }
        if (objectives.length == 1) {
            throw new SolverException("Only one objective variable has been defined. Pareto is relevant with >1 objective");
        }
        // BEWARE the usual optimization manager is only defined for mono-objective optimization
        // so we use a satisfaction manager by default (it does nothing)
        if (getObjectiveManager().isOptimization()) {
            set(new ObjectiveManager<IntVar, Integer>(null, ResolutionPolicy.SATISFACTION, false));
View Full Code Here

TOP

Related Classes of solver.exception.SolverException

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.