From 30671b7ee84be378aab5ac83c80436d62f908a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Fri, 5 Apr 2024 14:28:58 +0200 Subject: [PATCH] Fix --- docs/src/optimization.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/src/optimization.md b/docs/src/optimization.md index 5fb7d6c..a3e9b88 100644 --- a/docs/src/optimization.md +++ b/docs/src/optimization.md @@ -122,13 +122,14 @@ we are either in the following three situations: - An extreme point is optimal. A JuMP model is treated by `polyhedron` just like any H-representation. For example, the hypercube of dimension `n` can be created as follows -```@example +```@example lphrep +using JuMP model = Model() @variable(model, 0 ≤ x[1:2] ≤ 1) h = hrep(model) ``` The name of the variables for each dimension can be recovered as follows -```@example +```@example lphrep dimension_names(h) ``` Note that the names of the JuMP variables are lost in the conversion to a @@ -138,12 +139,12 @@ poly = polyhedron(model, CDDLib.Library(:exact)) ``` However, the ordering of the dimension of the polyhedron is guaranteed to correspond to the order of the JuMP variables as listed by `all_variables`: -```@example +```@example lphrep all_variables(model) ``` So `all_variables(model)[i]` provides the JuMP variable corresponding to the `i`th dimension. The reverse mapping can be constructed as follows: -```@example +```@example lphrep Dict(v => i for (i, v) in enumerate(all_variables(model))) ```