非线性优化库NLopt
NLopt 是一个轻量级开源非线性优化库, 为多种优化算法提供了统一的接口。
主页:https://nlopt.readthedocs.io/en/latest/
git:https://github.com/stevengj/nlopt
目录
下载安装
下载:
nlopt-2.4.2.tar.gz
安装:
./configure && make && sudo make install
API
nlopt_create
nlopt_create
将根据给定的优化算法nlopt_algorithm
返回nlopt_opt
对象,n
为优化变量维数
nlopt_opt nlopt_create(nlopt_algorithm algorithm, unsigned n);
nlopt_algorithm
包含了
typedef enum {
/* Naming conventions:
NLOPT_{G/L}{D/N}_*
= global/local derivative/no-derivative optimization,
respectively
*_RAND algorithms involve some randomization.
*_NOSCAL algorithms are *not* scaled to a unit hypercube
(i.e. they are sensitive to the units of x)
*/
NLOPT_GN_DIRECT = 0,
NLOPT_GN_DIRECT_L,
NLOPT_GN_DIRECT_L_RAND,
NLOPT_GN_DIRECT_NOSCAL,
NLOPT_GN_DIRECT_L_NOSCAL,
NLOPT_GN_DIRECT_L_RAND_NOSCAL,
NLOPT_GN_ORIG_DIRECT,
NLOPT_GN_ORIG_DIRECT_L,
NLOPT_GD_STOGO,
NLOPT_GD_STOGO_RAND,
NLOPT_LD_LBFGS_NOCEDAL,
NLOPT_LD_LBFGS,
NLOPT_LN_PRAXIS,
NLOPT_LD_VAR1,
NLOPT_LD_VAR2,
NLOPT_LD_TNEWTON,
NLOPT_LD_TNEWTON_RESTART,
NLOPT_LD_TNEWTON_PRECOND,
NLOPT_LD_TNEWTON_PRECOND_RES