有人在Anaconda python上安装了Ipopt吗?我下载了3.6.1版。另外,我下载了自述文件中描述的请求的英特尔Fortran图书馆。
通过使用configure、make和make install以及链接到它的所有依赖项,安装应该是直接的。我希望我能自己解决这个问题。
如果我想在蟒蛇体内使用Ipopt,我还需要考虑什么呢?特别是,我想建立Pygmo与包括Ipopt在内。
还是安装pyopt或Casadi就足够了?
发布于 2018-02-26 12:21:39
我已经通过anaconda云在anaconda环境中安装了ipopt;anaconda云上的ipopt可以在https://anaconda.org/conda-forge/ipopt上使用。
要在anaconda环境上安装ipopt,只需打开anaconda终端,激活要安装ipopt的环境,然后键入:"conda install -c conda-forge ipopt",然后按照安装其他软件包的方式正常进行。
发布于 2022-07-13 23:12:39
如果您不想在运行Python的任何平台(Windows、MacOS、Linux、ARM )上编译解决程序,则IPOPT附带了Gekko。下面是一个简单的例子:
pip install gekko用IPOPT解决HS71

from gekko import GEKKO
import numpy as np
m = GEKKO()
x = m.Array(m.Var,4,value=1,lb=1,ub=5)
x1,x2,x3,x4 = x
# change initial values
x2.value = 5; x3.value = 5
m.Equation(x1*x2*x3*x4>=25)
m.Equation(x1**2+x2**2+x3**2+x4**2==40)
m.Minimize(x1*x4*(x1+x2+x3)+x3)
m.solve()
print('x: ', x)
print('Objective: ',m.options.OBJFCNVAL)IPOPT的结果
******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Eclipse Public License (EPL).
For more information visit http://projects.coin-or.org/Ipopt
******************************************************************************
This is Ipopt version 3.12.10, running with linear solver ma57.
Number of nonzeros in equality constraint Jacobian...: 9
Number of nonzeros in inequality constraint Jacobian.: 0
Number of nonzeros in Lagrangian Hessian.............: 10
Total number of variables............................: 5
variables with only lower bounds: 1
variables with lower and upper bounds: 4
variables with only upper bounds: 0
Total number of equality constraints.................: 2
Total number of inequality constraints...............: 0
inequality constraints with only lower bounds: 0
inequality constraints with lower and upper bounds: 0
inequality constraints with only upper bounds: 0
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
0 1.6109693e+01 1.12e+01 2.50e+00 0.0 0.00e+00 - 0.00e+00 0.00e+00 0
1 1.6905655e+01 7.44e-01 5.14e-01 -0.9 1.36e-01 - 1.00e+00 1.00e+00f 1
2 1.7136202e+01 1.71e-01 4.57e-01 -1.0 9.40e-02 - 8.95e-01 1.00e+00h 1
3 1.6956645e+01 1.57e-01 7.85e-02 -2.0 1.78e-01 - 9.95e-01 1.00e+00h 1
4 1.7009269e+01 1.63e-02 1.20e-02 -2.8 3.94e-02 - 9.94e-01 1.00e+00h 1
5 1.7013888e+01 4.04e-04 1.76e-04 -4.6 6.22e-03 - 1.00e+00 1.00e+00h 1
6 1.7014017e+01 3.92e-07 6.03e-07 -10.4 1.46e-04 - 9.99e-01 1.00e+00h 1
Number of Iterations....: 6
(scaled) (unscaled)
Objective...............: 1.7014017127073458e+01 1.7014017127073458e+01
Dual infeasibility......: 6.0264909533529361e-07 6.0264909533529361e-07
Constraint violation....: 3.9234873865091858e-07 3.9234873865091858e-07
Complementarity.........: 7.2865190881096349e-08 7.2865190881096349e-08
Overall NLP error.......: 6.0264909533529361e-07 6.0264909533529361e-07
Number of objective function evaluations = 7
Number of objective gradient evaluations = 7
Number of equality constraint evaluations = 7
Number of inequality constraint evaluations = 0
Number of equality constraint Jacobian evaluations = 7
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations = 6
Total CPU secs in IPOPT (w/o function evaluations) = 0.003
Total CPU secs in NLP function evaluations = 0.000
EXIT: Optimal Solution Found.
The solution was found.
The final value of the objective function is 17.0140171270735
---------------------------------------------------
Solver : IPOPT (v3.12)
Solution time : 9.299999990616925E-003 sec
Objective : 17.0140171270735
Successful solution
---------------------------------------------------
x: [[1.000000057] [4.74299963] [3.8211500283] [1.3794081795]]
Objective: 17.014017127默认的做法是使用云计算服务和更有能力的线性求解器。Windows上的IPOPT有一个本地选项,但使用腮腺炎线性求解器作为免费分发选项之一。
发布于 2015-08-10 15:19:07
我对Casadi并不特别熟悉,但是您的优化界面的选择将很大程度上取决于您期望如何处理您的问题。例如,对于一个简单的优化问题,您可以使用scipy.minimize。
原则上,两者(重温到pyOpt和PyGMO)都为您提供了不同的功能集。例如,PyGMO还有其他功能,如PyGMO博士和使用通用岛模型的可能性。在你的特殊情况下,你必须自己决定什么最适合你。
如果您正在显式执行的任务需要使用Ipopt,那么PyGMO、pyOpt或其他接口的配置应该是您所提供的任何接口的次要项。
https://stackoverflow.com/questions/30018848
复制相似问题