• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

jump-dev/AmplNLWriter.jl: Julia interface to AMPL-enabled solvers

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

jump-dev/AmplNLWriter.jl

开源软件地址:

https://github.com/jump-dev/AmplNLWriter.jl

开源编程语言:

Julia 100.0%

开源软件介绍:

AmplNLWriter.jl

Build Status MINLPTests codecov

AmplNLWriter.jl is an interface between MathOptInterface.jl and AMPL-enabled solvers.

Note: this wrapper is maintained by the JuMP community and has no official connection with the AMPL modeling language or AMPL Optimization Inc.

Installation

Install AmplNLWriter using Pkg.add.

import Pkg
Pkg.add("AmplNLWriter")

Note: AmplNLWriter requires Julia 1.6 or later.

Solvers

You also need an AMPL compatible solver.

Bonmin (https://github.com/coin-or/Bonmin)

To install Bonmin, use:

Pkg.add("Bonmin_jll")

Couenne (https://github.com/coin-or/Couenne)

To install Couenne, use:

Pkg.add("Couenne_jll")

Ipopt (https://github.com/coin-or/Ipopt)

To install Ipopt, use:

Pkg.add("Ipopt_jll")

SHOT (https://github.com/coin-or/SHOT)

To install SHOT, use:

Pkg.add("SHOT_jll")

Warning: SHOT_jll uses open-source solvers and fails many of our unit tests. You may want to compile your own binary with commercial solvers.

Usage

JLL packages

To call Bonmin via AmplNLWriter.jl, use:

using JuMP, AmplNLWriter, Bonmin_jll
model = Model(() -> AmplNLWriter.Optimizer(Bonmin_jll.amplexe))

# or equivalently

model = Model() do
    AmplNLWriter.Optimizer(Bonmin_jll.amplexe)
end

Replace Bonmin_jll with Couenne_jll, Ipopt_jll, or SHOT_jll as appropriate.

Other binaries

You can also pass a string pointing to an AMPL-compatible solver executable. For example, if the bonmin executable is on the system path, use:

using JuMP, AmplNLWriter
model = Model(() -> AmplNLWriter.Optimizer("bonmin"))

If the solver is not on the path, the full path to the solver will need to be passed in.

Options

A list of available options for each solver can be found here:

Set an option using set_optimizer_attribute. For example, to set the "bonmin.nlp_log_level" option to 0 in Bonmin, use:

using JuMP, AmplNLWriter, Bonmin_jll
model = Model(() -> AmplNLWriter.Optimizer(Bonmin_jll.amplexe))
set_optimizer_attribute(model, "bonmin.nlp_log_level", 0)

opt files

Some of the options need to be specified via an .opt file. This file must be located in the current working directory whenever the model is solved.

The .opt file must be named after the name of the solver, e.g. bonmin.opt, and each line must contain an option name and the desired value separated by a space. For instance, to set the absolute and relative tolerances in Couenne to 1 and 0.05 respectively, the couenne.opt is:

allowable_gap 1
allowable_fraction_gap 0.05



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap