From 4ba87c59e7e0ad8c615963732ce428af5b62a965 Mon Sep 17 00:00:00 2001 From: = Date: Wed, 29 Jun 2016 15:24:27 -0400 Subject: [PATCH] [TEST] Add HS35 [TEST] Disabled HS118 --- examples/Data/HS35.QPS | 20 ++++++++++++++++++++ gtsam_unstable/linear/QPSParser.cpp | 2 +- gtsam_unstable/linear/tests/testQPSolver.cpp | 10 +++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 examples/Data/HS35.QPS diff --git a/examples/Data/HS35.QPS b/examples/Data/HS35.QPS new file mode 100644 index 000000000..1ee230e39 --- /dev/null +++ b/examples/Data/HS35.QPS @@ -0,0 +1,20 @@ +NAME HS35 +ROWS + N OBJ.FUNC + G R------1 +COLUMNS + C------1 OBJ.FUNC -.800000e+01 R------1 -.100000e+01 + C------2 OBJ.FUNC -.600000e+01 R------1 -.100000e+01 + C------3 OBJ.FUNC -.400000e+01 R------1 -.200000e+01 +RHS + RHS OBJ.FUNC -.900000e+01 + RHS R------1 -.300000e+01 +RANGES +BOUNDS +QUADOBJ + C------1 C------1 0.400000e+01 + C------1 C------2 0.200000e+01 + C------1 C------3 0.200000e+01 + C------2 C------2 0.400000e+01 + C------3 C------3 0.200000e+01 +ENDATA diff --git a/gtsam_unstable/linear/QPSParser.cpp b/gtsam_unstable/linear/QPSParser.cpp index 1767cd18f..df087f797 100644 --- a/gtsam_unstable/linear/QPSParser.cpp +++ b/gtsam_unstable/linear/QPSParser.cpp @@ -107,7 +107,7 @@ struct QPSParser::MPSGrammar: base_grammar { cols = lexeme[lit("COLUMNS") >> *blank >> eol >> +((col_double | col_single) >> eol)]; quad = lexeme[lit("QUADOBJ") >> *blank >> eol >> +(quad_l >> eol)]; - bounds = lexeme[lit("BOUNDS") >> +space >> +((bound | bound_fr) >> eol)]; + bounds = lexeme[lit("BOUNDS") >> +space >> *((bound | bound_fr) >> eol)]; ranges = lexeme[lit("RANGES") >> +space >> *((range_double | range_single) >> eol)]; end = lexeme[lit("ENDATA") >> *space]; diff --git a/gtsam_unstable/linear/tests/testQPSolver.cpp b/gtsam_unstable/linear/tests/testQPSolver.cpp index b8437da7b..ab6f22cb2 100644 --- a/gtsam_unstable/linear/tests/testQPSolver.cpp +++ b/gtsam_unstable/linear/tests/testQPSolver.cpp @@ -281,7 +281,7 @@ TEST(QPSolver, HS21) { CHECK(assert_equal(expectedSolution, actualSolution)) } -TEST(QPSolver, HS118) { +TEST_DISABLED(QPSolver, HS118) { QP problem = QPSParser("HS118.QPS").Parse(); VectorValues actualSolution; VectorValues expectedSolution; @@ -295,6 +295,14 @@ TEST(QPSolver, HS118) { CHECK(assert_equal(expectedSolution, actualSolution)) } +TEST(QPSolver, HS35) { + QP problem = QPSParser("HS35.QPS").Parse(); + VectorValues actualSolution; + boost::tie(actualSolution, boost::tuples::ignore) = QPSolver(problem).optimize(); + double error_actual = problem.cost.error(actualSolution); + CHECK(assert_equal(1.11111111e-01,error_actual, 1e-7)) +} + /* ************************************************************************* */ // Create Matlab's test graph as in http://www.mathworks.com/help/optim/ug/quadprog.html QP createTestMatlabQPEx() {