Skip to content

Commit

Permalink
build based on 651ba53
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Dec 8, 2024
1 parent f79d4b3 commit 88300bb
Show file tree
Hide file tree
Showing 5 changed files with 270 additions and 270 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.11.2","generation_timestamp":"2024-12-08T17:57:03","documenter_version":"1.8.0"}}
{"documenter":{"julia_version":"1.11.2","generation_timestamp":"2024-12-08T17:57:21","documenter_version":"1.8.0"}}
14 changes: 7 additions & 7 deletions dev/backend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
return g
end</code></pre><p>Finally, we use the homemade backend to compute the gradient.</p><pre><code class="language-julia hljs">nlp = ADNLPModel(sum, ones(3), gradient_backend = NewADGradient)
grad(nlp, nlp.meta.x0) # returns the gradient at x0 using `NewADGradient`</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">3-element Vector{Float64}:
0.7041242123804107
0.3905141017013257
0.8038163239814652</code></pre><h3 id="Change-backend"><a class="docs-heading-anchor" href="#Change-backend">Change backend</a><a id="Change-backend-1"></a><a class="docs-heading-anchor-permalink" href="#Change-backend" title="Permalink"></a></h3><p>Once an instance of an <code>ADNLPModel</code> has been created, it is possible to change the backends without re-instantiating the model.</p><pre><code class="language-julia hljs">using ADNLPModels, NLPModels
0.16054083158368404
0.8878003651136307
0.2915391623314141</code></pre><h3 id="Change-backend"><a class="docs-heading-anchor" href="#Change-backend">Change backend</a><a id="Change-backend-1"></a><a class="docs-heading-anchor-permalink" href="#Change-backend" title="Permalink"></a></h3><p>Once an instance of an <code>ADNLPModel</code> has been created, it is possible to change the backends without re-instantiating the model.</p><pre><code class="language-julia hljs">using ADNLPModels, NLPModels
f(x) = 100 * (x[2] - x[1]^2)^2 + (x[1] - 1)^2
x0 = 3 * ones(2)
nlp = ADNLPModel(f, x0)
Expand Down Expand Up @@ -128,10 +128,10 @@
jhess: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0 jhprod: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
</code></pre><p>Then, the gradient will return a vector of <code>Float64</code>.</p><pre><code class="language-julia hljs">x64 = rand(2)
grad(nlp, x64)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">2-element Vector{Float64}:
-89.79056191056053
119.5039143634971</code></pre><p>It is now possible to move to a different type, for instance <code>Float32</code>, while keeping the instance <code>nlp</code>.</p><pre><code class="language-julia hljs">x0_32 = ones(Float32, 2)
27.45224910489447
-21.355889390418305</code></pre><p>It is now possible to move to a different type, for instance <code>Float32</code>, while keeping the instance <code>nlp</code>.</p><pre><code class="language-julia hljs">x0_32 = ones(Float32, 2)
set_adbackend!(nlp, gradient_backend = ADNLPModels.ForwardDiffADGradient, x0 = x0_32)
x32 = rand(Float32, 2)
grad(nlp, x32)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">2-element Vector{Float64}:
86.13673400878906
-55.055213928222656</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../tutorial/">« Tutorial</a><a class="docs-footer-nextpage" href="../predefined/">Default backends »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.8.0 on <span class="colophon-date" title="Sunday 8 December 2024 17:57">Sunday 8 December 2024</span>. Using Julia version 1.11.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
-7.670350551605225
149.06369018554688</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../tutorial/">« Tutorial</a><a class="docs-footer-nextpage" href="../predefined/">Default backends »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.8.0 on <span class="colophon-date" title="Sunday 8 December 2024 17:57">Sunday 8 December 2024</span>. Using Julia version 1.11.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
464 changes: 232 additions & 232 deletions dev/performance/21866ae9.svg → dev/performance/e13db8f9.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 28 additions & 28 deletions dev/performance/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -267,33 +267,33 @@
stats[back][stats[back].name .== name, :time] = [median(b.times)]
stats[back][stats[back].name .== name, :allocs] = [median(b.allocs)]
end
end</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi"><span class="sgr36"><span class="sgr1">[ Info: </span></span> camshape with 1000 vars and 2003 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> catenary with 999 vars and 332 cons
<span class="sgr33"><span class="sgr1">┌ Warning: </span></span>catenary: number of variables adjusted to be a multiple of 3
<span class="sgr33"><span class="sgr1"></span></span><span class="sgr90">@ OptimizationProblems.PureJuMP ~/.julia/packages/OptimizationProblems/9qr9C/src/PureJuMP/catenary.jl:20</span>
<span class="sgr33"><span class="sgr1">┌ Warning: </span></span>catenary: number of variables adjusted to be greater or equal to 6
<span class="sgr33"><span class="sgr1"></span></span><span class="sgr90">@ OptimizationProblems.PureJuMP ~/.julia/packages/OptimizationProblems/9qr9C/src/PureJuMP/catenary.jl:22</span>
<span class="sgr33"><span class="sgr1">┌ Warning: </span></span>catenary: number of variables adjusted to be a multiple of 3
<span class="sgr33"><span class="sgr1"></span></span><span class="sgr90">@ OptimizationProblems.ADNLPProblems ~/.julia/packages/OptimizationProblems/9qr9C/src/ADNLPProblems/catenary.jl:4</span>
<span class="sgr33"><span class="sgr1">┌ Warning: </span></span>catenary: number of variables adjusted to be greater or equal to 6
<span class="sgr33"><span class="sgr1"></span></span><span class="sgr90">@ OptimizationProblems.ADNLPProblems ~/.julia/packages/OptimizationProblems/9qr9C/src/ADNLPProblems/catenary.jl:6</span>
<span class="sgr33"><span class="sgr1">┌ Warning: </span></span>catenary: number of variables adjusted to be a multiple of 3
<span class="sgr33"><span class="sgr1"></span></span><span class="sgr90">@ OptimizationProblems.ADNLPProblems ~/.julia/packages/OptimizationProblems/9qr9C/src/ADNLPProblems/catenary.jl:4</span>
<span class="sgr33"><span class="sgr1">┌ Warning: </span></span>catenary: number of variables adjusted to be greater or equal to 6
<span class="sgr33"><span class="sgr1"></span></span><span class="sgr90">@ OptimizationProblems.ADNLPProblems ~/.julia/packages/OptimizationProblems/9qr9C/src/ADNLPProblems/catenary.jl:6</span>
<span class="sgr36"><span class="sgr1">[ Info: </span></span> chain with 1000 vars and 752 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> channel with 1000 vars and 1000 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> clnlbeam with 999 vars and 664 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> controlinvestment with 1000 vars and 500 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> elec with 999 vars and 333 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> hovercraft1d with 998 vars and 668 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> marine with 1007 vars and 488 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> polygon with 1000 vars and 125251 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> polygon1 with 1000 vars and 500 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> polygon2 with 1000 vars and 1 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> polygon3 with 1000 vars and 1000 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> robotarm with 1009 vars and 1002 cons
<span class="sgr36"><span class="sgr1">[ Info: </span></span> structural with 3540 vars and 3652 cons</code></pre><pre><code class="language-julia hljs">using Plots, SolverBenchmark
end</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">[ Info: camshape with 1000 vars and 2003 cons
[ Info: catenary with 999 vars and 332 cons
┌ Warning: catenary: number of variables adjusted to be a multiple of 3
@ OptimizationProblems.PureJuMP ~/.julia/packages/OptimizationProblems/9qr9C/src/PureJuMP/catenary.jl:20
┌ Warning: catenary: number of variables adjusted to be greater or equal to 6
@ OptimizationProblems.PureJuMP ~/.julia/packages/OptimizationProblems/9qr9C/src/PureJuMP/catenary.jl:22
┌ Warning: catenary: number of variables adjusted to be a multiple of 3
@ OptimizationProblems.ADNLPProblems ~/.julia/packages/OptimizationProblems/9qr9C/src/ADNLPProblems/catenary.jl:4
┌ Warning: catenary: number of variables adjusted to be greater or equal to 6
@ OptimizationProblems.ADNLPProblems ~/.julia/packages/OptimizationProblems/9qr9C/src/ADNLPProblems/catenary.jl:6
┌ Warning: catenary: number of variables adjusted to be a multiple of 3
@ OptimizationProblems.ADNLPProblems ~/.julia/packages/OptimizationProblems/9qr9C/src/ADNLPProblems/catenary.jl:4
┌ Warning: catenary: number of variables adjusted to be greater or equal to 6
@ OptimizationProblems.ADNLPProblems ~/.julia/packages/OptimizationProblems/9qr9C/src/ADNLPProblems/catenary.jl:6
[ Info: chain with 1000 vars and 752 cons
[ Info: channel with 1000 vars and 1000 cons
[ Info: clnlbeam with 999 vars and 664 cons
[ Info: controlinvestment with 1000 vars and 500 cons
[ Info: elec with 999 vars and 333 cons
[ Info: hovercraft1d with 998 vars and 668 cons
[ Info: marine with 1007 vars and 488 cons
[ Info: polygon with 1000 vars and 125251 cons
[ Info: polygon1 with 1000 vars and 500 cons
[ Info: polygon2 with 1000 vars and 1 cons
[ Info: polygon3 with 1000 vars and 1000 cons
[ Info: robotarm with 1009 vars and 1002 cons
[ Info: structural with 3540 vars and 3652 cons</code></pre><pre><code class="language-julia hljs">using Plots, SolverBenchmark
costnames = [&quot;median time (in ns)&quot;, &quot;median allocs&quot;]
costs = [
df -&gt; df.time,
Expand All @@ -302,4 +302,4 @@

gr()

profile_solvers(stats, costs, costnames)</code></pre><img src="21866ae9.svg" alt="Example block output"/></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../sparse/">« Sparse Jacobian and Hessian</a><a class="docs-footer-nextpage" href="../sparsity_pattern/">Providing sparsity pattern for sparse derivatives »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.8.0 on <span class="colophon-date" title="Sunday 8 December 2024 17:57">Sunday 8 December 2024</span>. Using Julia version 1.11.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
profile_solvers(stats, costs, costnames)</code></pre><img src="e13db8f9.svg" alt="Example block output"/></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../sparse/">« Sparse Jacobian and Hessian</a><a class="docs-footer-nextpage" href="../sparsity_pattern/">Providing sparsity pattern for sparse derivatives »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.8.0 on <span class="colophon-date" title="Sunday 8 December 2024 17:57">Sunday 8 December 2024</span>. Using Julia version 1.11.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
4 changes: 2 additions & 2 deletions dev/sparsity_pattern/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

@elapsed begin
nlp = ADNLPModel!(f, xi, lvar, uvar, [1], [1], T[1], c!, lcon, ucon; hessian_backend = ADNLPModels.EmptyADbackend)
end</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">2.704700081</code></pre><p><code>ADNLPModel</code> will automatically prepare an AD backend for computing sparse Jacobian and Hessian. We disabled the Hessian computation here to focus the measurement on the Jacobian computation. The keyword argument <code>show_time = true</code> can also be passed to the problem&#39;s constructor to get more detailed information about the time used to prepare the AD backend.</p><pre><code class="language-julia hljs">using NLPModels
end</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">2.83496248</code></pre><p><code>ADNLPModel</code> will automatically prepare an AD backend for computing sparse Jacobian and Hessian. We disabled the Hessian computation here to focus the measurement on the Jacobian computation. The keyword argument <code>show_time = true</code> can also be passed to the problem&#39;s constructor to get more detailed information about the time used to prepare the AD backend.</p><pre><code class="language-julia hljs">using NLPModels
x = sqrt(2) * ones(n)
jac_nln(nlp, x)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">49999×100000 SparseArrays.SparseMatrixCSC{Float64, Int64} with 199996 stored entries:
⎡⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠳⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎤
Expand Down Expand Up @@ -78,7 +78,7 @@

jac_back = ADNLPModels.SparseADJacobian(n, f, N - 1, c!, J)
nlp = ADNLPModel!(f, xi, lvar, uvar, [1], [1], T[1], c!, lcon, ucon; hessian_backend = ADNLPModels.EmptyADbackend, jacobian_backend = jac_back)
end</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">1.631820461</code></pre><p>We recover the same Jacobian.</p><pre><code class="language-julia hljs">using NLPModels
end</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">1.766248059</code></pre><p>We recover the same Jacobian.</p><pre><code class="language-julia hljs">using NLPModels
x = sqrt(2) * ones(n)
jac_nln(nlp, x)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">49999×100000 SparseArrays.SparseMatrixCSC{Float64, Int64} with 199996 stored entries:
⎡⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠳⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎤
Expand Down

0 comments on commit 88300bb

Please sign in to comment.