Package solver

Examples of solver.Solver.post()


            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


   * @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);
  }

  /**
   * Make an or constraint
View Full Code Here

            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

   * @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);
  }

  //***********************************************************************************
  // Constraint-based constraints
View Full Code Here

            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

                    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

            if (VAR.hasEnumeratedDomain()) {
                abs = enumerated(name, 0, ub, s);
            } else {
                abs = bounded(name, 0, ub, s);
            }
            s.post(IntConstraintFactory.absolute(abs, VAR));
            return abs;
        }
    }

    /**
 
View Full Code Here

        } else {
            Solver s = VAR.getSolver();
            double lb = VAR.getLB();
            double ub = VAR.getUB();
            RealVar rv = real("(real)" + VAR.getName(), lb, ub, PRECISION, s);
            s.post(new IntEqRealConstraint(VAR, rv, PRECISION));
            return rv;
        }
    }

    /**
 
View Full Code Here

            for (int i = 0; i < VARS.length; i++) {
                double lb = VARS[i].getLB();
                double ub = VARS[i].getUB();
                reals[i] = real("(real)" + VARS[i].getName(), lb, ub, PRECISION, s);
            }
            s.post(new IntEqRealConstraint(VARS, reals, PRECISION));
        }
        return reals;
    }
}
View Full Code Here

     */
    public final void reifyWith(BoolVar bool) {
        Solver s = propagators[0].getSolver();
        if (boolReif == null) {
            boolReif = bool;
            s.post(new ReificationConstraint(boolReif, this, getOpposite()));
        } else {
            s.post(ICF.arithm(bool, "=", boolReif));
        }
    }

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.