diff --git a/.gitignore b/.gitignore index b067edd..a86bda8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /Manifest.toml +docs/build diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..3342d91 --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,17 @@ +import Pkg +Pkg.add("Documenter") +using Documenter +push!(LOAD_PATH, "../src/") +makedocs( + modules = [PereiraMartinez2024], + sitename = "PereiraMartinez2024.jl", + pages = [ + "Home" => "index.md", + ], +) +deploydocs( + repo = "github.com/m3g/PereiraMartinez2024.jl.git", + target = "build", + branch = "gh-pages", + versions = ["stable" => "v^", "v#.#"], +) diff --git a/docs/src/assets/logo.svg b/docs/src/assets/logo.svg new file mode 100644 index 0000000..c7c7cdf --- /dev/null +++ b/docs/src/assets/logo.svg @@ -0,0 +1,323 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..60f962e --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,63 @@ +# SPGBox.jl + +[SPGBox.jl](https://github.com/m3g/SPGBox.jl) is a pure-Julia implementation of the Spectral Projected Gradient Method +for minimization in box constraints, as described in: + +E. G. Birgin, J. M. Martínez and M. Raydan, "Nonmonotone spectral +projected gradient methods on convex sets", SIAM Journal on Optimization +10, pp. 1196-1211, 2000. +[(LINK)](http://www.ime.usp.br/~egbirgin/publications/bmr.pdf) + +## How to install + +```julia-repl +julia> using Pkg + +julia> Pkg.add("SPGBox") +``` + +or, more concisely, + +```julia-repl +julia> ] add SPGBox + +``` + +## Quick usage example + +Define the function to compute the objective function and the gradient, +for example with: + +```julia-repl +julia> f(x) = x[1]^2 + x[2]^2 + +julia> function g!(g,x) + g[1] = 2*x[1] + g[2] = 2*x[2] + end +``` + +And the objective function can be minimized with optional box bounds. +Here, with a lower bound of `2` for the first variable: + +```julia-repl +julia> x = 2 .+ rand(2) + +julia> spgbox!(f,g!,x,lower=[2.,-Inf]) + + SPGBOX RESULT: + + Convergence achieved. + + Final objective function value = 4.0 + Sample of best point = Vector{Float64}[ 2.0, 0.0] + Projected gradient norm = 0.0 + + Number of iterations = 3 + Number of function evaluations = 3 + +``` +The `spgbox!` function mutates the content of the input `x` vector (and will not allocate anything if the auxiliary vectors are provide +d as described [here](https://m3g.github.io/SPGBox.jl/stable/options/#Memory-preallocation)). Use `spgbox`, to internaly copy the `x` +array and not mutate it. +