@Override protected void performIteration() { QuadraticSolver tmpSolver = this.buildIterationSolver(false); Optimisation.Result tmpResult = tmpSolver.solve(); if (tmpResult.getState().isFeasible()) { this.extractSolution(tmpSolver); this.setState(State.OPTIMAL); } else { tmpSolver = this.buildIterationSolver(true); tmpResult = tmpSolver.solve(); if (tmpResult.getState().isFeasible()) { this.extractSolution(tmpSolver); this.setState(State.OPTIMAL); } else { this.resetX(); this.setState(State.INFEASIBLE); } } }
private void extractSolution(final QuadraticSolver aSolver) { final MatrixStore<Double> tmpSolutionX = aSolver.getSolutionX(); final int tmpCountVariables = this.countVariables(); final int tmpCountEqualityConstraints = this.countEqualityConstraints(); for (int i = 0; i < tmpCountVariables; i++) { this.setX(i, tmpSolutionX.doubleValue(i)); } for (int i = 0; i < tmpCountEqualityConstraints; i++) { this.setLE(i, tmpSolutionX.doubleValue(tmpCountVariables + i)); } }
Builder(final ExpressionsBasedModel aModel) { super(aModel); QuadraticSolver.copy(aModel, this); }