# Optimization (Mathematical)

**URL:** https://discourse.julialang.org/c/domain/opt/13.md?page=93

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 94

---

## [Elimination of Errors in JuMP model](https://discourse.julialang.org/t/elimination-of-errors-in-jump-model/45266)

<div class="topic-metadata">

**Author:** [@mamo](https://discourse.julialang.org/u/mamo)\
**Replies:** 4\
**Last updated:** [August 20, 2020, 7:06pm UTC](https://discourse.julialang.org/t/elimination-of-errors-in-jump-model/45266 "2020-08-20T19:06:45Z")

</div>

Give me suggestions for eliminating these errors please: LoadError: MethodError: no method matching getindex(::Tuple{Pair{String,Tuple{String,String}},Pair{String,NTuple{11,String}},Pair{String,Tuple{String,String,Strin…

---

## [JuMP 0.21.1: CPLEX Error 1811: Attempt to invoke unsupported operation](https://discourse.julialang.org/t/jump-0-21-1-cplex-error-1811-attempt-to-invoke-unsupported-operation/36605)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 8\
**Last updated:** [August 19, 2020, 9:31am UTC](https://discourse.julialang.org/t/jump-0-21-1-cplex-error-1811-attempt-to-invoke-unsupported-operation/36605 "2020-08-19T09:31:19Z")

</div>

Dear folks, I try to add LazyConstaintCuts in a MIP model using MOI v0.9.12, CPLEX 12.9 (and it seems generic callbacks are used by default). After several cuts are added the solving procedure stops with the message in …

---

## [Variable statement](https://discourse.julialang.org/t/variable-statement/45174)

<div class="topic-metadata">

**Author:** [@mamo](https://discourse.julialang.org/u/mamo)\
**Replies:** 1\
**Last updated:** [August 18, 2020, 8:18pm UTC](https://discourse.julialang.org/t/variable-statement/45174 "2020-08-18T20:18:58Z")

</div>

‘’‘@variable(model,PRDint\[o in O, f in F, p in P\[f\],j in U, t in TIME\], lower\_bound=0, upper\_bound=1000, Int)’‘’ ‘’‘@variable(model,PRD\[o in O,f in F, p in P\[f\], j in U, t in TIME, o\<=23 && f\<=13 && p\<=45\]==PRDint\[o,f,p…

---

## [Quadratic and non-linear expressions cannot be mixed up!](https://discourse.julialang.org/t/quadratic-and-non-linear-expressions-cannot-be-mixed-up/45120)

<div class="topic-metadata">

**Author:** [@musman](https://discourse.julialang.org/u/musman)\
**Replies:** 4\
**Last updated:** [August 18, 2020, 8:02am UTC](https://discourse.julialang.org/t/quadratic-and-non-linear-expressions-cannot-be-mixed-up/45120 "2020-08-18T08:02:12Z")

</div>

Hi, I am setting up a non-linear objective which contains both quadratic and non-linear terms. However, I am getting the following error Unexpected quadratic expression 378.5346047250809 e\[1\]² + 378.5346047250809 f\[1\]² …

---

## [Broadcast operations with multiple DenseAxisArrays are not yet supported](https://discourse.julialang.org/t/broadcast-operations-with-multiple-denseaxisarrays-are-not-yet-supported/45133)

<div class="topic-metadata">

**Author:** [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Replies:** 2\
**Last updated:** [August 18, 2020, 2:43am UTC](https://discourse.julialang.org/t/broadcast-operations-with-multiple-denseaxisarrays-are-not-yet-supported/45133 "2020-08-18T02:43:13Z")

</div>

using JuMP,Gurobi n=4 a=\[0;0;50;50\] b=\[0;0;351;389\] c=\[0;0;44.4;40.6\] model=Model(Gurobi.Optimizer) @variable(model, P\[1:n,1\])#julia中创建一个全参数决策变量的方式 f=@expression(model,a'\*(P.\*P)+b'\*P+sum(c)) @objective(model,min,f) …

---

## [Adding second order cone is slow](https://discourse.julialang.org/t/adding-second-order-cone-is-slow/45124)

<div class="topic-metadata">

**Author:** [@sobhan](https://discourse.julialang.org/u/sobhan)\
**Replies:** 13\
**Last updated:** [August 18, 2020, 1:55am UTC](https://discourse.julialang.org/t/adding-second-order-cone-is-slow/45124 "2020-08-18T01:55:43Z")

</div>

Hi, I have a conic model that i want to solve. The model looks like this using MathOptInterface const MOI = MathOptInterface using Gurobi using JuMP n=200 model = Model(Gurobi.Optimizer) @variable(model, t\[i=1:n, j=1:n…

---

## [Stochastic MPC using JuMP - Explained in detail for future example in JuMP](https://discourse.julialang.org/t/stochastic-mpc-using-jump-explained-in-detail-for-future-example-in-jump/45100)

<div class="topic-metadata">

**Author:** [@pandeysudan27](https://discourse.julialang.org/u/pandeysudan27)\
**Replies:** 2\
**Last updated:** [August 18, 2020, 12:23am UTC](https://discourse.julialang.org/t/stochastic-mpc-using-jump-explained-in-detail-for-future-example-in-jump/45100 "2020-08-18T00:23:10Z")

</div>

I need help regarding formulating multi-state stochastic MPC in JuMP. In some way my optimization routine is wrong. Any help is much appreciated! swing MPC The swing equation is given as, M\\frac{d^2\\delta}{dt^2}=P\_\\mat…

---

## [Error in constraint statement](https://discourse.julialang.org/t/error-in-constraint-statement/45088)

<div class="topic-metadata">

**Author:** [@mamo](https://discourse.julialang.org/u/mamo)\
**Replies:** 2\
**Last updated:** [August 17, 2020, 10:20am UTC](https://discourse.julialang.org/t/error-in-constraint-statement/45088 "2020-08-17T10:20:24Z")

</div>

I can not identify the reason for “LoadError: syntax: missing comma or ) in argument list in expression starting at” in the first line of this constraint: @constraint(problem1, raball\[r in RAW, k in 1:interval:length(T…

---

## [Objective function declaration issue](https://discourse.julialang.org/t/objective-function-declaration-issue/45028)

<div class="topic-metadata">

**Author:** [@mamo](https://discourse.julialang.org/u/mamo)\
**Replies:** 4\
**Last updated:** [August 17, 2020, 7:43am UTC](https://discourse.julialang.org/t/objective-function-declaration-issue/45028 "2020-08-17T07:43:46Z")

</div>

If I have a member of an objective function: sum((setup\_cost\[f,p,j\]\*PR\[f,p,j,t\]+oper\_cost\[p,j\]\*PRD\[o,f,p,j,t\]) for o in O,f in FAM, p in PROD\[f\], j in U, t in TIME) and I want to limit the counter o, f and p on 1…end-…

---

## [Accessing constraints from JuMP model created in function](https://discourse.julialang.org/t/accessing-constraints-from-jump-model-created-in-function/45044)

<div class="topic-metadata">

**Author:** [@fnbillimoria](https://discourse.julialang.org/u/fnbillimoria)\
**Replies:** 4\
**Last updated:** [August 17, 2020, 6:07am UTC](https://discourse.julialang.org/t/accessing-constraints-from-jump-model-created-in-function/45044 "2020-08-17T06:07:16Z")

</div>

Hello, I have specified a function which creates a JuMP model as below. I can call the function to create the model, and subsequently can optimize! it. I wish to access the shadow prices/duals of the constraint create…

---

## [Correct constraint statement](https://discourse.julialang.org/t/correct-constraint-statement/45036)

<div class="topic-metadata">

**Author:** [@mamo](https://discourse.julialang.org/u/mamo)\
**Replies:** 2\
**Last updated:** [August 16, 2020, 11:22am UTC](https://discourse.julialang.org/t/correct-constraint-statement/45036 "2020-08-16T11:22:59Z")

</div>

In this constraint k goes from 1 to end but with step equal to in “interval” (scalar equal to 20 for example): ‘’‘rawmbal1\[r in RAW, k in 1…end by interval: k==1\], INV\[r,k\]=invraw\[r,k\]-sum(PRD\[o,f,p,j,t\]\*demraw\[p,r\] fo…

---

## [Constraints with for loop and if statements](https://discourse.julialang.org/t/constraints-with-for-loop-and-if-statements/45009)

<div class="topic-metadata">

**Author:** [@Micah\_Mungal](https://discourse.julialang.org/u/Micah_Mungal)\
**Replies:** 1\
**Last updated:** [August 15, 2020, 9:00pm UTC](https://discourse.julialang.org/t/constraints-with-for-loop-and-if-statements/45009 "2020-08-15T21:00:27Z")

</div>

Hi, I am new to Julia and by extension JuMP. I am trying to rewrite a model for an optimization problem from Matlab to Julia using JuMP. Now following the documentation on the JuMP webpage, I have some doubts about writi…

---

## [New package: BinaryTreeRectanglePacking.jl (N-dimensions)](https://discourse.julialang.org/t/new-package-binarytreerectanglepacking-jl-n-dimensions/44847)

<div class="topic-metadata">

**Author:** [@OliverEvans96](https://discourse.julialang.org/u/OliverEvans96)\
**Replies:** 2\
**Last updated:** [August 13, 2020, 3:52pm UTC](https://discourse.julialang.org/t/new-package-binarytreerectanglepacking-jl-n-dimensions/44847 "2020-08-13T15:52:48Z")

</div>

Hi all, I needed to pack lots of rectangles into a larger rectangle for my current project, and found that there wasn’t yet a suitable Julia algorithm, so I wrote one up and I thought I’d share it. I took the algorithm …

---

## [Resetting TimeLimit of Gurobi Optimizer](https://discourse.julialang.org/t/resetting-timelimit-of-gurobi-optimizer/26627)

<div class="topic-metadata">

**Author:** [@TheLoooser](https://discourse.julialang.org/u/TheLoooser)\
**Replies:** 4\
**Last updated:** [August 12, 2020, 11:23am UTC](https://discourse.julialang.org/t/resetting-timelimit-of-gurobi-optimizer/26627 "2020-08-12T11:23:06Z")

</div>

I am currently using JuMP with the Gurobi Solver to optimise a tournament schedule. I use a local search heuristic to try and solve each round in a given time limit after having found a first feasible solution. The probl…

---

## [JuMP constraints independent of a particular model](https://discourse.julialang.org/t/jump-constraints-independent-of-a-particular-model/38314)

<div class="topic-metadata">

**Author:** [@Tomas\_Uribe](https://discourse.julialang.org/u/Tomas_Uribe)\
**Replies:** 9\
**Last updated:** [August 12, 2020, 9:46am UTC](https://discourse.julialang.org/t/jump-constraints-independent-of-a-particular-model/38314 "2020-08-12T09:46:19Z")

</div>

Is there a way to represent a JuMP constraint independently of a specific model (even if it is purely syntactic)? The macros for creating variables and constraints require a model, of course… What would be a convenient m…

---

## [Experience with Baron](https://discourse.julialang.org/t/experience-with-baron/44707)

<div class="topic-metadata">

**Author:** [@mayar](https://discourse.julialang.org/u/mayar)\
**Replies:** 0\
**Last updated:** [August 10, 2020, 8:38pm UTC](https://discourse.julialang.org/t/experience-with-baron/44707 "2020-08-10T20:38:30Z")

</div>

“Baron from the optimization firm” Hello, Since this is a commercial solver that I am considering these days to buy,I would like to know more on the experience with Baron from the optimization firm, especially with jum…

---

## [JUMP - store solution](https://discourse.julialang.org/t/jump-store-solution/44663)

<div class="topic-metadata">

**Author:** [@Tmart](https://discourse.julialang.org/u/Tmart)\
**Replies:** 1\
**Last updated:** [August 10, 2020, 10:06am UTC](https://discourse.julialang.org/t/jump-store-solution/44663 "2020-08-10T10:06:23Z")

</div>

Hello, I was wondering if there was a way to store the solution of an optimization problem solved using JUMP. Thank you in advance, KR

---

## [Get variable's value in JuMP](https://discourse.julialang.org/t/get-variables-value-in-jump/44596)

<div class="topic-metadata">

**Author:** [@Rasoul](https://discourse.julialang.org/u/Rasoul)\
**Replies:** 2\
**Last updated:** [August 9, 2020, 5:41am UTC](https://discourse.julialang.org/t/get-variables-value-in-jump/44596 "2020-08-09T05:41:19Z")

</div>

Hi All, I have solved an optimization problem using Julia (1.3.1) and JuMP (0.21.3). I can print the model and see the constraints. I also can get the objective function’s value using (objective\_value(model)) . However,…

---

## [How to pass auxiliary variables and constraints as "Defined variables" of AMPL in JuMP?](https://discourse.julialang.org/t/how-to-pass-auxiliary-variables-and-constraints-as-defined-variables-of-ampl-in-jump/44547)

<div class="topic-metadata">

**Author:** [@SOtani](https://discourse.julialang.org/u/SOtani)\
**Replies:** 2\
**Last updated:** [August 8, 2020, 4:42pm UTC](https://discourse.julialang.org/t/how-to-pass-auxiliary-variables-and-constraints-as-defined-variables-of-ampl-in-jump/44547 "2020-08-08T16:42:19Z")

</div>

I am considering how to pass auxiliary variables as “Defined variables” of AMPL in JuMP. Sample code model = JuMP.Model(optimizer\_with\_attributes(Ipopt.Optimizer)) @variable(model, x) @variable(model, y) @variable(mode…

---

## [License error for JuMP](https://discourse.julialang.org/t/license-error-for-jump/44576)

<div class="topic-metadata">

**Author:** [@Rasoul](https://discourse.julialang.org/u/Rasoul)\
**Replies:** 1\
**Last updated:** [August 8, 2020, 4:34pm UTC](https://discourse.julialang.org/t/license-error-for-jump/44576 "2020-08-08T16:34:20Z")

</div>

Hi All, I have installed JuMP (“0.18.5”) and Gurobi (“0.6.0”). I have put a valid license for Gurobi in its corresponding folder. However, I get the following error when I want to solve my optimization problem. Can you …

---

## [JuMPeR installation problem with JuliaPro 1.0.5-2](https://discourse.julialang.org/t/jumper-installation-problem-with-juliapro-1-0-5-2/44508)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 1\
**Last updated:** [August 7, 2020, 6:25pm UTC](https://discourse.julialang.org/t/jumper-installation-problem-with-juliapro-1-0-5-2/44508 "2020-08-07T18:25:28Z")

</div>

This is the error message that appears to me when I try to install JuMPer julia\> Pkg.add("JuMPeR") Updating registry at \`C:\\Users\\raque\\.juliapro\\JuliaPro\_v1.0.5-2\\registries\\JuliaPro\` Updating git-repo \`https://pkg…

---

## [Julia JuMP optimization help](https://discourse.julialang.org/t/julia-jump-optimization-help/43259)

<div class="topic-metadata">

**Author:** [@jovansam](https://discourse.julialang.org/u/jovansam)\
**Replies:** 3\
**Last updated:** [August 7, 2020, 10:04am UTC](https://discourse.julialang.org/t/julia-jump-optimization-help/43259 "2020-08-07T10:04:09Z")

</div>

With complements in Julia/JuMP/PATH/KNITRO. How do you get to use non-linear functions. See in the code below. using PATH, JuMP, KNITRO function geological\_constraints\_MCP() Α = 50.0 Β = 0.1 δ = 0.05 …

---

## [Establishment of 0-1 variable in JuMP](https://discourse.julialang.org/t/establishment-of-0-1-variable-in-jump/44421)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 2\
**Last updated:** [August 6, 2020, 2:33pm UTC](https://discourse.julialang.org/t/establishment-of-0-1-variable-in-jump/44421 "2020-08-06T14:33:04Z")

</div>

I wrote a very simple program using JuMP model=Model(Gurobi.Optimizer) @variable(model,0\<=w\<=1,Int) @variable(model,0\<=x\[1:2,1:2\]\<=10) @constraint(model,w\*x\>=0) @objective(model,Min,-x) optimize!(model) How to mul…

---

## [Absolute value of matrix](https://discourse.julialang.org/t/absolute-value-of-matrix/44395)

<div class="topic-metadata">

**Author:** [@dty](https://discourse.julialang.org/u/dty)\
**Replies:** 11\
**Last updated:** [August 6, 2020, 1:38pm UTC](https://discourse.julialang.org/t/absolute-value-of-matrix/44395 "2020-08-06T13:38:32Z")

</div>

How to define the absolute value of all elements in the matrix? using JuMP,Gurobi model = Model(Gurobi.Optimizer); model=Model(Gurobi.Optimizer) T=24 @variable(model, 2 \<= a\[1:T,1:3\]\<= 2.5, Int) @variable(model,-1\<…

---

## [How to model a \<= 1/b](https://discourse.julialang.org/t/how-to-model-a-1-b/44370)

<div class="topic-metadata">

**Author:** [@sobhan](https://discourse.julialang.org/u/sobhan)\
**Replies:** 5\
**Last updated:** [August 5, 2020, 10:42pm UTC](https://discourse.julialang.org/t/how-to-model-a-1-b/44370 "2020-08-05T22:42:15Z")

</div>

i know we can write a \\geq \\frac{1}{b} as \[a +b, a - b, 2\] in SecondOrderCone() or a + b \\geq ||(a-b, 2)||\_2 But how can i rewrite a \\leq \\frac{1}{b} with Second Order cones, power cones, exponential cones, basically an…

---

## [BilevelJuMP: Best way to initialize primal and dual problem](https://discourse.julialang.org/t/bileveljump-best-way-to-initialize-primal-and-dual-problem/44276)

<div class="topic-metadata">

**Author:** [@davide-f](https://discourse.julialang.org/u/davide-f)\
**Replies:** 1\
**Last updated:** [August 5, 2020, 2:09pm UTC](https://discourse.julialang.org/t/bileveljump-best-way-to-initialize-primal-and-dual-problem/44276 "2020-08-05T14:09:18Z")

</div>

Dear Community, I have a relatively large bilevel optimization problem that I’m trying to solve with BilevelJuMP; however it is very slow in reaching a feasible solution. I am using the FortuntyAmat mode, aiming to fas…

---

## [JUMP - Get MIP Gap during optimization](https://discourse.julialang.org/t/jump-get-mip-gap-during-optimization/44258)

<div class="topic-metadata">

**Author:** [@Tmart](https://discourse.julialang.org/u/Tmart)\
**Replies:** 5\
**Last updated:** [August 5, 2020, 2:05pm UTC](https://discourse.julialang.org/t/jump-get-mip-gap-during-optimization/44258 "2020-08-05T14:05:38Z")

</div>

Hello, I was wondering if it was possible to obtain the value of the MIP Gap at each step of the optimization process. Thank you in advance, KR

---

## [Unable to build SCIP](https://discourse.julialang.org/t/unable-to-build-scip/44261)

<div class="topic-metadata">

**Author:** [@musman](https://discourse.julialang.org/u/musman)\
**Replies:** 1\
**Last updated:** [August 4, 2020, 3:45pm UTC](https://discourse.julialang.org/t/unable-to-build-scip/44261 "2020-08-04T15:45:04Z")

</div>

Hi, I am unable to install SCIP package 0.9.4 and receiving the following error. Blockquote add SCIP@v0.9.4 Updating registry at C:\\Users\\usman\\.juliapro\\JuliaPro\_v1.4.2-1\\registries\\JuliaPro Resolving package versi…

---

## [On the output value of JuMP](https://discourse.julialang.org/t/on-the-output-value-of-jump/44084)

<div class="topic-metadata">

**Author:** [@dty](https://discourse.julialang.org/u/dty)\
**Replies:** 6\
**Last updated:** [August 3, 2020, 9:21am UTC](https://discourse.julialang.org/t/on-the-output-value-of-jump/44084 "2020-08-03T09:21:35Z")

</div>

How to output the value of my decision variable in workspace？ I tried to use value at the end of the program, but it didn’t work. At present, the effective way is to write value() one by one in repl.

---

## [Variable declaration](https://discourse.julialang.org/t/variable-declaration/44142)

<div class="topic-metadata">

**Author:** [@mamo](https://discourse.julialang.org/u/mamo)\
**Replies:** 2\
**Last updated:** [August 2, 2020, 6:50pm UTC](https://discourse.julialang.org/t/variable-declaration/44142 "2020-08-02T18:50:09Z")

</div>

Dear, send me some suggestion for a proper declaration of this variable @variable(model, CHANGE\[k in FAMILY, l in FAMILY, j in UNITS, t in TIME, t1 in TIME: k\<\>l and t+1=t1\], Bin) The problem is in k\<\>l (k must be di…

[Previous page](https://discourse.julialang.org/c/domain/opt/13.md?page=92)

[Next page](https://discourse.julialang.org/c/domain/opt/13.md?page=94)
