Package solver

Examples of solver.Solver


  // METHODS
  //***********************************************************************************

  @Override
  public void createSolver() {
    solver = new Solver("Pareto sample");
  }
View Full Code Here


    IntVar objective;


    @Override
    public void createSolver() {
        solver = new Solver("BACP");
    }
View Full Code Here

    Constraint alldiff;
    Constraint[] distances;

    @Override
    public void createSolver() {
        solver = new Solver("Golomb Ruler");
    }
View Full Code Here

   * Make a and constraint
   * @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

            return VAR;
        }
        if (Configuration.ENABLE_VIEWS) {
            return new OffsetView(VAR, CSTE, VAR.getSolver());
        } else {
            Solver s = VAR.getSolver();
            int lb = VAR.getLB() + CSTE;
            int ub = VAR.getUB() + CSTE;
            String name = "(" + VAR.getName() + "+" + CSTE + ")";
            IntVar ov;
            if (VAR.hasEnumeratedDomain()) {
                ov = enumerated(name, lb, ub, s);
            } else {
                ov = bounded(name, lb, ub, s);
            }
            s.post(ICF.arithm(ov, "-", VAR, "=", CSTE));
            return ov;
        }
    }
View Full Code Here

  IntVar[] starts, ends;
  IntVar maxEnd;

  @Override
  public void createSolver(){
    solver = new Solver("schedule");
  }
View Full Code Here

            return new BoolNotView(BOOL, BOOL.getSolver());
        } else {
            if (BOOL.hasNot()) {
                return BOOL.not();
            } else {
                Solver s = BOOL.getSolver();
                BoolVar ov = bool("not(" + BOOL.getName() + ")", s);
                s.post(ICF.arithm(ov, "!=", BOOL));
                BOOL._setNot(ov);
                ov._setNot(BOOL);
                ov.setNot(true);
                return ov;
            }
View Full Code Here

   * Make an or constraint
   * @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

     */
    public static IntVar minus(IntVar VAR) {
        if (Configuration.ENABLE_VIEWS) {
            return new MinusView(VAR, VAR.getSolver());
        } else {
            Solver s = VAR.getSolver();
            int ub = -VAR.getLB();
            int lb = -VAR.getUB();
            String name = "-(" + VAR.getName() + ")";
            IntVar ov;
            if (VAR.hasEnumeratedDomain()) {
                ov = enumerated(name, lb, ub, s);
            } else {
                ov = bounded(name, lb, ub, s);
            }
            s.post(ICF.arithm(ov, "+", VAR, "=", 0));
            return ov;
        }
    }
View Full Code Here

                var = VAR;
            } else {
                if (Configuration.ENABLE_VIEWS) {
                    var = new ScaleView(VAR, CSTE, VAR.getSolver());
                } else {
                    Solver s = VAR.getSolver();
                    int lb = VAR.getLB() * CSTE;
                    int ub = VAR.getUB() * CSTE;
                    String name = "(" + VAR.getName() + "*" + CSTE + ")";
                    IntVar ov;
                    if (VAR.hasEnumeratedDomain()) {
                        ov = enumerated(name, lb, ub, s);
                    } else {
                        ov = bounded(name, lb, ub, s);
                    }
                    s.post(ICF.times(VAR, CSTE, ov));
                    return ov;
                }
            }
            return var;
        }
View Full Code Here

TOP

Related Classes of solver.Solver

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.