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

documentation setup #189

Merged
merged 52 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
1d1813c
Update README.md
saurabhintoml May 22, 2024
6fd57a8
Update README.md
saurabhintoml May 22, 2024
5a696ee
Update README.md
saurabhintoml May 22, 2024
659616f
Update README.md
saurabhintoml May 22, 2024
b4917f8
Update README.md
saurabhintoml May 22, 2024
4f10b66
Initial commit
May 22, 2024
47a2e9c
Files generated by PkgTemplates
May 22, 2024
116abb3
Boscia
Jun 3, 2024
3de2ab9
Resolved merge conflicts and completed the merge
Jun 3, 2024
d97242a
Update README.md
saurabhintoml Jun 11, 2024
0e7eacc
DELeted docs
Jun 11, 2024
5e6d382
Resolved
Jun 11, 2024
502b9c3
Merge changes from master into main
Jun 11, 2024
3b3dbb3
Add docs directory
Jun 11, 2024
c16b07f
Update README.md
saurabhintoml Jun 12, 2024
7b1e888
Committing changes to docs directory
Jun 19, 2024
6d4412b
Committing changes to CI workflow and docs
Jun 19, 2024
e61e64f
Merge remote changes into local branch
Jun 19, 2024
74445d9
Commit message describing your changes
Jun 19, 2024
295fa08
Committing staged changes in docs directoy
Jun 19, 2024
37c3685
Remove docs directory
Jun 19, 2024
ce04261
added docs
Jun 19, 2024
00fbd57
Remove docs directory
Jun 19, 2024
8da59be
Remove docs directory
Jun 19, 2024
9e60c19
test2
Jun 19, 2024
e657e90
test
Jun 19, 2024
74db1e4
make
Jun 19, 2024
dee270d
Update utilities.md
saurabhintoml Jun 19, 2024
77e33b8
Update utilities.md
saurabhintoml Jun 19, 2024
4950810
Update fw_variant.md
saurabhintoml Jun 19, 2024
aa03829
Update custom.md
saurabhintoml Jun 19, 2024
66f3171
Update custom.md
saurabhintoml Jun 19, 2024
36a6351
Update 2_blmo_build.md
saurabhintoml Jun 19, 2024
e5e9b06
Update 0_reference.md
saurabhintoml Jun 19, 2024
f9654cc
Update 1_algorithms.md
saurabhintoml Jun 19, 2024
876ec9b
Update basics.md
saurabhintoml Jun 19, 2024
a356e13
Update basics.md
saurabhintoml Jun 19, 2024
fa0b5ef
Update int_sparse_reg.jl
saurabhintoml Jun 19, 2024
2f1a671
Update cube_blmo.jl
saurabhintoml Jun 19, 2024
e702c72
Update birkhoff.jl
saurabhintoml Jun 19, 2024
e3efc8a
Update HiGHS_example.jl
saurabhintoml Jun 19, 2024
9e87400
Update HiGHS_example.jl
saurabhintoml Jun 19, 2024
f0ef10d
Update approx_planted_point.jl
saurabhintoml Jun 19, 2024
50a6fc9
Update HiGHS_example.jl
saurabhintoml Jun 19, 2024
1475739
Update basics.md
saurabhintoml Jun 19, 2024
a16eca2
Interface
Jul 2, 2024
eda9856
Update LICENSE
saurabhintoml Jul 10, 2024
67e5e84
Update LICENSE
saurabhintoml Jul 10, 2024
1db1cb8
Update make.jl
saurabhintoml Jul 10, 2024
a93dd86
changes
Jul 10, 2024
075f2fb
fresh changes
Jul 10, 2024
c34c200
again ci
Jul 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
31 changes: 31 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
docs:
name: Documentation
runs-on: ubuntu-latest
permissions:
actions: write # needed to allow julia-actions/cache to proactively delete old caches that it has created
contents: write
statuses: write
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- uses: julia-actions/cache@v1
- name: Configure doc environment
shell: julia --project=docs --color=yes {0}
run: |
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
- name: Run doctests
shell: julia --project=docs --color=yes {0}
run: |
using Documenter: DocMeta, doctest
using Boscia
DocMeta.setdocmeta!(Boscia, :DocTestSetup, :(using Boscia); recursive=true)
doctest(Boscia)
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
*.jl.*.cov
*.jl.cov
*.jl.mem
/docs/Manifest.toml
/docs/build/
# Files generated by invoking Julia with --code-coverage
*.jl.cov
*.jl.*.cov
Expand Down
Empty file added .gitmodules
Empty file.
43 changes: 27 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,50 @@ A solver for Mixed-Integer Convex Optimization that uses Frank-Wolfe methods for

