Package solver.exception

Examples of solver.exception.SolverException


  }

  @Override
  public void launch(boolean stopatfirst) {
    if (nextState != INIT) {
      throw new SolverException("!! The search has not been initialized.\n" +
          "!! Be sure you are respecting one of these call configurations :\n " +
          "\tfindSolution ( nextSolution )* | findAllSolutions | findOptimalSolution\n");
    }
    this.stopAtFirstSolution = stopatfirst;
    loop();
View Full Code Here


  }

  @Override
  public void resume() {
    if (nextState == INIT) {
      throw new SolverException("the search loop has not been initialized.\n " +
          "This appears when 'nextSolution' is called before 'findSolution'.");
    } else if (nextState != RESUME) {
      throw new SolverException("The search cannot be resumed.");
    }
    moveTo(UP_BRANCH);
    loop();
  }
View Full Code Here


        if (intLayer[0].length > 0)
            return new StoredValuedDirectedMultiGraph(environment, graph, intLayer, starts, offsets, totalSizes);
        else
            throw new SolverException("intLayer[0].length <= 0");
    }
View Full Code Here


    public DistanceXYZ(IntVar x, IntVar y, Operator op, IntVar z) {
        super("DistanceXYZ " + op.name(), new PropDistanceXYZ(ArrayUtils.toArray(x, y, z), op));
        if (op != Operator.EQ && op != Operator.GT && op != Operator.LT) {
            throw new SolverException("Unexpected operator for distance");
        }
        this.X = x;
        this.Y = y;
        this.Z = z;
        this.OP = op;
View Full Code Here

    }

    public Times(IntVar v1, IntVar v2, IntVar result) {
        super("Times",new PropTimesNaive(v1,v2,result));
        if (!inIntBounds(v1, v2)) {
            throw new SolverException("Integer overflow.\nConsider reducing the variable domains.");
        }
    }
View Full Code Here

      case LE: // X <= C
        return new PropLessOrEqualXC(var, cste);
      case LT: // X < C --> X <= C - 1
        return new PropLessOrEqualXC(var, cste - 1);
      default:
        throw new SolverException("Incorrect formula; operator should be one of those:{=, !=, >=, >, <=, <}");
    }
  }
View Full Code Here

      case LE: //  X <= Y --> Y >= X
        return new PropGreaterOrEqualX_Y(new IntVar[]{var2, var1});
      case LT: //  X < Y --> Y >= X + 1
        return new PropGreaterOrEqualX_YC(new IntVar[]{var2, var1}, 1);
      default:
        throw new SolverException("Incorrect formula; operator should be one of those:{=, !=, >=, >, <=, <}");
    }
  }
View Full Code Here

    super("ArithmeticBinary",createProp(var1,op1,var2,op2,cste));
    this.vars = new IntVar[]{var1,var2};
    this.op1 = op1;
    this.op2 = op2;
    if (isOperation(op1) == isOperation(op2)) {
      throw new SolverException("Incorrect formula; operators must be different!");
    }
    this.cste = cste;
  }
View Full Code Here

  private static Propagator createProp(IntVar var1, Operator op1, IntVar var2, Operator op2, int cste) {
    if(op1==null)throw new UnsupportedOperationException();
    if(op2==null)throw new UnsupportedOperationException();
    if (isOperation(op1) == isOperation(op2)) {
      throw new SolverException("Incorrect formula; operators must be different!");
    }
    IntVar[] vars = new IntVar[]{var1,var2};
    if (op1 == Operator.PL) {
      switch (op2) {
        case EQ: // X+Y = C
          return new PropEqualXY_C(vars, cste);
        case NQ: // X+Y != C
          return new PropNotEqualXY_C(vars, cste);
        case GE: // X+Y >= C
          return new PropGreaterOrEqualXY_C(vars, cste);
        case GT: // X+Y > C --> X+Y >= C+1
          return new PropGreaterOrEqualXY_C(vars, cste + 1);
        case LE: // X+Y <= C
          return new PropLessOrEqualXY_C(vars, cste);
        case LT: // X+Y < C --> X+Y <= C-1
          return new PropLessOrEqualXY_C(vars, cste - 1);
        default:
          throw new SolverException("Incorrect formula; operator should be one of those:{=, !=, >=, >, <=, <}");
      }
    } else if (op1 == Operator.MN) {
      switch (op2) {
        case EQ: // X-Y = C --> X = Y+C
          return new PropEqualX_YC(vars, cste);
        case NQ: // X-Y != C --> X != Y+C
          return new PropNotEqualX_YC(vars, cste);
        case GE: // X-Y >= C --> X >= Y+C
          return new PropGreaterOrEqualX_YC(vars, cste);
        case GT: // X-Y > C --> X >= Y+C+1
          return new PropGreaterOrEqualX_YC(vars, cste + 1);
        case LE:// X-Y <= C --> Y >= X-C
          return new PropGreaterOrEqualX_YC(new IntVar[]{var2, var1}, -cste);
        case LT:// X-Y < C --> Y >= X-C+1
          return new PropGreaterOrEqualX_YC(new IntVar[]{var2, var1}, -cste + 1);
        default:
          throw new SolverException("Incorrect formula; operator should be one of those:{=, !=, >=, >, <=, <}");
      }
    } else {
      int _cste = cste * (op2 == Operator.PL ? 1 : -1);
      switch (op1) {
        case EQ:// X = Y + C
          return new PropEqualX_YC(vars, _cste);
        case NQ:// X =/= Y + C
          return new PropNotEqualX_YC(vars, _cste);
        case GE:// X >= Y + C
          return new PropGreaterOrEqualX_YC(vars, _cste);
        case GT:// X > Y + C --> X >= Y + C + 1
          return new PropGreaterOrEqualX_YC(vars, _cste + 1);
        case LE:// X <= Y + C --> Y >= X - C
          return new PropGreaterOrEqualX_YC(new IntVar[]{var2, var1}, -_cste);
        case LT:// X < Y + C --> Y > X - C + 1
          return new PropGreaterOrEqualX_YC(new IntVar[]{var2, var1}, -_cste + 1);
        default:
          throw new SolverException("Incorrect formula; operator should be one of those:{=, !=, >=, >, <=, <}");
      }
    }
  }
View Full Code Here

    public int getRelationOffset(int var) {
        return lowerbounds[var];
    }

    public boolean checkTuple(int[] tuple) {
        throw new SolverException("checkTuple should not be used on an IterRelation");
    }
View Full Code Here

TOP

Related Classes of solver.exception.SolverException

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.