Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predictor-Corrector algorithm #66

Merged
merged 11 commits into from
Nov 24, 2020
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
*.jl.cov
*.jl.*.cov
*.jl.mem
Manifest.toml
Manifest.toml
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,21 @@ When using Tulip through JuMP/MOI, parameters can be set either through MOI's ge
```julia
jump_model = JuMP.Model(Tulip.Optimizer)

JuMP.set_optimizer_attribute(jump_model, "BarrierIterationsLimit", 200)
JuMP.set_optimizer_attribute(jump_model, "IPM_IterationsLimit", 200)
```

* Through MOI
```julia
moi_model = Tulip.Optimizer{Float64}()

MOI.set(moi_model, MOI.RawParameter("BarrierIterationsLimit"), 200)
MOI.set(moi_model, MOI.RawParameter("IPM_IterationsLimit"), 200)
```

* Through Tulip's API
```julia
model = Tulip.Model{Float64}()

Tulip.set_parameter(model, "BarrierIterationsLimit", 200)
Tulip.set_parameter(model, "IPM_IterationsLimit", 200)
```

### Parameters description
Expand Down
12 changes: 9 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ makedocs(
],
"User manual" => Any[
"Problem formulation" => "manual/formulation.md",
"Solving linear systems" => "manual/linear_systems.md"
"Solving linear systems" => "manual/linear_systems.md",
"Algorithms" => Any[
"Homogeneous Self-Dual" => "manual/IPM/HSD.md",
"Predictor-Corrector" => "manual/IPM/MPC.md"
],
"Setting options" => "manual/options.md"
],
"Reference" => Any[
"Presolve" => "reference/Presolve/presolve.md",
"KKT solvers" => "reference/KKT/kkt_solvers.md",
"Julia API" => "reference/API.md",
"Attributes" => "reference/attributes.md",
"Parameters" => "reference/parameters.md",
"KKT solvers" => "reference/kkt_solvers.md"
"Options" => "reference/options.md"
],
]
)
Expand Down
10 changes: 10 additions & 0 deletions docs/src/manual/IPM/HSD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Homogeneous Self-Dual algorithm

```@docs
Tulip.HSD
```

## References

