A complete guide to installing all that is necessary to use
InfiniteOpt is a Julia package. Thus, we first need to have an installation of Julia to get started. An appropriate download can be found here. We recommend using VSCode to edit and run Julia scripts.
This version of
InfiniteOpt requires that Julia 1.6 or newer be used.
We recommend installing the latest version of Julia. However, for users that cannot update Julia frequently (e.g., industrial users with IT limitations), we recommend installing the long term support (LTS) version which is 1.6.
Now that Julia has been installed we can add the needed packages. Open up a Julia terminal and enter the package manager:
We recommend you create a Pkg environment for each project you use
InfiniteOpt for, instead of adding lots of packages to the global environment. The Pkg manager documentation has more information on this topic.
add command in the package to manager to add the following packages:
Distributions(required for stochastic programming)
For example, to install
Distributions we would enter:
(v1.9) pkg> add Distributions
Now let's install
(v1.9) pkg> add InfiniteOpt
Installation troubles? Check the Common Installation Problems section below.
Alternatively, we can install the current experimental version of
(v1.9) pkg> add https://github.com/infiniteopt/InfiniteOpt.jl
InfiniteOpt relies on solvers to solve optimization problems. Many solvers are not native to Julia and might require commercial licenses. A list of currently supported solvers and their corresponding Julia packages is provided in Supported Optimizers.
For example, we can install Ipopt which is an open-source nonlinear solver:
(v1.9) pkg> add Ipopt
Now Ipopt can be used as the optimizer (solver) for an infinite model by running:
julia> using InfiniteOpt, Ipopt
julia> model = InfiniteModel(Ipopt.Optimizer)
Most solver packages follow the
ModuleName.Optimizer naming convention, but this may not always be the case. See Infinite Models for more information on defining infinite models and specifying solvers.
When in doubt, run
import Pkg; Pkg.update() to see if updating your packages fixes the issue. Remember you will need to exit Julia and start a new session for the changes to take effect.
Each package is versioned with a three-part number of the form
vX.Y.Z. You can check which versions you have installed with:
(v1.9) pkg> status
This should almost always be the most-recent release. You can check the releases of a package by going to the relevant GitHub page, and navigating to the "releases" page. For example, the list of
JuMP releases is available at: https://github.com/infiniteopt/InfiniteOpt.jl/releases.
If you need to ask question for help, please include the output of
Did you get an error like
Unsatisfiable requirements detected for package InfiniteOpt? The Pkg documentation has a section on how to understand and manage these conflicts.
Typically, these conflicts can be resolved by using package environments.
Another common issue is that after adding a new package, code that previously worked no longer runs.
This usually happens because the new package is not compatible with the latest version of
InfiniteOpt. Therefore, the package manager downgrades
InfiniteOpt to an earlier version!
Thus, please pay careful attention to the output of the package manager when adding new packages, especially when you see a package being downgraded!