-
-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Documenter.jl
committed
Nov 6, 2023
0 parents
commit 765b9d8
Showing
9,710 changed files
with
2,054,509 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
.. _simple-example: | ||
|
||
Simple Example | ||
^^^^^^^^^^^^^^ | ||
|
||
In this section we will construct a simple model and explain every step along the way. | ||
The are more complex examples in the ``JuMP/examples/`` `folder <https://github.com/JuliaOpt/JuMP.jl/tree/master/examples>`_. Here is the code we will walk through:: | ||
|
||
using JuMP | ||
|
||
m = Model() | ||
@defVar(m, 0 <= x <= 2 ) | ||
@defVar(m, 0 <= y <= 30 ) | ||
|
||
@setObjective(m, Max, 5x + 3*y ) | ||
@addConstraint(m, 1x + 5y <= 3.0 ) | ||
|
||
print(m) | ||
|
||
status = solve(m) | ||
|
||
println("Objective value: ", getObjectiveValue(m)) | ||
println("x = ", getValue(x)) | ||
println("y = ", getValue(y)) | ||
|
||
Once JuMP is :ref:`installed <jump-installation>`, to use JuMP in your | ||
programs, you just need to say:: | ||
|
||
using JuMP | ||
|
||
Models are created with the ``Model()`` function:: | ||
|
||
m = Model() | ||
|
||
.. note:: | ||
Your model doesn't have to be called m - it's just a name. | ||
|
||
There are a few options for defining a variable, depending on whether you want | ||
to have lower bounds, upper bounds, both bounds, or even no bounds. The following | ||
commands will create two variables, ``x`` and ``y``, with both lower and upper bounds. | ||
Note the first argument is our model variable ``m``. These variables are associated | ||
with this model and cannot be used in another model.:: | ||
|
||
@defVar(m, 0 <= x <= 2 ) | ||
@defVar(m, 0 <= y <= 30 ) | ||
|
||
Next we'll set our objective. Note again the ``m``, so we know which model's | ||
objective we are setting! The objective sense, ``Max`` or ``Min``, should | ||
be provided as the second argument. Note also that we don't have a multiplication ``*`` | ||
symbol between 5 and our variable ``x`` - Julia is smart enough to not need it! | ||
Feel free to stick with ``*`` if it makes you feel more comfortable, as we have | ||
done with ``3*y``:: | ||
|
||
@setObjective(m, Max, 5x + 3*y ) | ||
|
||
Adding constraints is a lot like setting the objective. Here we create a | ||
less-than-or-equal-to constraint using ``<=``, but we can also create equality | ||
constraints using ``==`` and greater-than-or-equal-to constraints with ``>=``:: | ||
|
||
@addConstraint(m, 1x + 5y <= 3.0 ) | ||
|
||
If you want to see what your model looks like in a human-readable format, | ||
the ``print`` function is defined for models. | ||
|
||
:: | ||
|
||
print(m) | ||
|
||
Models are solved with the ``solve()`` function. This function will not raise | ||
an error if your model is infeasible - instead it will return a flag. In this | ||
case, the model is feasible so the value of ``status`` will be ``:Optimal``, | ||
where ``:`` again denotes a symbol. The possible values of ``status`` | ||
are described :ref:`here <solvestatus>`. | ||
|
||
:: | ||
|
||
status = solve(m) | ||
|
||
Finally, we can access the results of our optimization. Getting the objective | ||
value is simple:: | ||
|
||
println("Objective value: ", getObjectiveValue(m)) | ||
|
||
To get the value from a variable, we call the ``getValue()`` function. If ``x`` | ||
is not a single variable, but instead a range of variables, ``getValue()`` will | ||
return a list. In this case, however, it will just return a single value. | ||
|
||
:: | ||
|
||
println("x = ", getValue(x)) | ||
println("y = ", getValue(y)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
=========================================== | ||
JuMP --- Julia for Mathematical Programming | ||
=========================================== | ||
|
||
.. module:: JuMP | ||
:synopsis: Julia for Mathematical Programming | ||
|
||
`JuMP <https://github.com/JuliaOpt/JuMP.jl>`_ is a domain-specific modeling language for | ||
`mathematical programming <http://en.wikipedia.org/wiki/Mathematical_optimization>`_ | ||
embedded in `Julia <http://julialang.org/>`_. | ||
It currently supports a number of open-source and commercial solvers (see below) | ||
for a variety of problem classes, including **linear programming**, **mixed-integer programming**, **second-order conic programming**, **semidefinite programming**, and **nonlinear programming**. | ||
JuMP's features include: | ||
|
||
* User friendliness | ||
|
||
* Syntax that mimics natural mathematical expressions. | ||
* Complete documentation. | ||
|
||
* Speed | ||
|
||
* Benchmarking has shown that JuMP can create problems at similar speeds to | ||
special-purpose modeling languages such as `AMPL <http://www.ampl.com/>`_. | ||
* JuMP communicates with solvers in memory, avoiding the need to write | ||
intermediary files. | ||
|
||
* Solver independence | ||
|
||
* JuMP uses a generic solver-independent interface provided by the | ||
`MathProgBase <https://github.com/mlubin/MathProgBase.jl>`_ package, making it easy | ||
to change between a number of open-source and commercial optimization software packages ("solvers"). | ||
* Currently supported solvers include | ||
`Bonmin <https://projects.coin-or.org/Bonmin>`_, | ||
`Cbc <https://projects.coin-or.org/Cbc>`_, | ||
`Clp <https://projects.coin-or.org/Clp>`_, | ||
`Couenne <https://projects.coin-or.org/Couenne>`_, | ||
`CPLEX <http://www-01.ibm.com/software/commerce/optimization/cplex-optimizer/>`_, | ||
`ECOS <https://github.com/ifa-ethz/ecos>`_, | ||
`GLPK <http://www.gnu.org/software/glpk/>`_, | ||
`Gurobi <http://www.gurobi.com>`_, | ||
`Ipopt <https://projects.coin-or.org/Ipopt>`_, | ||
`KNITRO <http://www.ziena.com/knitro.htm>`_, | ||
`MOSEK <http://www.mosek.com/>`_, | ||
`NLopt <http://ab-initio.mit.edu/wiki/index.php/NLopt>`_, | ||
and `SCS <https://github.com/cvxgrp/scs>`_. | ||
|
||
* Access to advanced algorithmic techniques | ||
|
||
* Including :ref:`efficient LP re-solves <probmod>` and :ref:`callbacks for mixed-integer programming <callbacks>` which previously required using solver-specific and/or low-level C++ libraries. | ||
|
||
* Ease of embedding | ||
|
||
* JuMP itself is written purely in Julia. Solvers are the only binary dependencies. | ||
* Being embedded in a general-purpose programming language makes it easy to solve optimization problems as part of a larger workflow (e.g., inside a simulation, behind a web server, or as a subproblem in a decomposition algorithm). | ||
|
||
* As a trade-off, JuMP's syntax is constrained by the syntax available in Julia. | ||
|
||
* JuMP is `MPL <https://www.mozilla.org/MPL/2.0/>`_ licensed, meaning that it can be embedded in commercial software that complies with the terms of the license. | ||
|
||
While neither Julia nor JuMP have reached version 1.0 yet, the releases are stable enough for everyday use and are being used in a number of research projects and neat applications by a growing community of users who are early adopters. JuMP remains under active development, and we welcome your feedback, suggestions, and bug reports. | ||
|
||
Installing JuMP | ||
--------------- | ||
|
||
If you are familiar with Julia you can get started quickly by using the | ||
package manager to install JuMP:: | ||
|
||
julia> Pkg.add("JuMP") | ||
|
||
And a solver, e.g.:: | ||
|
||
julia> Pkg.add("Clp") # Will install Cbc as well | ||
|
||
Then read the :ref:`quick-start` and/or see a :ref:`simple-example`. | ||
The subsequent sections detail the complete functionality of JuMP. | ||
|
||
Contents | ||
-------- | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
installation.rst | ||
quickstart.rst | ||
refmodel.rst | ||
refvariable.rst | ||
refexpr.rst | ||
probmod.rst | ||
callbacks.rst | ||
nlp.rst | ||
|
||
----------- | ||
Citing JuMP | ||
----------- | ||
|
||
If you find JuMP useful in your work, we kindly request that you cite the following `paper <http://dx.doi.org/10.1287/ijoc.2014.0623>`_: | ||
|
||
.. code-block:: none | ||
|
||
@article{LubinDunningIJOC, | ||
author = {Miles Lubin and Iain Dunning}, | ||
title = {Computing in Operations Research Using Julia}, | ||
journal = {INFORMS Journal on Computing}, | ||
volume = {27}, | ||
number = {2}, | ||
pages = {238-248}, | ||
year = {2015}, | ||
doi = {10.1287/ijoc.2014.0623}, | ||
URL = {http://dx.doi.org/10.1287/ijoc.2014.0623} | ||
} | ||
|
||
A preprint of this paper is freely available on `arXiv <http://arxiv.org/abs/1312.1431>`_. | ||
|
||
If you use the nonlinear or conic optimization functionality of JuMP, please cite the following `preprint <http://arxiv.org/abs/1508.01982>`_ which describes the methods implemented in JuMP. You may cite it as: | ||
|
||
.. code-block:: none | ||
|
||
@article{DunningHuchetteLubin2015, | ||
title = {{JuMP}: {A} modeling language for mathematical optimization}, | ||
author = {Iain Dunning and Joey Huchette and Miles Lubin}, | ||
journal = {arXiv:1508.01982 [math.OC]}, | ||
year = {2015}, | ||
url = {http://arxiv.org/abs/1508.01982} | ||
} |
Oops, something went wrong.