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

Write Docs for v0.1.5 #64

Merged
merged 42 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
be28607
Organize manual & booklet chapters in separate files
pedromxavier Feb 16, 2023
604620b
Fix authors' names
pedromxavier Feb 16, 2023
aff1f3b
Update text + Fix typos
pedromxavier Feb 16, 2023
2b29b29
Update text [no ci]
pedromxavier Feb 16, 2023
433488c
Update text
pedromxavier Feb 16, 2023
20958a3
Fix citation
pedromxavier Feb 16, 2023
6706d58
Fix `make.jl`
pedromxavier Feb 16, 2023
b615572
Add example to Quick Start
pedromxavier Feb 16, 2023
2b596f0
Update docs(qubo and quadratization)
pedroripper Feb 16, 2023
34d32bc
Add docs for quadratization and fix typos
pedroripper Feb 17, 2023
34f7a77
Merge branch 'master' into px/docs
pedromxavier Feb 23, 2023
e8eee66
Add double brackets to title in TeX citation
pedromxavier Feb 23, 2023
afc69be
Enhance quadatization methods' docs
pedromxavier Feb 23, 2023
43cc809
Minor Fix
pedromxavier Feb 23, 2023
72be8fa
Merge branch 'master' into px/docs
pedromxavier Feb 23, 2023
3df0a05
Update docs
pedromxavier Feb 24, 2023
1152620
Center images & diagrams
pedromxavier Feb 24, 2023
80ee186
Fix `extra_styles.css`
pedromxavier Feb 24, 2023
7eb1ae4
Add encoding intro
pedroripper Feb 24, 2023
e56193c
Update docs for constraint encoding
pedroripper Feb 28, 2023
a7786cc
Update docs
pedromxavier Mar 17, 2023
7791aec
Merge branch 'px/docs' of https://github.com/psrenergy/ToQUBO.jl into…
pedromxavier Mar 17, 2023
11383fb
Update docs [no ci]
pedroripper Apr 3, 2023
44b3b9b
Update README [no ci]
pedromxavier Apr 5, 2023
ea009d9
Replace `Anneal -> QUBODrivers`
pedromxavier Apr 5, 2023
b99166e
Add Portfolio Optimization tutorial
pedroripper Apr 14, 2023
777680a
Merge branch 'master' into px/docs
pedroripper Apr 14, 2023
95239a8
Update docs dependencies
pedromxavier Apr 17, 2023
e783c57
Polish portfolio optimization example
pedromxavier Apr 17, 2023
e0d68b1
Enhance plots
pedromxavier Apr 17, 2023
38d240f
Add text
pedromxavier Apr 17, 2023
a0618c4
Update dependencies
pedromxavier Apr 17, 2023
263b5b8
Update docs action
pedromxavier Apr 17, 2023
8081763
Enhance text [incomplete]
pedromxavier Apr 17, 2023
b27628f
Rewrite `QUBO` chapter
pedromxavier Apr 18, 2023
bfa79e1
Fix text
pedromxavier Apr 18, 2023
bc0ac56
Rephrase
pedromxavier Apr 18, 2023
1123961
Update docs
pedroripper Apr 19, 2023
f3eb784
Update docs
pedroripper Apr 19, 2023
2940896
Add encoding expansions
pedromxavier Apr 19, 2023
cad8e12
Update text
pedromxavier Apr 20, 2023
65b0441
Add explanation on encoding error
pedromxavier Apr 20, 2023
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
6 changes: 4 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ jobs:
- uses: julia-actions/setup-julia@latest
with:
version: '1.6'
- name: Develop ToQUBO.jl
run: julia --project=docs -e 'using Pkg; Pkg.develop(path=pwd())'
- uses: julia-actions/julia-buildpkg@latest
with:
project: "docs/"
project: "docs"
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
run: julia --project=docs/ docs/make.jl
run: julia --project=docs docs/make.jl
2 changes: 1 addition & 1 deletion CITATION.bib
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
% If you use this software, please cite it as below.
@software{toqubo:2023,
author = {Pedro Maciel Xavier and Pedro Ripper and Tiago Andrade and Joaquim Dias Garcia and David E. Bernal Neira},
title = {ToQUBO.jl},
title = {{ToQUBO.jl}},
month = {feb},
year = {2023},
publisher = {Zenodo},
Expand Down
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ ToQUBO.jl was written as a [MathOptInterface](https://github.com/jump-dev/MathOp

### Installation
ToQUBO is available via Julia's Pkg:
```julia
julia> ]add ToQUBO
```
or

```julia
julia> using Pkg

Expand All @@ -53,9 +50,10 @@ model = Model(() -> ToQUBO.Optimizer(ExactSampler.Optimizer))
optimize!(model)

for i = 1:result_count(model)
xᵢ = value.(x, result = i)
yᵢ = objective_value(model, result = i)
println("f($xᵢ) = $yᵢ")
xi = value.(x, result = i)
yi = objective_value(model, result = i)

println("f($xi) = $yi")
end
```

Expand Down Expand Up @@ -135,15 +133,15 @@ If you think this list is incomplete, consider creating an [Issue](https://githu
## Citing ToQUBO.jl
If you use `ToQUBO.jl` in your work, we kindly ask you to include the following citation:
```tex
@software{toqubo:2022,
author = {Pedro Xavier and Tiago Andrade and Joaquim Garcia and David Bernal},
@software{toqubo:2023,
author = {Pedro Maciel Xavier and Pedro Ripper and Tiago Andrade and Joaquim Dias Garcia and David E. Bernal Neira},
title = {{ToQUBO.jl}},
month = {mar},
year = {2022},
month = {feb},
year = {2023},
publisher = {Zenodo},
version = {v0.1.0},
doi = {10.5281/zenodo.6387592},
url = {https://doi.org/10.5281/zenodo.6387592}
version = {v0.1.5},
doi = {10.5281/zenodo.7644291},
url = {https://doi.org/10.5281/zenodo.7644291}
}
```

Expand Down
6 changes: 4 additions & 2 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ DWaveNeal = "870cdf72-5502-4b10-839c-127ceab78f22"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
MQLib = "16f11440-1623-44c9-850c-358a6c72f3c9"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
QUBODrivers = "a3f166f7-2cd3-47b6-9e1e-6fbfe0449eb0"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PythonPlot = "274fc56d-3b97-40fa-a1cd-1b4a50311bf9"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
ToQUBO = "9a412ddf-83fa-43b6-9748-7843c851aa65"

[compat]
CSV = "0.10"
DWaveNeal = "0.4"
DataFrames = "1.3"
Documenter = "0.27"
JuMP = "1"
Expand Down
48 changes: 34 additions & 14 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,44 @@ DocMeta.setdocmeta!(
)

makedocs(;
modules=[ToQUBO],
doctest=true,
clean=true,
format=Documenter.HTML(
assets = ["assets/extra_styles.css", "assets/favicon.ico"],
mathengine=Documenter.MathJax2(),
sidebar_sitename=false,
modules = [ToQUBO],
doctest = true,
clean = true,
format = Documenter.HTML(
assets = [
"assets/extra_styles.css",
"assets/favicon.ico",
asset("https://tikzjax.com/v1/fonts.css"; class = :css),
asset("https://tikzjax.com/v1/tikzjax.js"; class = :js),
],
mathengine = Documenter.KaTeX(),
sidebar_sitename = false,
),
sitename="ToQUBO.jl",
authors="Pedro Xavier and Tiago Andrade and Joaquim Garcia and David Bernal",
pages=[
sitename = "ToQUBO.jl",
authors = "Pedro Maciel Xavier and Pedro Ripper and Tiago Andrade and Joaquim Dias Garcia and David E. Bernal Neira",
pages = [
"Home" => "index.md",
"Manual" => "manual.md",
"Manual" => [
"Getting Started" => "manual/1-start.md",
"Running a Model" => "manual/2-model.md",
"Gathering Results" => "manual/3-results.md",
"Compiler Settings" => "manual/4-settings.md",
],
"Examples" => [
"Knapsack" =>"examples/knapsack.md",
"Prime Factorization" => "examples/prime_factorization.md",
"Knapsack" => "examples/knapsack.md",
"Prime Factorization" => "examples/prime_factorization.md",
"Portfolio Optimization" => "examples/portfolio_optimization.md",
],
"Booklet" => [
"Introduction" => "booklet/1-intro.md",
"QUBO" => "booklet/2-qubo.md",
"PBO" => "booklet/3-pbo.md",
"Encoding" => "booklet/4-encoding.md",
"Virtual Mapping" => "booklet/5-virtual.md",
"The Compiler" => "booklet/6-compiler.md",
"Solvers" => "booklet/7-solvers.md",
"Appendix" => "booklet/8-appendix.md",
],
"Booklet" => "booklet.md"
],
workdir="."
)
Expand Down
23 changes: 0 additions & 23 deletions docs/src/assets/README.md

This file was deleted.

13 changes: 12 additions & 1 deletion docs/src/assets/extra_styles.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
.docs-sidebar .docs-logo > img {
max-height: 16rem !important;
margin: auto;
}
}

/* Center images & diagrams */
p:has(img) {
text-align: center;
margin: 0 auto;
}

div.mermaid {
text-align: center;
margin: 0 auto;
}
Binary file added docs/src/assets/figures/quantum-chip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions docs/src/assets/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Ref:
** https://discourse.julialang.org/t/use-javascript-library-with-documenter-jl/34984/8
*/
require.config({
paths: {
mermaid: "https://cdnjs.cloudflare.com/ajax/libs/mermaid/9.4.0/mermaid.min"
}
});

require(['mermaid'], function (mermaid) {
mermaid.initialize({
startOnLoad : true,
theme : 'neutral',
// themeVariables: {
// primaryColor: '#BB2528',
// primaryTextColor: '#fff',
// primaryBorderColor: '#7C0000',
// lineColor: '#F8B229',
// secondaryColor: '#006100',
// tertiaryColor: '#aaa',
// noteBorderColor: '#ff0',
// }
})
});
121 changes: 0 additions & 121 deletions docs/src/booklet.md

This file was deleted.

11 changes: 11 additions & 0 deletions docs/src/booklet/1-intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ToQUBO.jl Booklet

This booklet aims to gather the theoretical and practical details behind `ToQUBO` and provide documentation for project internals.
The target audience includes, among others, advanced users and those willing to contribute to the project.
The latter are advised to read the following sections, as they give a glimpse of the ideas employed up to now.

## Table of Contents
```@contents
Pages = ["2-qubo.md", "3-pbo.md", "4-encoding.md", "5-virtual.md", "6-compiler.md", "7-solvers.md", "8-appendix.md"]
Depth = 2
```
41 changes: 41 additions & 0 deletions docs/src/booklet/2-qubo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# QUBO

## Definition
**Q**uadratic **U**nconstrained **B**inary **O**ptimization, as its name suggests, refers to the global minimization or maximization of a given quadratic polynomial over binary variables whose domain is that often reliesany way. on the laws of physics to compute solution candidates.
pedromxavier marked this conversation as resolved.
Show resolved Hide resolved
A common mathematical presentation is given by their quadratic matrix form, i.e.

```math
\begin{array}{rl}
\min_{\mathbf{x}} & \mathbf{x}' Q\,\mathbf{x} \\
\textrm{s.t.} & \mathbf{x} \in \mathbb{B}^{n}
\end{array}
```

where ``Q \in \mathbb{R}^{n \times n}`` is symmetric and ``\mathbb{B} = \lbrace{0, 1}\rbrace``.

## OK, but why QUBO?
Mathematically speaking, there is a notorious equivalence between QUBO and [Max-Cut](https://en.wikipedia.org/wiki/Maximum_cut) problems, e.g. for every QUBO instance there is an information preserving Max-Cut reformulation and vice versa.
This statement if followed by two immediate implications:
pedromxavier marked this conversation as resolved.
Show resolved Hide resolved
1. In the general case, solving QUBO globally is NP-Hard.
2. It is a simple yet expressive mathematical programming framework.

Implication 1. tells us that such problems are computationally intractable and that heuristics and metaheuristics are to be employed instead of exact methods.
No 2. relates to the fact that we are able to represent many other optimization models by means of the QUBO formalism.

pedromxavier marked this conversation as resolved.
Show resolved Hide resolved
The [Ising Model](https://en.wikipedia.org/wiki/Ising_model), on the other hand, is a mathematical abstraction to describe statistical interactions within mechanical systems.
Its _Hamiltonian energy function_ leads to an optimization formulation in terms of the ``\pm 1`` _spin_ values of their states, written as
pedromxavier marked this conversation as resolved.
Show resolved Hide resolved

```math
\begin{array}{rl}
\min_{\mathbf{s}} & \mathbf{h}'\mathbf{s} + \mathbf{s}' J\,\mathbf{s} \\
\textrm{s.t.} & \mathbf{s} \in \lbrace{-1,+1}\rbrace^{n}
\end{array}
```

where ``J \in \mathbb{R}^{n \times n}`` is strictly upper triangular and ``\mathbf{h} \in \mathbb{R}``.

[![D-Wave Washington 1000Q](../assets/figures/quantum-chip.png)](https://commons.wikimedia.org/wiki/File:D-Wave-Washington-1000Q.jpg)

The Ising reformulation alternative draws the bridge between QUBO problems and specialized devices that rely on the laws of physics to compute solution candidates.
pedromxavier marked this conversation as resolved.
Show resolved Hide resolved
Some of the paradigms that stand out in this context are quantum gate-based optimization algorithms (QAOA and VQE), quantum annealers and hardware-accelerated platforms (Coherent Ising Machines and Simulated Bifurcation Machines).
pedromxavier marked this conversation as resolved.
Show resolved Hide resolved
The significant advances in these computing systems contributed to the growing popularity of the model across the literature.
Loading