Example #1
0
  /**
   * Solves Phase 1 of the Simplex method.
   *
   * @param tableau simple tableau for the problem
   * @exception OptimizationException if the maximal number of iterations is exceeded, or if the
   *     problem is found not to have a bounded solution, or if there is no feasible solution
   */
  protected void solvePhase1(final SimplexTableau tableau) throws OptimizationException {
    // make sure we're in Phase 1
    if (tableau.getNumArtificialVariables() == 0) {
      return;
    }

    while (!isPhase1Solved(tableau)) {
      doIteration(tableau);
    }

    // if W is not zero then we have no feasible solution
    if (!MathUtils.equals(tableau.getEntry(0, tableau.getRhsOffset()), 0, epsilon)) {
      throw new NoFeasibleSolutionException();
    }
  }
Example #2
0
 /* 106:    */
 /* 107:    */ protected void solvePhase1(SimplexTableau tableau)
     /* 108:    */ throws MaxCountExceededException, UnboundedSolutionException,
         NoFeasibleSolutionException
       /* 109:    */ {
   /* 110:169 */ if (tableau.getNumArtificialVariables() == 0) {
     /* 111:170 */ return;
     /* 112:    */ }
   /* 113:173 */ while (!tableau.isOptimal()) {
     /* 114:174 */ doIteration(tableau);
     /* 115:    */ }
   /* 116:178 */ if (!Precision.equals(
       tableau.getEntry(0, tableau.getRhsOffset()), 0.0D, this.epsilon)) {
     /* 117:179 */ throw new NoFeasibleSolutionException();
     /* 118:    */ }
   /* 119:    */ }
Example #3
0
  /**
   * Solves Phase 1 of the Simplex method.
   *
   * @param tableau Simple tableau for the problem.
   * @throws TooManyIterationsException if the allowed number of iterations has been exhausted.
   * @throws UnboundedSolutionException if the model is found not to have a bounded solution.
   * @throws NoFeasibleSolutionException if there is no feasible solution?
   */
  protected void solvePhase1(final SimplexTableau tableau)
      throws TooManyIterationsException, UnboundedSolutionException, NoFeasibleSolutionException {

    // make sure we're in Phase 1
    if (tableau.getNumArtificialVariables() == 0) {
      return;
    }

    while (!tableau.isOptimal()) {
      doIteration(tableau);
    }

    // if W is not zero then we have no feasible solution
    if (!Precision.equals(tableau.getEntry(0, tableau.getRhsOffset()), 0d, epsilon)) {
      throw new NoFeasibleSolutionException();
    }
  }