Skip to content

Commit

Permalink
add ignores
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquimg committed May 12, 2023
1 parent ca7416d commit 4c6300e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ test.jl

*.mps
*.aux
/docs/src/tutorials/conic_lower.md
/docs/src/tutorials/lower_duals.md
18 changes: 11 additions & 7 deletions docs/src/tutorials/conic_lower.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ EditURL = "<unknown>/src/tutorials/conic_lower.jl"
# Conic Bilevel and Mixed Mode

Here we present a simple bilevel program with a conic lower level model
described in example 3.3 from \cite{chi2014models}.
described in example 3.3 from
[Chi, et al. 2014](https://journalofinequalitiesandapplications.springeropen.com/articles/10.1186/1029-242X-2014-168).

```math
\begin{align}
Expand Down Expand Up @@ -75,25 +76,28 @@ Mixing the two of them can be done with Mixed Mode.

The following code describes how to solve the problem with a MISOCP based solver.

```julia
using Xpress
using QuadraticToBinary
set_optimizer(model,
()->QuadraticToBinary.Optimizer{Float64}(Xpress.Optimizer(),lb=-10,ub=10))
BilevelJuMP.set_mode(model,
BilevelJuMP.MixedMode(default = BilevelJuMP.FortunyAmatMcCarlMode(primal_big_M = 100, dual_big_M = 100)))
BilevelJuMP.MixedMode(default = BilevelJuMP.IndicatorMode()))
BilevelJuMP.set_mode(con4, BilevelJuMP.ProductMode(1e-5))
optimize!(model)
```

!!! info
This code was not executed because Xpress requires a commercial license.
Other solvers supporting MISOCP could be used such as Gurobi and CPLEX.

We set the reformulation method as Mixed Mode and selected Indicator
constraints to be the default for the case in which we do not explicitly
specify the reformulation.
Then we set product mode for the second order cone reformulation.

```@example conic_lower
#As described in Appendix \ref{ap-dual}, binary expansions require bounded
```

variables, hence the \texttt{QuadraticToBinary} meta-solver accepts fallback
Binary expansions require bounded
variables, hence the `QuadraticToBinary` meta-solver accepts fallback
to upper and lower bounds (\texttt{ub} and \texttt{lb}),
used for variables with no explicit bounds.

Expand Down
9 changes: 5 additions & 4 deletions docs/src/tutorials/lower_duals.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ This modeling feature enables the implementation of workflows where one
constraint. In particular, in the energy sector, it is common to model the
energy prices as the dual variable associated with the energy demand
equilibrium constraint. One example of an application that uses this feature
is Fanzeres et al. (2019), which focuses on strategic bidding in
is [Fanzeres et al. (2019)](https://doi.org/10.1016/j.ejor.2018.07.027),
which focuses on strategic bidding in
auction-based energy markets. A small and simplified example of the modeled
problem would be the model:

```math
\begin{align}
&\max_{\lambda, q_S} \quad \lambda \cdot g_S \\
&\st \quad 0 \leq q_S \leq 100\\
&\hspace{28pt} (g_S, \lambda) \in \argmin_{g_S, g_{1}, g_{2}, g_D} 50 g_{R1} + 100 g_{R2} + 1000 g_{D}\\
& \hspace{70pt} \st \quad g_S \leq q_S \\
&\textit{s.t.} \quad 0 \leq q_S \leq 100\\
&\hspace{28pt} (g_S, \lambda) \in \arg\min_{g_S, g_{1}, g_{2}, g_D} 50 g_{R1} + 100 g_{R2} + 1000 g_{D}\\
& \hspace{70pt} \textit{s.t.} \quad g_S \leq q_S \\
& \hspace{88pt} \quad 0 \leq g_S \leq 100 \\
& \hspace{88pt}\quad 0 \leq g_{1} \leq 40 \\
& \hspace{88pt}\quad 0 \leq g_{2} \leq 40 \\
Expand Down

0 comments on commit 4c6300e

Please sign in to comment.