Package com.exigen.ie.constrainer

Examples of com.exigen.ie.constrainer.IntExpArray


  public AllDifferent(Var[] vars) {
    super(vars[0].getProblem(),"AllDiff");
    Problem problem = (Problem) getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntExpArray intvars = new IntExpArray(constrainer,vars.length);
    for(int i=0; i<vars.length; i++) {
      IntExp var = (IntExp)vars[i].getImpl();
      intvars.set(var, i);
    }

    com.exigen.ie.constrainer.Constraint allDiff =
      new com.exigen.ie.constrainer.impl.ConstraintAllDiff(intvars);
    setImpl(constrainer.addConstraint(allDiff));
View Full Code Here


  }
 
  public IntExpArray createConstrainerVars(Var[] vars) {
    javax.constraints.impl.Problem p = (javax.constraints.impl.Problem)getProblem();
    Constrainer constrainer = p.getConstrainer();
    IntExpArray intvars = new IntExpArray(constrainer,vars.length);
    for(int i=0; i<vars.length; i++) {
      IntExp var = (IntExp)vars[i].getImpl();
      intvars.set(var, i);
    }
    return intvars;
  }
View Full Code Here

      trace(vars[i],event);
    }
   
    Problem p = (Problem)getProblem();
    Constrainer constrainer = p.getConstrainer();
    IntExpArray intvars = new IntExpArray(constrainer,vars.length);
    for(int i=0; i<vars.length; i++) {
      IntExp var = (IntExp)vars[i].getImpl();
      intvars.set(var, i);
    }
    constrainer.trace(intvars);
  }
View Full Code Here

  }

  public IntExpArray getExpArray(Var[] vars) {
    Problem problem = (Problem) vars[0].getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntExpArray cVars = new IntExpArray(constrainer, vars.length);
    for (int i = 0; i < vars.length; i++) {
      IntExp exp = (IntExp) vars[i].getImpl();
      cVars.set(exp, i);
    }
    return cVars;
  }
View Full Code Here

   */
  public Cardinality(Var[] vars, int cardValue, String oper, Var var) {
    super(vars[0].getProblem(),name);
    Problem problem = (Problem) vars[0].getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntExpArray cVars = problem.getExpArray(vars);
    try {
      IntExp cardinality = constrainer.cardinality(cVars,cardValue);
      problem.defineConstraintImpl(this, cardinality, oper, var);
    } catch (Exception f) {
      throw new RuntimeException(
View Full Code Here

   */
  public Cardinality(Var[] vars, Var cardVar, String oper, Var var) {
    super(vars[0].getProblem(),name);
    Problem problem = (Problem) vars[0].getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntExpArray cVars = problem.getExpArray(vars);
    try {
      IntExp cVar = (IntExp) cardVar.getImpl();
      IntExp cardinality = constrainer.cardinality(cVars,cVar);
      problem.defineConstraintImpl(this, cardinality, oper, var);
    } catch (Exception f) {
View Full Code Here

   */
  public Cardinality(Var[] vars, int cardValue, String oper, int value) {
    super(vars[0].getProblem(),name);
    Problem problem = (Problem) vars[0].getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntExpArray cVars = problem.getExpArray(vars);
    try {
      IntExp cardinality = constrainer.cardinality(cVars,cardValue);
      problem.defineConstraintImpl(this, cardinality, oper, value);
    } catch (Exception f) {
      throw new RuntimeException(
View Full Code Here

   */
  public Cardinality(Var[] vars, Var cardVar, String oper, int value) {
    super(vars[0].getProblem(),name);
    Problem problem = (Problem) vars[0].getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntExpArray cVars = problem.getExpArray(vars);
    try {
      IntExp cVar = (IntExp) cardVar.getImpl();
      IntExp cardinality = constrainer.cardinality(cVars,cVar);
      problem.defineConstraintImpl(this, cardinality, oper, value);
    } catch (Exception f) {
View Full Code Here

 
  public void defineNativeImpl(Var[] vars, Var[] cardVars, int[] values) {
    Problem problem = (Problem) vars[0].getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntExpArray cVars = problem.getExpArray(vars);   
    IntExpArray cCardinalityVars = problem.getExpArray(cardVars);
    try {
      IntExpArray cards = constrainer.distribute(cVars,values);
      Constraint newC = new ConstrainerIntExpArrayEq(cards,cCardinalityVars);
      setImpl(constrainer.addConstraint(newC));
    } catch (Exception f) {
      throw new RuntimeException(
          "Failure to create GlobalCardinality constraint");
View Full Code Here

  }
 
  public void defineNativeImpl(Var[] vars, Var[] cardVars, Var[] valueVars) {
    Problem problem = (Problem) vars[0].getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntExpArray cVars = problem.getExpArray(vars);
    IntExpArray cValueVars = problem.getExpArray(valueVars);
    IntExpArray cCardVars = problem.getExpArray(valueVars);
    try {
      IntArrayCards givenCards = cCardVars.cards();
      IntArrayCards distributedCards = constrainer.distribute(cVars,cValueVars);
      Constraint newC = new ConstrainerArrayCardsEq(distributedCards,givenCards);
      setImpl(constrainer.addConstraint(newC));
    } catch (Exception f) {
      throw new RuntimeException(
View Full Code Here

TOP

Related Classes of com.exigen.ie.constrainer.IntExpArray

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.