-
Notifications
You must be signed in to change notification settings - Fork 0
Initial docs in preparation for registration. #4
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
Changes from 9 commits
f496ee2
0b5333c
c23fb9b
582806e
10d52b1
6871128
1ed01b6
b3cef88
cf40c9e
8cf5066
4aeac38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| name: Documentation | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master # update to match your development branch (master, main, dev, trunk, ...) | ||
| tags: '*' | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| build: | ||
| permissions: | ||
| actions: write | ||
| contents: write | ||
| pull-requests: read | ||
| statuses: write | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: julia-actions/setup-julia@v2 | ||
| with: | ||
| version: '1' | ||
| - uses: julia-actions/cache@v2 | ||
| - name: Install dependencies | ||
| shell: julia --color=yes --project=docs {0} | ||
| run: | | ||
| using Pkg | ||
| Pkg.develop(PackageSpec(path=pwd())) | ||
| Pkg.instantiate() | ||
| - name: Build and deploy | ||
| run: julia --color=yes --project=docs docs/make.jl | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # This workflow was based on CliMA/ClimaTimeSteppers.jl (Apache License 2.0). | ||
| name: Doc Preview Cleanup | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [closed] | ||
|
|
||
| # Ensure that only one "Doc Preview Cleanup" workflow is force pushing at a time | ||
| concurrency: | ||
| group: doc-preview-cleanup | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| doc-preview-cleanup: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout gh-pages branch | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: gh-pages | ||
| - name: Delete preview and history + push changes | ||
| run: | | ||
| if [ -d "${preview_dir}" ]; then | ||
| git config user.name "Documenter.jl" | ||
| git config user.email "documenter@juliadocs.github.io" | ||
| git rm -rf "${preview_dir}" | ||
| git commit -m "delete preview" | ||
| git branch gh-pages-new "$(echo "delete history" | git commit-tree "HEAD^{tree}")" | ||
| git push --force origin gh-pages-new:gh-pages | ||
| fi | ||
| env: | ||
| preview_dir: previews/PR${{ github.event.number }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,64 +5,66 @@ problem in the following format: | |
| ```math | ||
| \begin{aligned} | ||
| \min \quad & f(x) \\ | ||
| & c_L \leq c(x) \leq c_U \\ | ||
| & \ell_c \le c(x) \le u_c,\\ | ||
| & \ell_G\le G(x) \perp H(x)\ge l_H, \\ | ||
| & \ell \leq x \leq u. | ||
| \end{aligned} | ||
| ``` | ||
| To develop an optimization algorithm, we are usually worried not only with | ||
| ``f(x)`` and ``c(x)``, but also with their derivatives. | ||
| Namely, | ||
|
|
||
| - ``\nabla f(x)``, the gradient of ``f`` at the point ``x``; | ||
| - ``\nabla^2 f(x)``, the Hessian of ``f`` at the point ``x``; | ||
| - ``J(x) = \nabla c(x)^T``, the Jacobian of ``c`` at the point ``x``; | ||
| - ``\nabla^2 f(x) + \sum_{i=1}^m y_i \nabla^2 c_i(x)``, | ||
| the Hessian of the Lagrangian function at the point ``(x,y)``. | ||
|
|
||
| There are many ways to access some of these values, so here is a little | ||
| reference guide. | ||
|
|
||
| ## Reference guide | ||
|
|
||
| The following naming should be easy enough to follow. | ||
| If not, click on the link and go to the description. | ||
|
|
||
| - `!` means inplace; | ||
| - `_coord` means coordinate format; | ||
| - `_dense` means dense format; | ||
| - `prod` means matrix-vector product; | ||
| - `_op` means operator (as in [LinearOperators.jl](https://github.com/JuliaSmoothOptimizers/LinearOperators.jl)); | ||
| - `_lin` and `_nln` respectively refer to linear and nonlinear constraints. | ||
|
|
||
| Feel free to open an issue to suggest other methods that should apply to all | ||
| NLPModels instances. | ||
| We implement this by wrapping an `AbstractNLPModel` in the form: | ||
| ```math | ||
| \begin{aligned} | ||
| \min \quad & f(x) \\ | ||
| & c_L \leq c'(x) \leq c_U \\ | ||
|
apozharski marked this conversation as resolved.
Outdated
|
||
| & \ell \leq x \leq u, | ||
| \end{aligned} | ||
| ``` | ||
| along with three vectors `ind_cc1`, `ind_cc2`, and `cc_types`. | ||
| We encode the functions ``G(x)`` and ``H(x)`` via these vectors in the following way. | ||
| The vectors `ind_cc1` and `ind_cc2` correspond to indexes into the vectors ``x`` and ``c'(x)``. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I would detail what do
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm, I am not sure what you mean. I think I like the table, but I am open to changing it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep the table then! |
||
| Which of these vectors are the target of the indexing is determined by the values in `cc_types`: | ||
|
|
||
| | Function | NLPModels function | | ||
| |-------------------|-------------------------------------------| | ||
| | ``f(x)`` | [`obj`](@ref), [`objgrad`](@ref), [`objgrad!`](@ref), [`objcons`](@ref), [`objcons!`](@ref) | | ||
| | ``\nabla f(x)`` | [`grad`](@ref), [`grad!`](@ref), [`objgrad`](@ref), [`objgrad!`](@ref) | | ||
| | ``\nabla^2 f(x)`` | [`hess`](@ref), [`hess_op`](@ref), [`hess_op!`](@ref), [`hess_coord`](@ref), [`hess_coord!`](@ref), [`hess_dense!`](@ref), [`hess_structure`](@ref), [`hess_structure!`](@ref), [`hprod`](@ref), [`hprod!`](@ref) | | ||
| | ``c(x)`` | [`cons_lin`](@ref), [`cons_lin!`](@ref), [`cons_nln`](@ref), [`cons_nln!`](@ref), [`cons`](@ref), [`cons!`](@ref), [`objcons`](@ref), [`objcons!`](@ref) | | ||
| | ``J(x)`` | [`jac_lin`](@ref), [`jac_nln`](@ref), [`jac`](@ref), [`jac_lin_op`](@ref), [`jac_lin_op!`](@ref), [`jac_nln_op`](@ref), [`jac_nln_op!`](@ref),[`jac_op`](@ref), [`jac_op!`](@ref), [`jac_lin_coord`](@ref), [`jac_lin_coord!`](@ref), [`jac_nln_coord`](@ref), [`jac_nln_coord!`](@ref), [`jac_coord`](@ref), [`jac_coord!`](@ref), [`jac_dense!`](@ref), [`jac_lin_structure`](@ref), [`jac_lin_structure!`](@ref), [`jac_nln_structure`](@ref), [`jac_nln_structure!`](@ref), [`jac_structure`](@ref), [`jprod_lin`](@ref), [`jprod_lin!`](@ref), [`jprod_nln`](@ref), [`jprod_nln!`](@ref), [`jprod`](@ref), [`jprod!`](@ref), [`jtprod_lin`](@ref), [`jtprod_lin!`](@ref), [`jtprod_nln`](@ref), [`jtprod_nln!`](@ref), [`jtprod`](@ref), [`jtprod!`](@ref) | | ||
| | ``\nabla^2 L(x,y)`` | [`hess`](@ref), [`hess_op`](@ref), [`hess_coord`](@ref), [`hess_coord!`](@ref), [`hess_dense!`](@ref), [`hess_structure`](@ref), [`hess_structure!`](@ref), [`hprod`](@ref), [`hprod!`](@ref), [`jth_hprod`](@ref), [`jth_hprod!`](@ref), [`jth_hess`](@ref), [`jth_hess_coord`](@ref), [`jth_hess_coord!`](@ref), [`ghjvprod`](@ref), [`ghjvprod!`](@ref) | | ||
| | `CCType[k]` | ``G_k(x)`` | ``H_k(x)`` | | ||
| |-------------|------------|------------| | ||
| | `VarVar` | ``x_i`` | ``x_j`` | | ||
| | `VarCon` | ``x_i`` | ``c'_j(x)`` | | ||
| | `ConVar` | ``c'_i(x)`` | ``x_j`` | | ||
| | `ConCon` | ``c'_i(x)`` | ``c'_j(x)`` | | ||
|
|
||
| If only a subset of the functions listed above is implemented, you can indicate which ones are not available when creating the [`NLPModelMeta`](@ref), using the keyword arguments | ||
| `grad_available`, `jac_available`, `hess_available`, `jprod_available`, `jtprod_available`, and `hprod_available`. | ||
| You can also specify whether the Jacobian of the constraints and the Hessian of the objective or Lagrangian are sparse using the keyword arguments `sparse_jacobian` and `sparse_hessian`. | ||
| This allows the user maximum flexibility when it comes to modelling the original MPCC. | ||
| For practical algorithms however, we reformulate the problem into the so called "vertical form": | ||
| ```math | ||
| \begin{aligned} | ||
| \min \quad & f(x) \\ | ||
| & \ell_c \le c(x) \le u_c,\\ | ||
| & \ell_G\le x_1 \perp x_2\ge l_H, \\ | ||
| & \ell \leq x \leq u, | ||
| \end{aligned} | ||
| ``` | ||
|
|
||
| ## [API for NLSModels](@id nls-api) | ||
| where all of the complementarity pairs are lifted to individual variables. | ||
| This is done via the `vertical_form` function. | ||
|
|
||
| For the Nonlinear Least Squares models, ``f(x) = \tfrac{1}{2} \Vert F(x)\Vert^2``, | ||
| and these models have additional function to access the residual value | ||
| and its derivatives. Namely, | ||
| In order to develop algorithms for solving MPCCs we define the following api for the `AbstractMPCCModel` type: | ||
|
apozharski marked this conversation as resolved.
Outdated
|
||
|
|
||
| - ``J_F(x) = \nabla F(x)^T`` | ||
| - ``\nabla^2 F_i(x)`` | ||
| | Function | `MPCCModels.jl` function | Notes | | ||
| |-------------------------------------------------------|-------------------------------------------------------|-----------------------------------------------| | ||
| | ``G(x)`` | `comp_left` | Raw evaluation of ``G(x)`` | | ||
| | ``G(x)-\ell_G`` | `comp_res_left` | Left hand side complementarity residual | | ||
| | ``\nabla_x G(x)`` | `jac_comp_left_structure` and `jac_comp_left_coord` | Jacobian of left hand side of complementarity | | ||
| | ``H(x)`` | `comp_right` | | | ||
| | ``H(x)-\ell_H`` | `comp_res_right` | Right hand side complementarity residual | | ||
| | ``\nabla_x G(x)`` | `jac_comp_right_structure` and `jac_comp_right_coord` | Jacobian of left hand side of complementarity | | ||
| | ``\vert\min(G(x)-\ell_G,H(x)-\ell_H)\vert_\infty`` | `comp_residual` | | | ||
| | ``\vert (G(x)-\ell_G)\odot(H(x)-\ell_H)\vert_\infty`` | `comp_residual_product` | | | ||
| | ``(G(x)-\ell_G)\dot(H(x)-\ell_H)`` | `comp_residual_sum` | | | ||
|
|
||
| | Function | function | | ||
| |---------------------|---| | ||
| | ``F(x)`` | [`residual`](@ref), [`residual!`](@ref) | | ||
| | ``J_F(x)`` | [`jac_residual`](@ref), [`jac_coord_residual`](@ref), [`jac_coord_residual!`](@ref), [`jac_structure_residual`](@ref), [`jac_structure_residual!`](@ref), [`jprod_residual`](@ref), [`jprod_residual!`](@ref), [`jtprod_residual`](@ref), [`jtprod_residual!`](@ref), [`jac_op_residual`](@ref), [`jac_op_residual!`](@ref) | | ||
| | ``\nabla^2 F_i(x)`` | [`hess_residual`](@ref), [`hess_coord_residual`](@ref), [`hess_coord_residual!`](@ref), [`hess_structure_residual`](@ref), [`hess_structure_residual!`](@ref), [`jth_hess_residual`](@ref), [`jth_hess_residual_coord`](@ref), [`jth_hess_residual_coord!`](@ref), [`hprod_residual`](@ref), [`hprod_residual!`](@ref), [`hess_op_residual`](@ref), [`hess_op_residual!`](@ref) | | ||
| along with overloads for the following `NLPModels.jl` api. | ||
|
|
||
| If only a subset of the functions listed above is implemented, you can indicate which ones are not available when creating the [`NLSMeta`](@ref), using the keyword arguments `jac_residual_available`, `hess_residual_available`, `jprod_residual_available`, `jtprod_residual_available`, and `hprod_residual_available`. | ||
| | Function | `NLPModels.jl` function | notes | | ||
| |---------------------------|--------------------------------------------|------------------------------------------------------------------------------------------------------------------| | ||
| | ``f(x)`` | `obj` | | | ||
| | ``\nabla f(x)`` | `grad` | | | ||
| | ``c(x)`` | `cons` | Note that this includes possible lifted constraints but _not_ those contained in ``G(x)`` or ``H(x)`` | | ||
| | ``\nabla c(x)`` | `jac`, `jac_structure`, and `jac_coord` | Note that this includes possible lifted constraints but _not_ those contained in ``G(x)`` or ``H(x)`` | | ||
| | ``\nabla^2 L(x,\lambda)`` | `hess`, `hess_structure`, and `hess_coord` | Note that this is not the MPCC lagrangian but the NLP Lagrangian with no contribution from the complementarities | | ||
Uh oh!
There was an error while loading. Please reload this page.