CGAL 5.6.3 - Linear and Quadratic Programming Solver

Loading...
Searching...
No Matches
QP_solver/print_first_lp.cpp
#include <iostream>
#include <CGAL/QP_models.h>
#include <CGAL/QP_functions.h>
// program type
typedef CGAL::Quadratic_program<int> Program;
int main() {
// by default, we have a nonnegative QP with Ax <= b
Program lp (CGAL::SMALLER, true, 0, false, 0);
// now set the non-default entries: 0 <-> x, 1 <-> y
lp.set_a(0, 0, 1); lp.set_a(1, 0, 1); lp.set_b(0, 7); // x + y <= 7
lp.set_a(0, 1, -1); lp.set_a(1, 1, 2); lp.set_b(1, 4); // -x + 2y <= 4
lp.set_u(1, true, 4); // y <= 4
lp.set_c(1, -32); // -32y
lp.set_c0(64); // +64
// print the program in MPS format
CGAL::print_linear_program(std::cout, lp, "first_lp");
return 0;
}
CGAL::Quadratic_program
An object of class Quadratic_program describes a convex quadratic program of the form.
Definition: QP_models.h:799
CGAL::print_linear_program
void print_linear_program(std::ostream &out, const LinearProgram &lp, const std::string &problem_name=std::string("MY_MPS"))
CGAL::SMALLER
SMALLER