* Anjos, M.F.; Lodi, A.; Tanneau, M.
[Design and implementation of a modular interior-point solver for linear optimization](https://arxiv.org/abs/2006.08814)
11 changes: 11 additions & 0 deletions docs/src/manual/IPM/MPC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Predictor-Corrector algorithm

```@docs
Tulip.MPC
```

## References

* Mehrotra, S.
[On the Implementation of a Primal-Dual Interior Point Method](https://doi.org/10.1137/0802028)
SIAM Journal on Optimization, 1992, 2, 575-601
17 changes: 17 additions & 0 deletions docs/src/manual/options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```@meta
CurrentModule = Tulip
```

# Options management

!!! info
This part of the documentation is under construction

See [Options reference](@ref) for a list of all available options and their signification.

## Handling options within JuMP

## Handling options within MOI

## Handling options directly

Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,7 @@ solve!
### Choosing between linear solvers

```@docs
SolverOptions
```

```@meta
CurrentModule = Tulip
```

```@docs
TLA.MatrixOptions
```

```@meta
CurrentModule = Tulip.KKT
KKTOptions
```

## Dense/LAPACK
Expand Down
Empty file.
75 changes: 75 additions & 0 deletions docs/src/reference/options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
```@meta
CurrentModule = Tulip
```

# Options reference

Parameters can be queried and set through the [`get_parameter`](@ref) and [`set_parameter`](@ref) functions.

In all that follows, ``\epsilon`` refers to the numerical precision, which is given by `eps(Tv)` where `Tv` is the arithmetic of the current model.
For instance, in double-precision arithmetic, i.e., `Tv=Float64`, we have ``\epsilon \simeq 10^{-16}``.

```@docs
Factory
```

## Presolve

These parameters control the execution of the presolve phase.
They should be called as `"Presolve_<Param>"`.


## Linear Algebra

These parameters control the linear algebra implementation

| Parameter | Description | Default |
|:----------|:------------|:--------|
| `MatrixFactory` | See [`Factory`](@ref) | `Factory(SparseMatrixCSC)`


## KKT solvers

| Parameter | Description | Default |
|:----------|:------------|:--------|
| `Factory` | See [`Factory`](@ref) | [`KKT.CholmodSQD`](@ref) for `Float64`, [`KKT.LDLFactSQD`](@ref) otherwise |

## Interior-Point

### Tolerances

Numerical tolerances for the interior-point algorithm.

| Parameter | Description | Default |
|:----------|:------------|:--------|
| `TolerancePFeas` | Primal feasibility tolerance | ``\sqrt{\epsilon}``
| `ToleranceDFeas` | Dual feasibility tolerance | ``\sqrt{\epsilon}``
| `ToleranceRGap` | Relative optimality gap tolerance | ``\sqrt{\epsilon}``
| `ToleranceIFeas` | Infeasibility tolerance | ``\sqrt{\epsilon}``

### Algorithmic parameters

| Parameter | Description | Default |
|:----------|:------------|:--------|
| `BarrierAlgorithm` | Interior-point algorithm | `1` |
| `CorrectionLimit` | Maximum number of additional centrality corrections | `5` |
| `StepDampFactor` | Step | `0.9995` |
| `GammaMin` | Minimum value of ``\gamma`` for computing correctors | `0.1`
| `CentralityOutlierThreshold` | Relative threshold for computing extra centrality corrections | `0.1`
| `PRegMin` | Minimum value of primal regularization | ``\sqrt{\epsilon}`` |
| `DRegMin` | Minimum value of dual regularization | ``\sqrt{\epsilon}``

### Stopping criterion

| Parameter | Description | Default |
|:----------|:------------|:--------|
| `IterationsLimit` | Maximum number of barrier iterations | `100` |
| `TimeLimit` | Time limit, in seconds | `Inf` |

## Others

| Parameter | Description | Default |
|:----------|:------------|:--------|
| `OutputLevel` | Controls the solver's output | `0` |
| `Threads` | Maximum number of threads | `1` |
| `Presolve` | Presolve (no presolve if set to ≤ 0) | `1` |
55 changes: 0 additions & 55 deletions docs/src/reference/parameters.md

This file was deleted.

6 changes: 3 additions & 3 deletions docs/src/tutorials/lp_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ lp = Model(Tulip.Optimizer)

# Set some parameters
set_optimizer_attribute(lp, "OutputLevel", 0) # disable output
set_optimizer_attribute(lp, "Presolve", 0) # disable presolve
set_optimizer_attribute(lp, "Presolve_Level", 0) # disable presolve

# Solve the problem
optimize!(lp)
Expand Down Expand Up @@ -114,7 +114,7 @@ MOI.set(lp, MOI.ObjectiveSense(), MOI.MIN_SENSE)

# Set some parameters
MOI.set(lp, MOI.Silent(), true) # disable output
MOI.set(lp, MOI.RawParameter("Presolve"), 0) # disable presolve
MOI.set(lp, MOI.RawParameter("Presolve_Level"), 0) # disable presolve

# Solve the problem
MOI.optimize!(lp)
Expand Down Expand Up @@ -169,7 +169,7 @@ row3 = Tulip.add_constraint!(pb, [x, y], [1.0, 2.0], -Inf, 7.0, "row3")

# Set some parameters
Tulip.set_parameter(lp, "OutputLevel", 0) # disable output
Tulip.set_parameter(lp, "Presolve", 0) # disable presolve
Tulip.set_parameter(lp, "Presolve_Level", 0) # disable presolve

# Solve the problem
Tulip.optimize!(lp)
Expand Down
26 changes: 26 additions & 0 deletions examples/dat/lpex_freevars.mps
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
NAME LP_FREE_VARS

* Problem:
* min x1 + x2 + x3
* s.t. 2 x1 + x2 >= 2
* x1 + 2 x2 >= 2
* x1 + x2 + x3 >= 0

ROWS
G ROW1
G ROW2
G ROW3
N COST
COLUMNS
X1 ROW1 2. ROW2 1.
X1 COST 1. ROW3 1.
X2 ROW1 1. ROW2 2.
X2 COST 1. ROW3 1.
X3 ROW3 1. COST 1.
RHS
B ROW1 2. ROW2 2.
BOUNDS
FR BND1 X1
FR BND1 X2
FR BND1 X3
ENDATA
7 changes: 6 additions & 1 deletion examples/freevars.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ INSTANCE_DIR = joinpath(@__DIR__, "dat")

function ex_freevars(::Type{Tv};
atol::Tv = 100 * sqrt(eps(Tv)),
rtol::Tv = 100 * sqrt(eps(Tv))
rtol::Tv = 100 * sqrt(eps(Tv)),
kwargs...
) where{Tv}
#=
Example with free variables
Expand All @@ -21,6 +22,10 @@ function ex_freevars(::Type{Tv};
=#
m = TLP.Model{Tv}()
m.params.OutputLevel = 1
# Set optional parameters
for (k, val) in kwargs
TLP.set_parameter(m, String(k), val)
end

# Read problem and solve
TLP.load_problem!(m, joinpath(INSTANCE_DIR, "lpex_freevars.mps"))
Expand Down
7 changes: 6 additions & 1 deletion examples/infeasible.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ INSTANCE_DIR = joinpath(@__DIR__, "dat")

function ex_infeasible(::Type{Tv};
atol::Tv = 100 * sqrt(eps(Tv)),
rtol::Tv = 100 * sqrt(eps(Tv))
rtol::Tv = 100 * sqrt(eps(Tv)),
kwargs...
) where{Tv}
#=
Infeasible example
Expand All @@ -22,6 +23,10 @@ function ex_infeasible(::Type{Tv};
=#
m = TLP.Model{Tv}()
m.params.OutputLevel = 1
# Set optional parameters
for (k, val) in kwargs
TLP.set_parameter(m, String(k), val)
end

# Read problem from .mps file and solve
TLP.load_problem!(m, joinpath(INSTANCE_DIR, "lpex_inf.mps"))
Expand Down
7 changes: 6 additions & 1 deletion examples/optimal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ INSTANCE_DIR = joinpath(@__DIR__, "dat")

function ex_optimal(::Type{Tv};
atol::Tv = 100 * sqrt(eps(Tv)),
rtol::Tv = 100 * sqrt(eps(Tv))
rtol::Tv = 100 * sqrt(eps(Tv)),
kwargs...
) where{Tv}

#=
Expand All @@ -23,6 +24,10 @@ function ex_optimal(::Type{Tv};
=#
m = TLP.Model{Tv}()
m.params.OutputLevel = 1
# Set optional parameters
for (k, val) in kwargs
TLP.set_parameter(m, String(k), val)
end

# Read problem and solve
TLP.load_problem!(m, joinpath(INSTANCE_DIR, "lpex_opt.mps"))
Expand Down
7 changes: 6 additions & 1 deletion examples/unbounded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ INSTANCE_DIR = joinpath(@__DIR__, "dat")

function ex_unbounded(::Type{Tv};
atol::Tv = 100 * sqrt(eps(Tv)),
rtol::Tv = 100 * sqrt(eps(Tv))
rtol::Tv = 100 * sqrt(eps(Tv)),
kwargs...
) where{Tv}
#=
Unbounded example
Expand All @@ -20,6 +21,10 @@ function ex_unbounded(::Type{Tv};
=#
m = TLP.Model{Tv}()
m.params.OutputLevel = 1
# Set optional parameters
for (k, val) in kwargs
TLP.set_parameter(m, String(k), val)
end

# Read problem from .mps file and solve
TLP.load_problem!(m, joinpath(INSTANCE_DIR, "lpex_ubd.mps"))
Expand Down
Loading