Package solver.variables

Examples of solver.variables.IntVar


    @Override
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        if (!identitymap.containsKey(this)) {
            this.vars[0].duplicate(solver, identitymap);
            IntVar X = (IntVar) identitymap.get(this.vars[0]);
            this.vars[1].duplicate(solver, identitymap);
            IntVar Y = (IntVar) identitymap.get(this.vars[1]);

            identitymap.put(this, new PropGreaterOrEqualX_Y(new IntVar[]{X, Y}));
        }
    }
View Full Code Here


        // total load for each period
        load = VariableFactory.enumeratedArray("load", n_periods, 0, load_per_period_ub - load_per_period_lb + 1, solver);
        // opt. target
        objective = VariableFactory.bounded("objective", load_per_period_lb, load_per_period_ub, solver);
        // sum variable
        IntVar sum = VariableFactory.bounded("courses_per_period", courses_per_period_lb, courses_per_period_ub, solver);
        // constraints
        for (int i = 0; i < n_periods; i++) {
            //forall(c in courses) (x[p,c] = bool2int(course_period[c] = p)) /\
            for (int j = 0; j < n_courses; j++) {
                solver.post(
View Full Code Here

  @Override
  public void buildModel(){
    // build variables
    starts = new IntVar[NUM_OF_TASKS];
    ends = new IntVar[NUM_OF_TASKS];
    IntVar duration = VariableFactory.fixed(10, solver);
    maxEnd = VariableFactory.bounded("maxEnd", 0, HORIZON, solver);
    IntVar[] res = new IntVar[NUM_OF_TASKS];
    Task[] tasks = new Task[NUM_OF_TASKS];
    for (int iTask=0; iTask < NUM_OF_TASKS; ++iTask) {
      starts[iTask] = VariableFactory.bounded("start" + iTask, 0, HORIZON, solver);
View Full Code Here

   * @param BOOLS an array of boolean variable
   * @return a constraint and ensuring that variables in BOOLS are all set to true
   */
  public static Constraint and(BoolVar... BOOLS){
    Solver s = BOOLS[0].getSolver();
    IntVar sum = VariableFactory.bounded(StringUtils.randomName(),0,BOOLS.length,s);
    s.post(IntConstraintFactory.sum(BOOLS,sum));
    return IntConstraintFactory.arithm(sum,"=",BOOLS.length);
  }
View Full Code Here

   * @param BOOLS an array of boolean variable
   * @return a constraint or ensuring that at least one variables in BOOLS is set to true
   */
  public static Constraint or(BoolVar... BOOLS){
    Solver s = BOOLS[0].getSolver();
    IntVar sum = VariableFactory.bounded(StringUtils.randomName(),0,BOOLS.length,s);
    s.post(IntConstraintFactory.sum(BOOLS,sum));
    return IntConstraintFactory.arithm(sum,">=",1);
  }
View Full Code Here

    @Override
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        if (!identitymap.containsKey(this)) {
            this.vars[0].duplicate(solver, identitymap);
            IntVar X = (IntVar) identitymap.get(this.vars[0]);
            this.vars[1].duplicate(solver, identitymap);
            IntVar Y = (IntVar) identitymap.get(this.vars[1]);

            identitymap.put(this, new PropGreaterOrEqualXY_C(new IntVar[]{X, Y}, this.cste));
        }
    }
View Full Code Here

    @Override
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        if (!identitymap.containsKey(this)) {
            this.vars[0].duplicate(solver, identitymap);
            IntVar X = (IntVar) identitymap.get(this.vars[0]);
            this.vars[1].duplicate(solver, identitymap);
            IntVar Y = (IntVar) identitymap.get(this.vars[1]);

            identitymap.put(this, new PropNotEqualXY_C(new IntVar[]{X, Y}, this.cste));
        }
    }
View Full Code Here

    @Override
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        if (!identitymap.containsKey(this)) {
            this.vars[0].duplicate(solver, identitymap);
            IntVar X = (IntVar) identitymap.get(this.vars[0]);
            this.vars[1].duplicate(solver, identitymap);
            IntVar Y = (IntVar) identitymap.get(this.vars[1]);
            this.vars[2].duplicate(solver, identitymap);
            IntVar Z = (IntVar) identitymap.get(this.vars[2]);

            identitymap.put(this, new PropMaxBC(X, Y, Z));
        }
    }
View Full Code Here

    @Override
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        if (!identitymap.containsKey(this)) {
            this.vars[0].duplicate(solver, identitymap);
            IntVar X = (IntVar) identitymap.get(this.vars[0]);
            this.vars[1].duplicate(solver, identitymap);
            IntVar Y = (IntVar) identitymap.get(this.vars[1]);

            identitymap.put(this, new PropBinFC(X, Y, (CouplesTable) relation.duplicate()));
        }
    }
View Full Code Here

                solver.post(IntConstraintFactory.global_cardinality(carSequence, options[optNum], atMost, false));
                IntVar[] atLeast = VariableFactory.boundedArray("atleast_" + optNum + "_" + seqStart, idleConfs[optNum].length, 0, max, solver);
                solver.post(IntConstraintFactory.global_cardinality(carSequence, idleConfs[optNum], atLeast, false));

                // all others configurations may be chosen
                IntVar sum = VariableFactory.bounded("sum", optfreq[optNum][1] - optfreq[optNum][0], 99999999, solver);
                solver.post(IntConstraintFactory.sum(atLeast, sum));
            }
        }

        int[] values = new int[expArray.length];
View Full Code Here

TOP

Related Classes of solver.variables.IntVar

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.