Skip to content

Commit

Permalink
Update SQPOptimizerSTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Serrof authored Feb 10, 2024
1 parent faa4af4 commit 28ad27e
Showing 1 changed file with 1 addition and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,12 @@
import org.hipparchus.optim.nonlinear.scalar.ObjectiveFunction;
import org.junit.Test;

public class SQPOptimizerSTest extends AbstractConstrainedOptimizerTest {
public class SQPOptimizerSTest extends AbstractSQPOptimizerTest {

protected ConstraintOptimizer buildOptimizer() {
return new SQPOptimizerS();
}

@Test
public void test1() {
QuadraticFunction q = new QuadraticFunction(new double[][] { { 4.0, -2.0 }, { -2.0, 4.0 } },
new double[] { 6.0, 0.0 },
0.0);

// y = 1
LinearEqualityConstraint eqc = new LinearEqualityConstraint(new double[][] { { 0.0, 1.0 } },
new double[] { 1.0 });


// x > 0, y > 0, x + y > 2
LinearInequalityConstraint ineqc = new LinearInequalityConstraint(new double[][] { { 1.0, 0.0 }, { 0.0, 1.0 }, { 1.0, 1.0 } },
new double[] { 0.0, 0.0, 2.0 });


doTestProblem(new double[] { 1, 1 }, 2.5e-5,
new double[] { -6, 0, 0, 8 }, 2.6e-4,
8, 2.0e-4,
new ObjectiveFunction(q),
new double[] { 3.5, 3.5 },
eqc, ineqc);

}

@Test
public void test2() {
QuadraticFunction q = new QuadraticFunction(new double[][] { { 6.0, 2.0 }, { 2.0, 8.0 } },
Expand Down

0 comments on commit 28ad27e

Please sign in to comment.