## Overview

The Boscia.jl solver combines (a variant of) the Frank-Wolfe algorithm with a branch-and-bound like algorithm to solve mixed-integer convex optimization problems of the form
`min_{x ∈ C, x_I ∈ Z^n} f(x)`,
where `f` is a differentiable convex function, `C` is a convex and compact set, and `I` is a set of indices of integral variables.

They are especially useful when we have a method to optimize a linear function over `C` and the integrality constraints in a compuationally efficient way.
`C` is specified using the MathOptInterface API or any DSL like JuMP implementing it.

A paper presenting the package with mathematical explanations and numerous examples can be found here:
The Boscia.jl solver uses a combination of a variant of the Frank-Wolfe algorithm and a branch-and-bound-like algorithm to solve mixed-integer convex optimization problems. These problems are of the form:
saurabhintoml marked this conversation as resolved.
Show resolved Hide resolved
**min_{x ∈ C, x_I ∈ Z^n} f(x)**,
saurabhintoml marked this conversation as resolved.
Show resolved Hide resolved
This approach is particularly effective if we can solve the mixed-integer linear minimization problem over C efficiently and handle the integer constraints. The set C is specified using the MathOptInterface API or any domain-specific language (DSL) like Julia for Mathematical Programming (**JuMP**) that implements this API.
The paper presenting the package with mathematical explanations and numerous examples can be found here:

