非线性优化库NLopt简介

NLopt是一个开源非线性优化库,提供多种优化算法的统一接口。本文介绍了NLopt的下载安装、API使用,包括nlopt_create、nlopt_set_min_objective等函数,以及如何设置优化目标、边界和停止条件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

非线性优化库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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值