IPOPTMinimize[f,{x1,…},{x1i0,…}]
numerically searches for a local minimum of f in xj, starting from the point xj=xj0.
IPOPTMinimize[f,{x1,…},{x1i0,…},{{x1min,x1max},…}]
numerically searches for a local minimum subject to the variable bound constraints xj min≤xj≤xj max.
IPOPTMinimize[f,{x1,…},{x1i0,…},{{x1min,x1max},…},{g1,…},{{g1min,g1max},…}]
numerically searches for a local minimum subject to function constraints gi min≤gi(x)≤gi max.
IPOPTMinimize
IPOPTMinimize[f,{x1,…},{x1i0,…}]
numerically searches for a local minimum of f in xj, starting from the point xj=xj0.
IPOPTMinimize[f,{x1,…},{x1i0,…},{{x1min,x1max},…}]
numerically searches for a local minimum subject to the variable bound constraints xj min≤xj≤xj max.
IPOPTMinimize[f,{x1,…},{x1i0,…},{{x1min,x1max},…},{g1,…},{{g1min,g1max},…}]
numerically searches for a local minimum subject to function constraints gi min≤gi(x)≤gi max.
Details and Options
- To use IPOPTMinimize, you first need to load it using Needs["IPOPTLink`"].
- IPOPTMinimize numerically solves a real-valued minimization problem for an objective function
subject to variable bound constraints and/or function constraints. - The objective f and the constraint functions {g1,…} should be real-valued and twice continuously differentiable.
- The optimization problem need not be convex or linear.
- Equality constraints
may be specified by setting the constraint bounds to {b,b}. » - IPOPTMinimize returns a solution object in the form of an IPOPTData expression.
- The following options can be given to IPOPTMinimize:
-
StepMonitor None expression to evaluate whenever a step is taken IPOPTOptions {} options to be passed to the IPOPT library RuntimeOptions Automatic options to specify runtime settings - The IPOPT library options have string names and real, integer or string values.
- Example options that can be specified in IPOPTOptions include:
-
"tol" real desired convergence tolerance (relative) "max_iter" integer maximum number of iterations allowed "linear_solver" string linear solver to be used (e.g. "mumps") - The complete list of IPOPT library options and possible values can be found on the web page.
Examples
open all close allBasic Examples (3)
Find a local minimum of
starting from
.
Needs["IPOPTLink`"]sol = IPOPTMinimize[Cos[x + y] * Sin[x - y], {x, y}, {1, 1}]Extract the minimum value and position from the IPOPTData expression:
{fmin, minpt} = {IPOPTMinValue[sol], IPOPTArgMin[sol]}Show[Plot3D[Cos[x + y] * Sin[x - y], {x, 0, 3}, {y, 0, 3}, PlotStyle -> Opacity[0.5]], Graphics3D[{Red, PointSize[.04], Point[Join[minpt, {fmin}]]}]]Minimize
with variable bounds
,
, starting from
.
Needs["IPOPTLink`"]sol = IPOPTMinimize[Cos[x + y] * Sin[x - y], {x, y}, {1, 1}, {{0, 2}, {0, 2}}]Extract the minimum value and position from the IPOPTData expression:
{fmin, minpt} = {IPOPTMinValue[sol], IPOPTArgMin[sol]}Show[Plot3D[Cos[x + y] * Sin[x - y], {x, 0, 2}, {y, 0, 2}, PlotStyle -> Opacity[0.5]], Graphics3D[{Red, PointSize[.04], Point[Join[minpt, {fmin}]]}]]Minimize
with variable bounds
,
and function constraint
, starting from
.
Needs["IPOPTLink`"]sol = IPOPTMinimize[Cos[x + y] * Sin[x - y], {x, y}, {1, 1}, {{0, 3}, {0, 3}}, {x ^ 2 + y ^ 2}, {{0, 4}}]Extract the minimum value and position from the IPOPTData expression:
{fmin, minpt} = {IPOPTMinValue[sol], IPOPTArgMin[sol]}f[{x_, y_}] := Cos[x + y] * Sin[x - y];
cpts = N[2CirclePoints[500]];Show[Plot3D[Cos[x + y] * Sin[x - y], {x, 0, 3}, {y, 0, 3}, PlotStyle -> Opacity[0.5]], ListPointPlot3D[Join[#, {f[#]}]& /@ cpts, PlotStyle -> PointSize[.015]], Graphics3D[{Red, PointSize[.04], Point[Join[minpt, {fmin}]]}]]Scope (2)
Maximize a function
by minimizing the negative of the objective value:
Needs["IPOPTLink`"]sol = IPOPTMinimize[-Sin[x + y], {x, y}, {0, 0}, {{0, 1}, {0, 1}}]Find the maximum value and position from the IPOPTData expression:
{-IPOPTMinValue[sol], IPOPTArgMin[sol]}Minimize a function with an equality constraint
by specifying equal lower and upper bounds
:
Needs["IPOPTLink`"]sol = IPOPTMinimize[Cos[x + y] * Sin[x - y], {x, y}, {1, 0}, {{0, 1}, {0, 1}}, {x ^ 2 + y ^ 2}, {{1, 1}}]Extract the minimum value and position from the IPOPTData expression:
{fmin, minpt} = {IPOPTMinValue[sol], IPOPTArgMin[sol]}Options (5)
StepMonitor (1)
IPOPTOptions (2)
Use IPOPTOptions to set options as described in the IPOPT library documentation options page.
Use "tol" to set the relative error tolerance to 10.^-6:
Needs["IPOPTLink`"]sol = IPOPTMinimize[Cos[x + y] * Sin[x - y], {x, y}, {0, 1}, {{-1, 1}, {-1, 1}}, "IPOPTOptions" -> {"tol" -> 10. ^ -6}]With this option we can expect about 6 digits of precision:
{IPOPTMinValue[sol], IPOPTArgMin[sol]}Compare to the exact solution:
N[{-1, {-Pi / 4, Pi / 4}}]Use "max_iter" to set the maximum number of iterations to 5:
Needs["IPOPTLink`"]sol = IPOPTMinimize[Cos[x + y] * Sin[x - y], {x, y}, {0, 1}, {{-1, 1}, {-1, 1}}, "IPOPTOptions" -> {"max_iter" -> 5}]The error above indicates that the iterations were not enough to satisfy the default relative error tolerance of 10^-8:
{Abs[IPOPTMinValue[sol] - (-1)] / 1, Abs[IPOPTArgMin[sol] - {-Pi / 4, Pi / 4}] / (Pi / 4)}RuntimeOptions (2)
Use RuntimeOptions to specify runtime settings:
Use "RuntimeErrorHandler" to indicate whether to return an IPOPTData object or $Failed when a serious error occurs:
Needs["IPOPTLink`"]With some errors such as machine overflow, $Failed is returned with the Automatic setting:
sol = IPOPTMinimize[-Log[a * E ^ (1 - a)], {a}, {1000.}, {{0., 1.*^40}}]Return a solution object so that the IPOPTReturnCode can be extracted:
sol = IPOPTMinimize[-Log[a * E ^ (1 - a)], {a}, {1000.}, {{0., 1.*^40}}, "RuntimeOptions" -> {"RuntimeErrorHandler" -> "ReturnObject"}]IPOPTReturnCode[sol]Use "WarningMessges" to turn off and on the warning messages indicating runtime problems:
Needs["IPOPTLink`"]Turn off the warning messages:
sol = IPOPTMinimize[-Log[a * E ^ (1 - a)], {a}, {1000.}, {{0., 1.*^40}}, "RuntimeOptions" -> {"WarningMessages" -> False}]Applications (1)
Find the polygon with maximal area among polygons with
sides and diameter
. Let {r[i],t[i]} be the polar coordinates of the vertices of the polygon. The variables and their bounds are:
n = 6;
varranges = Join[Table[{t[i], 0., Infinity}, {i, n - 1}], Table[{r[i], 0, 1}, {i, n - 1}], {{t[n], π, π}, {r[n], 0., 0.}}]vars = Map[First, varranges]varbounds = Map[{#[[2]], #[[3]]}&, varranges]area = .5 Sum[r[i] r[i - 1] Sin[t[i] - t[i - 1]], {i, 2, n}]To state as a minimization problem negate the objective function:
objfn = -area;Set up the constraints and the constraint bounds:
constr1 = Flatten[Table[0. ≤ r[i] ^ 2 + r[j] ^ 2 - 2 r[i] r[j] Cos[t[i] - t[j]] ≤ 1, {i, 1, n}, {j, i + 1, n}], 2];
constr2 = Table[-2. Pi ≤ t[i - 1] - t[i] ≤ 0, {i, 2, n}];
constr = Join[constr1, constr2];
constrbounds = Map[{#[[1]], #[[3]]}&, constr]
constr = Map[#[[2]]&, constr]Define an initial point for the minimization:
x0 = vars /. {r[i_] -> 4. i (n + 1 - i) / (n + 1) ^ 2} /. {t[i_] -> π i / n}Load the package and solve the minimization problem:
Needs["IPOPTLink`"]
sol = IPOPTMinimize[objfn, vars, x0, varbounds, constr, constrbounds]Extract the maximum area from the solution object:
-IPOPTMinValue[sol]Extract the optimal variable values from the solution object:
ipoptsol = MapThread[Rule, {vars, IPOPTArgMin[sol]}]Find the points in Cartesian coordinates:
ipoptrectpts = Table[{r[i] Cos[t[i]], r[i] Sin[t[i]]}, {i, 1, n}] /. ipoptsolShow[ListPlot[ipoptrectpts, PlotStyle -> {Blue, PointSize -> Large}], Graphics[{Opacity[.1], Blue, Polygon[ipoptrectpts]}], AspectRatio -> 1]Tech Notes
Related Guides
Text
Wolfram Research (2016), IPOPTMinimize, Wolfram Language function, https://reference.wolfram.com/language/IPOPTLink/ref/IPOPTMinimize.html.
CMS
Wolfram Language. 2016. "IPOPTMinimize." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/IPOPTLink/ref/IPOPTMinimize.html.
APA
Wolfram Language. (2016). IPOPTMinimize. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/IPOPTLink/ref/IPOPTMinimize.html
BibTeX
@misc{reference.wolfram_2026_ipoptminimize, author="Wolfram Research", title="{IPOPTMinimize}", year="2016", howpublished="\url{https://reference.wolfram.com/language/IPOPTLink/ref/IPOPTMinimize.html}", note=[Accessed: 15-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_ipoptminimize, organization={Wolfram Research}, title={IPOPTMinimize}, year={2016}, url={https://reference.wolfram.com/language/IPOPTLink/ref/IPOPTMinimize.html}, note=[Accessed: 15-June-2026]}