> Convex integer optimization with Frank-Wolfe methods: [2208.11010](https://arxiv.org/abs/2208.11010)

`Boscia.jl` uses [`FrankWolfe.jl`](https://github.com/ZIB-IOL/FrankWolfe.jl) for solving the convex subproblems, [`Bonobo.jl`](https://github.com/Wikunia/Bonobo.jl) for managing the search tree, and oracles optimizing linear functions over the feasible set, for instance calling [SCIP](https://scipopt.org) or any MOI-compatible solver to solve MIP subproblems.

## Installation

Add the Boscia stable release with:

```julia
import Pkg
Pkg.add("Boscia")
Once you have installed Julia , From the Julia REPL, type ] to enter the Pkg REPL mode and run
```Boscia
pkg > add Boscia

saurabhintoml marked this conversation as resolved.
Show resolved Hide resolved
```

Or get the latest master branch with:
or alternatively via Pkg in any Julia code:
```julia
import Pkg
Pkg.add(url="https://github.com/ZIB-IOL/Boscia.jl", rev="main")
Pkg.add("Boscia")
```





If you want to use SCIP within Boscia and your OS is windows, you will have download SCIP separately, see SCIP.jl.
Note that you do not necessarily have to download the binaries but can also use the installer provided by SCIP.


**For Window Users** You need not to download whole SCIP binary instead you can follow **Custom Installation** mentioned on this page and download and link SCIP with your JULIA .
saurabhintoml marked this conversation as resolved.
Show resolved Hide resolved






## Getting started

Here is a simple example to get started. For more examples, see the examples folder in the package.


```julia
using Boscia
using FrankWolfe
Expand Down Expand Up @@ -86,8 +98,6 @@ Parameter settings.
Total number of varibales: 6
Number of integer variables: 0
Number of binary variables: 6


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Iteration Open Bound Incumbent Gap (abs) Gap (rel) Time (s) Nodes/sec FW (ms) LMO (ms) LMO (calls c) FW (Its) #ActiveSet Discarded
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -124,3 +134,4 @@ Search Statistics.
LMO calls / sec: 1205.1724137931035
Nodes / sec: 218.96551724137933
LMO calls / node: 5.503937007874016
```
51 changes: 51 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Documenter
using Boscia

working_dir = @__DIR__

# Function to copy contents of README.md to index.md
function copy_readme_to_index()
readme_path = joinpath(working_dir, "..", "README.md") # Adjusted path
index_path = joinpath(working_dir, "src", "index.md")
readme_content = read(readme_path, String)
write(index_path, readme_content)
end



# Call the functions to update index.md and 1_algorithms.md
copy_readme_to_index()


# Generate documentation
makedocs(
sitename = "Boscia.jl",
modules = [Boscia],
format = Documenter.HTML(repolink = "https://github.com/ZIB-IOL/Boscia.jl"),
pages = [
"Home" => "index.md",
"How does it work?" => "basics.md",

"API Reference" => [
"reference/0_reference.md",
"reference/1_algorithms.md",
"reference/2_blmo_build.md" ,
"reference/custom.md" ,
"reference/fw_variant.md" ,
"reference/utilities.md"

]
],
warnonly = true
)

# Deploy documentation
deploydocs(
repo = "https://github.com/saurabhintoml/Boscia.jl.git",
devbranch = "main",
devurl = "dev",
target = "build",
branch = "gh-pages",
versions = ["stable" => "v^", "v#.#"],
push_preview = true
)
52 changes: 52 additions & 0 deletions docs/src/basics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# How does it work ?

Boscia focuses on mixed-integer convex problems in which the constraints linear , objective non linear are convex and presents a new algorithmic framework for solving these problems that exploit recent advances in so-called Frank-Wolfe (FW) or Conditional Gradient (CG) methods. The problem class we consider is of the type:
$$
\min ( f(x) ) \text{ where } x \in \mathbb{R}^n, \, x \in X
$$

where \( X \) is a compact nonconvex set admitting a boundable linear minimization oracle (LMO), i.e., a set over which optimizing a linear function can be done efficiently (comparatively to the original problem), even when bounds are added or modified. Formally, we consider we have access to an oracle taking new bounds \( (l, u) \) and a direction \( d \):

Given :
$$
\( (l, u, d) \in \mathbb{R}^n \times \mathbb{R}^n \times \mathbb{R}^n \), \( \arg\min_{v \in \mathbb{R}^n} \langle v, d \rangle \)
\text {subject to} \( v \in X \cap [l, u] \).
$$


# Branch and Bound Techniques

In this section, we present the techniques derived from Frank Wolfe that can be used in our
framework .

## FW gap based termination

Frank-Wolfe methods produce primal feasible iterates and an FW gap, offering many inexpensive iterations with a gradually increasing dual bound. This allows early termination of nodes when the dual bound reaches the best incumbent's objective value, avoiding unnecessary computations. Nodes can be stopped anytime to produce a useful dual bound, aiding overall progress. This flexibility contrasts with other nonlinear solvers, enabling more efficient optimization.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good! I would add a quick explanation of the Frank-Wolfe gap as this might not be known.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the explanation of the Frank-Wolfe gap?


## Tree stae-dependent termination and evolving error

We implement termination criteria in node processing to reduce iterations, prioritizing nodes with promising lower bounds. An adaptive Frank-Wolfe gap criterion increases precision with depth in the branch-and-bound tree. Frank Wolfe's convex combinations of integer extreme points ensure valid dual bound, even with reduced precision runs. This approach balances efficiency and accuracy in solving optimization problems.we have Hybrid branching which couples strong branching and most infeasible branching. Strong branching is very expensive to do for the whole tree and it's usually more beneficial to utilize strong branching only up to a certain depth.




## Strong Branching
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add that we have Hybrid branching which couples strong branching and most infeasible branching. Strong branching is very expensive to do for the whole tree and it's usually more beneficial to utilize strong branching only up to a certain depth.


In tackling large discrete optimization problems, our method utilizes Frank-Wolfe algorithms to approximate lower bound improvements efficiently. By relaxing strong branching to continuous LPs for the Linear Minimization Oracle and controlling FW iterations or gap tolerances, we balance computational cost with accuracy. This approach optimizes variable selection in branch-and-bound algorithms, enhancing scalability and efficiency in solving complex discrete optimization challenges.

## Dual fixing and tightening

In subproblems where variables are at bounds, our approach utilizes convexity and primal solutions to tighten dual bounds effectively. Drawing from methods pioneered by Dantzig and extended in various contexts, we leverage Frank-Wolfe methods and FW gaps, adaptable to scenarios without explicit dual solutions, such as those involving MIP-based LMOs.




## BPCG (used as default)

The classic FW algorithm's reliance on an LMO is inefficient for polytopes due to expensive calls. The Blended Pairwise Conditional Gradient (BPCG) algorithm improves efficiency by combining FW steps with pairwise steps that avoid LMO calls. BPCG maintains a smaller active set of vertices, enhancing performance. We use a modified lazified BPCG from FrankWolfe.jl.






Empty file added docs/src/how_to_run.md
Empty file.
139 changes: 139 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Boscia.jl
saurabhintoml marked this conversation as resolved.
Show resolved Hide resolved

[![Build Status](https://github.com/ZIB-IOL/Boscia.jl/workflows/CI/badge.svg)](https://github.com/ZIB-IOL/Boscia.jl/actions)
[![Coverage](https://codecov.io/gh/ZIB-IOL/Boscia.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ZIB-IOL/Boscia.jl)

A solver for Mixed-Integer Convex Optimization that uses Frank-Wolfe methods for convex relaxations and a branch-and-bound algorithm.

## Overview

The Boscia.jl solver uses a combination of a variant of the Frank-Wolfe algorithm and a branch-and-bound-like algorithm to solve mixed-integer convex optimization problems. These problems are of the form:
**min_{x ∈ C, x_I ∈ Z^n} f(x)**,
This approach is particularly effective if we can solve the mixed-integer linear minimization problem over C efficiently and handle the integer constraints. The set C is specified using the MathOptInterface API or any domain-specific language (DSL) like Julia for Mathematical Programming (**JuMP**) that implements this API.
The paper presenting the package with mathematical explanations and numerous examples can be found here:

> Convex integer optimization with Frank-Wolfe methods: [2208.11010](https://arxiv.org/abs/2208.11010)

`Boscia.jl` uses [`FrankWolfe.jl`](https://github.com/ZIB-IOL/FrankWolfe.jl) for solving the convex subproblems, [`Bonobo.jl`](https://github.com/Wikunia/Bonobo.jl) for managing the search tree, and oracles optimizing linear functions over the feasible set, for instance calling [SCIP](https://scipopt.org) or any MOI-compatible solver to solve MIP subproblems.

## Installation


Once you have installed Julia , From the Julia REPL, type ] to enter the Pkg REPL mode and run
```Boscia
pkg > add Boscia

```

or alternatively via Pkg in any Julia code:
```julia
import Pkg
Pkg.add("Boscia")
```



Suggested change
If you don't have SCIP , you can on go this link and add SCIP as instructed ['SCIP'](https://github.com/scipopt/SCIP.jl)


If you want to use SCIP within Boscia and your OS is windows, you will have download SCIP separately, see SCIP.jl.
Note that you do not necessarily have to download the binaries but can also use the installer provided by SCIP.


**For Window Users** You need not to download whole SCIP binary instead you can follow **Custom Installation** mentioned on this page and download and link SCIP with your JULIA .






## Getting started

Here is a simple example to get started. For more examples, see the examples folder in the package.


```julia
using Boscia
using FrankWolfe
using Random
using SCIP
using LinearAlgebra
import MathOptInterface
const MOI = MathOptInterface

n = 6

const diffw = 0.5 * ones(n)
o = SCIP.Optimizer()

MOI.set(o, MOI.Silent(), true)

x = MOI.add_variables(o, n)

for xi in x
MOI.add_constraint(o, xi, MOI.GreaterThan(0.0))
MOI.add_constraint(o, xi, MOI.LessThan(1.0))
MOI.add_constraint(o, xi, MOI.ZeroOne())
end

lmo = FrankWolfe.MathOptLMO(o)

function f(x)
return sum(0.5*(x.-diffw).^2)
end

function grad!(storage, x)
@. storage = x-diffw
end

x, _, result = Boscia.solve(f, grad!, lmo, verbose = true)

Boscia Algorithm.

Parameter settings.
Tree traversal strategy: Move best bound
Branching strategy: Most infeasible
Absolute dual gap tolerance: 1.000000e-06
Relative dual gap tolerance: 1.000000e-02
Frank-Wolfe subproblem tolerance: 1.000000e-05
Total number of varibales: 6
Number of integer variables: 0
Number of binary variables: 6
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Iteration Open Bound Incumbent Gap (abs) Gap (rel) Time (s) Nodes/sec FW (ms) LMO (ms) LMO (calls c) FW (Its) #ActiveSet Discarded
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
* 1 2 -1.202020e-06 7.500000e-01 7.500012e-01 Inf 3.870000e-01 7.751938e+00 237 2 9 13 1 0
100 27 6.249998e-01 7.500000e-01 1.250002e-01 2.000004e-01 5.590000e-01 2.271914e+02 0 0 641 0 1 0
127 0 7.500000e-01 7.500000e-01 0.000000e+00 0.000000e+00 5.770000e-01 2.201040e+02 0 0 695 0 1 0
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Postprocessing

Blended Pairwise Conditional Gradient Algorithm.
MEMORY_MODE: FrankWolfe.InplaceEmphasis() STEPSIZE: Adaptive EPSILON: 1.0e-7 MAXITERATION: 10000 TYPE: Float64
GRADIENTTYPE: Nothing LAZY: true lazy_tolerance: 2.0
[ Info: In memory_mode memory iterates are written back into x0!

----------------------------------------------------------------------------------------------------------------
Type Iteration Primal Dual Dual Gap Time It/sec #ActiveSet
----------------------------------------------------------------------------------------------------------------
Last 0 7.500000e-01 7.500000e-01 0.000000e+00 1.086583e-03 0.000000e+00 1
----------------------------------------------------------------------------------------------------------------
PP 0 7.500000e-01 7.500000e-01 0.000000e+00 1.927792e-03 0.000000e+00 1
----------------------------------------------------------------------------------------------------------------

Solution Statistics.
Solution Status: Optimal (tree empty)
Primal Objective: 0.75
Dual Bound: 0.75
Dual Gap (relative): 0.0

Search Statistics.
Total number of nodes processed: 127
Total number of lmo calls: 699
Total time (s): 0.58
LMO calls / sec: 1205.1724137931035
Nodes / sec: 218.96551724137933
LMO calls / node: 5.503937007874016
```
3 changes: 3 additions & 0 deletions docs/src/reference/0_reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# API Reference

In this section we present the algorithm interface and the possible settings.
12 changes: 12 additions & 0 deletions docs/src/reference/1_algorithms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Algorithm

This section contains information about interface.jl
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this section we present the algorithm interface and the possible settings.


## Interface

```@autodocs
Modules = [Boscia]
Pages = ["interface.jl"]
```


Loading