Examples of CostAutomaton


Examples of solver.constraints.nary.automata.FA.CostAutomaton

        for (int i = 0; i < n; i++) {
            vars[i] = VariableFactory.enumerated("x_" + i, 0, 2, solver);
        }
        IntVar cost = VariableFactory.bounded("z", 3, 4, solver);

        CostAutomaton auto = new CostAutomaton();
        int start = auto.addState();
        int end = auto.addState();
        auto.setInitialState(start);
        auto.setFinal(start);
        auto.setFinal(end);

        auto.addTransition(start, start, 0, 1);
        auto.addTransition(start, end, 2);

        auto.addTransition(end, start, 2);
        auto.addTransition(end, start, 0, 1);

        int[][][] costs = new int[n][3][2];
        for (int i = 0; i < costs.length; i++) {
            costs[i][0][1] = 1;
            costs[i][1][1] = 1;
        }

        ICounter c = new CounterState(costs, 3, 4);

        auto.addCounter(c);

        solver.post(IntConstraintFactory.cost_regular(vars, cost, auto));
        solver.set(IntStrategyFactory.lexico_LB(vars));

        solver.findAllSolutions();
View Full Code Here

Examples of solver.constraints.nary.automata.FA.CostAutomaton

            costs[i][0] = 1;
            costs[i][1] = 1;
        }

        ICounter c = new Counter(costs, 0, 4);
        CostAutomaton cauto = new CostAutomaton(auto, c);

        solver.post(IntConstraintFactory.cost_regular(vars, cost, cauto));
        solver.set(IntStrategyFactory.lexico_LB(vars));

        solver.findAllSolutions();
View Full Code Here

Examples of solver.constraints.nary.automata.FA.CostAutomaton

        for (int i = 0; i < n; i++) {
            vars[i] = VariableFactory.enumerated("x_" + i, 0, 2, solver);
        }
        IntVar cost = VariableFactory.bounded("z", 10, 10, solver);

        CostAutomaton auto = new CostAutomaton();
        int start = auto.addState();
        int end = auto.addState();
        auto.setInitialState(start);
        auto.setFinal(start);
        auto.setFinal(end);

        auto.addTransition(start, start, 0, 1);
        auto.addTransition(start, end, 2);

        auto.addTransition(end, start, 2);
        auto.addTransition(end, start, 0, 1);

        int[][][] costs = new int[n][3][2];
        for (int i = 0; i < costs.length; i++) {
            for (int k = 0; k < 2; k++) {
                costs[i][0][k] = 1;
                costs[i][1][k] = 1;
            }
        }

        auto.addCounter(new CounterState(costs, 10, 10));

        solver.post(IntConstraintFactory.cost_regular(vars, cost, auto));
        solver.set(IntStrategyFactory.lexico_LB(vars));

        solver.findAllSolutions();
View Full Code Here

Examples of solver.constraints.nary.automata.FA.CostAutomaton

        for (int i = 0; i < n; i++) {
            vars[i] = VariableFactory.enumerated("x_" + i, 0, 2, solver);
        }
        IntVar cost = VariableFactory.bounded("z", 4, 6, solver);

        CostAutomaton auto = new CostAutomaton();
        int start = auto.addState();
        int end = auto.addState();
        auto.setInitialState(start);
        auto.setFinal(start);
        auto.setFinal(end);

        auto.addTransition(start, start, 0, 1);
        auto.addTransition(start, end, 2);

        auto.addTransition(end, start, 2);
        auto.addTransition(end, start, 0, 1);

        int[][][] costs = new int[n][3][2];
        for (int i = 0; i < costs.length; i++) {
            costs[i][0][1] = 1;
            costs[i][1][1] = 1;
        }

        auto.addCounter(new CounterState(costs, 4, 6));

        solver.post(IntConstraintFactory.cost_regular(vars, cost, auto));
        solver.set(IntStrategyFactory.lexico_LB(vars));

        solver.findAllSolutions();
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.