#include #include #include #include #include #include #include #include // choose exact floating point type #ifndef CGAL_USE_GMP #include typedef CGAL::MP_Float ET; #else #include typedef CGAL::Gmpzf ET; #endif // program and solution types typedef CGAL::Quadratic_program Program; typedef CGAL::Quadratic_program_solution Solution; // random number generator CGAL::Random rd; CGAL::Comparison_result random_rel() { int z = rd.get_int(-1,2); return CGAL::Comparison_result(z); } void statistics (const Solution& s, unsigned int& o, unsigned int& i, unsigned int& u) { switch (s.status()) { case CGAL::QP_OPTIMAL: o++; break; case CGAL::QP_INFEASIBLE: i++; break; case CGAL::QP_UNBOUNDED: u++; break; default: assert(false); } } unsigned int qp_optimal = 0; unsigned int qp_infeasible = 0; unsigned int qp_unbounded = 0; unsigned int nqp_optimal = 0; unsigned int nqp_infeasible = 0; unsigned int nqp_unbounded = 0; unsigned int lp_optimal = 0; unsigned int lp_infeasible = 0; unsigned int lp_unbounded = 0; unsigned int nlp_optimal = 0; unsigned int nlp_infeasible = 0; unsigned int nlp_unbounded = 0; // parameters int tries = 5000; int max_dim = 11; // must be >1 int max_entry = 11; // must be >0 int main() { // print seed std::cout << "Random seed: " << rd.get_seed() << std::endl; // options CGAL::Quadratic_program_options options; options.set_auto_validation(true); // generate a set of small random qp's for (int i=0; i > C (k, std::vector(n, 0)); for (int j=0; j u) std::swap (l, u); p.set_l(j, rd.get_bool(), l); p.set_u(j, rd.get_bool(), u); } // D for (int i=0; i