gpt4 book ai didi

c++ - C++中有二次编程库吗?

转载 作者:IT老高 更新时间:2023-10-28 23:15:16 27 4
gpt4 key购买 nike

我找到的唯一Google搜索结果是QuadProg++,但它无法解决矩阵不适用于Cholesky分解的二次规划问题。

那么任何人都可以给我一些关于其他图书馆的建议吗?谢谢。

最佳答案

CGAL看起来很适合二次规划。甚至还有a manual .

  // by default, we have a nonnegative QP with Ax <= b
Program qp (CGAL::SMALLER, true, 0, false, 0);

// now set the non-default entries:
const int X = 0;
const int Y = 1;
qp.set_a(X, 0, 1); qp.set_a(Y, 0, 1); qp.set_b(0, 7); // x + y <= 7
qp.set_a(X, 1, -1); qp.set_a(Y, 1, 2); qp.set_b(1, 4); // -x + 2y <= 4
qp.set_u(Y, true, 4); // y <= 4
qp.set_d(X, X, 2); qp.set_d (Y, Y, 8); // !!specify 2D!! x^2 + 4 y^2
qp.set_c(Y, -32); // -32y
qp.set_c0(64); // +64

// solve the program, using ET as the exact type
Solution s = CGAL::solve_quadratic_program(qp, ET());
assert (s.solves_quadratic_program(qp));

代码来自 the first example .

关于c++ - C++中有二次编程库吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8025700/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com