DocumentationBuild StatusCoverageDOI

MadNLP is a nonlinear programming (NLP) solver, purely implemented in Julia. MadNLP implements a filter line-search algorithm, as that used in Ipopt. MadNLP seeks to streamline the development of modeling and algorithmic paradigms in order to exploit structures and to make efficient use of high-performance computers.


MadNLP is available under the MIT license.


pkg> add MadNLP

Optionally, various extension packages can be installed together:

pkg> add MadNLPHSL, MadNLPPardiso, MadNLPMumps, MadNLPGPU, MadNLPGraph, MadNLPKrylov

These packages are stored in the lib subdirectory within the main MadNLP repository. Some extension packages may require additional dependencies or specific hardware. For the instructions for the build procedure, see the following links:



MadNLP is interfaced with modeling packages:

Users can pass various options to MadNLP also through the modeling packages. The interface-specific syntax are shown below. To see the list of MadNLP solver options, check the file.

JuMP interface

using MadNLP, JuMP
model = Model(()->MadNLP.Optimizer(print_level=MadNLP.INFO, max_iter=100))
@variable(model, x, start = 0.0)
@variable(model, y, start = 0.0)
@NLobjective(model, Min, (1 - x)^2 + 100 * (y - x^2)^2)

NLPModels interface

using MadNLP, CUTEst
model = CUTEstModel("PRIMALC1")
madnlp(model, print_level=MadNLP.WARN, max_wall_time=3600)

Plasmo interface (requires extension MadNLPGraph)

using MadNLP, MadNLPGraph, Plasmo
graph = OptiGraph()
@variable(n1,0 <= x <= 2)
@variable(n1,0 <= y <= 3)
@constraint(n1,x+y <= 4)
@NLnodeconstraint(n2,exp(x) >= 2)
@linkconstraint(graph,n1[:x] == n2[:x])
MadNLP.optimize!(graph; print_level=MadNLP.DEBUG, max_iter=100)

Linear Solvers

MadNLP is interfaced with non-Julia sparse/dense linear solvers:

Each linear solver in MadNLP is a Julia type, and the linear_solver option should be specified by the actual type. Note that the linear solvers are always exported to Main.

Built-in Solvers: Umfpack, PardisoMKL, LapackCPU

using MadNLP, JuMP
# ...
model = Model(()->MadNLP.Optimizer(linear_solver=UmfpackSolver)) # default
model = Model(()->MadNLP.Optimizer(linear_solver=LapackCPUSolver))

HSL (requires extension MadNLPHSL)

using MadNLP, MadNLPHSL, JuMP
# ...
model = Model(()->MadNLP.Optimizer(linear_solver=Ma27Solver))
model = Model(()->MadNLP.Optimizer(linear_solver=Ma57Solver))
model = Model(()->MadNLP.Optimizer(linear_solver=Ma77Solver))
model = Model(()->MadNLP.Optimizer(linear_solver=Ma86Solver))
model = Model(()->MadNLP.Optimizer(linear_solver=Ma97Solver))

Mumps (requires extension MadNLPMumps)

using MadNLP, MadNLPMumps, JuMP
# ...
model = Model(()->MadNLP.Optimizer(linear_solver=MumpsSolver))

Pardiso (requires extension MadNLPPardiso)

using MadNLP, MadNLPPardiso, JuMP
# ...
model = Model(()->MadNLP.Optimizer(linear_solver=PardisoSolver))
model = Model(()->MadNLP.Optimizer(linear_solver=PardisoMKLSolver))

LapackGPU (requires extension MadNLPGPU)

using MadNLP, MadNLPGPU, JuMP
# ...
model = Model(()->MadNLP.Optimizer(linear_solver=LapackGPUSolver))

Schur and Schwarz (requires extension MadNLPGraph)

using MadNLP, MadNLPGraph, JuMP
# ...
model = Model(()->MadNLP.Optimizer(linear_solver=MadNLPSchwarz))
model = Model(()->MadNLP.Optimizer(linear_solver=MadNLPSchur))

The solvers in MadNLPGraph (Schur and Schwarz) use multi-thread parallelism; thus, Julia session should be started with -t flag.

julia -t 16 # to use 16 threads

Citing MadNLP.jl

If you use MadNLP.jl in your research, we would greatly appreciate your citing it.

  title={Graph-Based Modeling and Decomposition of Energy Infrastructures},
  author={Shin, Sungho and Coffrin, Carleton and Sundar, Kaarthik and Zavala, Victor M},
  journal={arXiv preprint arXiv:2010.02404},

Bug reports and support

Please report issues and feature requests via the GitHub issue tracker.