Subject: CGAL users discussion list
List archive
- From: "Andy S." <>
- To:
- Subject: [cgal-discuss] Quadratic solver exception
- Date: Fri, 26 Aug 2016 16:28:16 -0400
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:5PcTvBYuH9NuKm9pr8W2mZT/LSx+4OfEezUN459isYplN5qZpsWybnLW6fgltlLVR4KTs6sC0LuP9fy4EjVbut7B6ClEK8McEUddyI0/pE8JPo2sMQXDNvnkbig3ToxpdWRO2DWFC3VTA9v0fFbIo3e/vnY4ExT7MhdpdKyuQtaBx5f/6+fn8JLaZ0BEhSG2fKhpBBSwtwTY8McM0rFvMqIg9hycuXBIeuJfz3lAKleanhK67cC1r7B59CEF8dsn+98IauOwN/AjRrxZCj0sKUg64cTqsV/ISg7ZtShUaXkfjhcdW1uN1xr9RJqk6iY=
Hello.
I need to solve some quadratic programs by specifying the problem through iterators. At the bottom there is a dummy example which runs fine (problem is infeasible). The problem is when I change the constraints to be all ">=":
std::array<CGAL::Comparison_result, numAConstraints> relationships
= { CGAL::LARGER,CGAL::LARGER,CGAL::LARGER,CGAL::LARGER, };
Then I get: "basis-inverse check: failed (row=0 | col=1)" from qp_solver_imp.h line 1155.
Thank you,
Anderson
This is the sample code that runs without crashing, all constraints are "<=":
int test(){
const int numAConstraints = 4;
const int numVariables = 3;
typedef CGAL::Quadratic_program_from_iterators
<double**, // for A
double*, // for b
std::array<CGAL::Comparison_result, numAConstraints>::const_iterator, // for r
bool*, // for fl
double*, // for l
bool*, // for fu
double*, // for u
double**, // for D
double*> // for c
Program;
typedef CGAL::Quadratic_program_solution<ET> Solution;
double Ax[] = { 1, -1, -1, 1 }; // column for x
double Ay[] = { -2, -2, 2, -1 };
double Az[] = { 1, 0.0, -5, 5 };
double* A[] = { Ax, Ay, Az }; // A comes columnwise
double b[] = { -2.4, -6, -2, 1.0 }; // right-hand side
std::array<CGAL::Comparison_result, numAConstraints> relationships
= { CGAL::SMALLER,CGAL::SMALLER,CGAL::SMALLER, CGAL::SMALLER };
bool fl[] = { true, true, true }; // both x, y are lower-bounded
double l[] = { 0, 0, 0 };
bool fu[] = { false, false, false }; // only y is upper-bounded
double u[] = { 0, 0, 0 }; // x's u-entry is ignored
double D1[] = { 1 }; // 2D_{1,1}
double D2[] = { 0, 0.1 };
double D3[] = { 10, 0.0, 100.0 };
double* D[] = { D1, D2, D3 }; // D-entries on/below diagonal ROWISE
double c[] = { -200, -5, -25 };
double c0 = 64;
Program qp(numVariables, numAConstraints, A, b, relationships.begin(), fl, l, fu, u, D, c, c0);
// solve the program, using ET as the exact type
Solution s = CGAL::solve_quadratic_program(qp, ET());
std::cout << s;
return 0;
}
- [cgal-discuss] Quadratic solver exception, Andy S., 08/26/2016
Archive powered by MHonArc 2.6.18.