diff --git a/.gitignore b/.gitignore index 7495507e..2a4e8e51 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ test.jl *.mps *.aux +/docs/src/tutorials/conic_lower.md +/docs/src/tutorials/lower_duals.md diff --git a/docs/src/tutorials/conic_lower.md b/docs/src/tutorials/conic_lower.md index 0b128b6c..b68bdd38 100644 --- a/docs/src/tutorials/conic_lower.md +++ b/docs/src/tutorials/conic_lower.md @@ -5,7 +5,8 @@ EditURL = "/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} @@ -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. diff --git a/docs/src/tutorials/lower_duals.md b/docs/src/tutorials/lower_duals.md index 147dce82..4c544e71 100644 --- a/docs/src/tutorials/lower_duals.md +++ b/docs/src/tutorials/lower_duals.md @@ -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 \\