Installation Guide
A complete guide to installing all that is necessary to use InfiniteOpt.jl
.
Install Julia
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.
Install Packages
Now that Julia has been installed we can add the needed packages. Open up a Julia terminal and enter the package manager:
julia> ]
(v1.10) pkg>
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.
Use the 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.10) pkg> add Distributions
Now let's install InfiniteOpt
:
(v1.10) pkg> add InfiniteOpt
Installation troubles? Check the Common Installation Problems section below.
Alternatively, we can install the current experimental version of InfiniteOpt
via:
(v1.10) pkg> add https://github.com/infiniteopt/InfiniteOpt.jl
Install Optimization Solvers
InfiniteOpt
relies on transformation backends to solve problems. These backends typically depend on optimization solvers which often are not native to Julia and might require commercial licenses. A list of currently supported solvers for JuMPBackend
s (i.e., transformation backends that use JuMP) and their corresponding Julia packages is provided in Supported Optimizers.
For example, we can install Ipopt which is an open-source nonlinear solver:
(v1.10) 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) # uses TranscriptionBackend by default
Most JuMP 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.
Common Installation Problems
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.
Check the version of your packages
Each package is versioned with a three-part number of the form vX.Y.Z
. You can check which versions you have installed with:
julia> ]
(v1.10) 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 status
!
Unsatisfiable requirements detected
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.
Installing new packages can make InfiniteOpt downgrade to an earlier version
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!