Package com.exigen.ie.constrainer

Examples of com.exigen.ie.constrainer.Constrainer


    this("");
  }

  public Problem(String id) {
    super(id);
    constrainer = new Constrainer(id);
    falseConstraint = null;
    trueConstraint = null;
    setDomainType(DomainType.DOMAIN_SMALL);
    //log(getImplVersion());
    if (!id.isEmpty())
View Full Code Here


    constraint.setImpl(constrainerVar.constrainer().addConstraint(exp));
  }

  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);
    }
View Full Code Here

   * Example: cardinality(vars,cardVar) < value
   */
  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) {
      throw new RuntimeException(
          "Failure to create constraint "+name);
    }
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(
          "Failure to create GlobalCardinality constraint");
    }
  }
View Full Code Here

  static final String name = "Element";
 
  public Element(int[] array, Var indexVar, String oper, int value) {
    super(indexVar.getProblem(),name);
    Problem problem = (Problem) indexVar.getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntArray intValues = new IntArray(constrainer, array.length);
    for (int i = 0; i < array.length; i++) {
      intValues.set(array[i], i);
    }
    try {
View Full Code Here

  }
 
  public Element(int[] array, Var indexVar, String oper, Var var) {
    super(indexVar.getProblem(),name);
    Problem problem = (Problem) indexVar.getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntArray intValues = new IntArray(constrainer, array.length);
    for (int i = 0; i < array.length; i++) {
      intValues.set(array[i], i);
    }
    try {
View Full Code Here

  }
 
  public Element(Var[] vars, Var indexVar, String oper, int value) {
    super(indexVar.getProblem(),name);
    Problem problem = (Problem) indexVar.getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntExpArray intvars = new IntExpArray(constrainer, vars.length);
    for (int i = 0; i < vars.length; i++) {
      IntExp exp = (IntExp)vars[i].getImpl();
      intvars.set(exp, i);
    }
View Full Code Here

  }
 
  public Element(Var[] vars, Var indexVar, String oper, Var var) {
    super(indexVar.getProblem(),name);
    Problem problem = (Problem) indexVar.getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntExpArray intvars = new IntExpArray(constrainer, vars.length);
    for (int i = 0; i < vars.length; i++) {
      IntExp exp = (IntExp)vars[i].getImpl();
      intvars.set(exp, i);
    }
View Full Code Here

  }

  public Linear(int[] values, Var[] vars, String oper, int value) {
    super(vars[0].getProblem(), name);
    Problem problem = (Problem) vars[0].getProblem();
    Constrainer constrainer = problem.getConstrainer();
    IntExpArray intvars = new IntExpArray(constrainer, vars.length);
    for (int i = 0; i < vars.length; i++) {
      IntExp cvar = (IntExp) vars[i].getImpl();
      intvars.set(cvar, i);
    }
    IntExp scalProd = constrainer.scalarProduct(intvars, values);
    problem.defineConstraintImpl(this, scalProd, oper, value);
  }
View Full Code Here

TOP

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

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.