# Optimization (Mathematical)

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

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

**Page:** 79

---

## [Having nothing as an outcome using GLPK and JuMP](https://discourse.julialang.org/t/having-nothing-as-an-outcome-using-glpk-and-jump/62948)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 5\
**Last updated:** [June 16, 2021, 6:41pm UTC](https://discourse.julialang.org/t/having-nothing-as-an-outcome-using-glpk-and-jump/62948 "2021-06-16T18:41:19Z")

</div>

i have this piece of code for optimization: using JuMP using GLPK function scan\_maker(A) m= Model(GLPK.Optimizer) level = size(A, 2) v = zeros(Int, level) ub = zeros(Int, level) lb = zeros(Int…

---

## [Help with JuMP syntax for objective function](https://discourse.julialang.org/t/help-with-jump-syntax-for-objective-function/62934)

<div class="topic-metadata">

**Author:** [@Thomas](https://discourse.julialang.org/u/Thomas)\
**Replies:** 2\
**Last updated:** [June 15, 2021, 10:29am UTC](https://discourse.julialang.org/t/help-with-jump-syntax-for-objective-function/62934 "2021-06-15T10:29:42Z")

</div>

When creating a model to solve SDP @variable(model, X\[1:n,1:n\], PSD) @constraint(model, A\*vec(X).==b) @objective(model, Min, c\*vec(X)) I got an error ERROR: MethodError: no method matching \*(::SparseVector{Int64, Int6…

---

## [Unsupported constraints in saving JuMP models](https://discourse.julialang.org/t/unsupported-constraints-in-saving-jump-models/62925)

<div class="topic-metadata">

**Author:** [@anon94806364](https://discourse.julialang.org/u/anon94806364)\
**Replies:** 1\
**Last updated:** [June 15, 2021, 6:38am UTC](https://discourse.julialang.org/t/unsupported-constraints-in-saving-jump-models/62925 "2021-06-15T06:38:56Z")

</div>

Are there certain types of JuMP constraints that are not amenable for saving under specific formats? Recently I have converted an ILP from Python to Julia, where I’ve found building the model is significantly faster! I’…

---

## [Efficient way to solve similar optimization problems with JuMP](https://discourse.julialang.org/t/efficient-way-to-solve-similar-optimization-problems-with-jump/62793)

<div class="topic-metadata">

**Author:** [@AtsushiSakai](https://discourse.julialang.org/u/AtsushiSakai)\
**Replies:** 8\
**Last updated:** [June 14, 2021, 11:36pm UTC](https://discourse.julialang.org/t/efficient-way-to-solve-similar-optimization-problems-with-jump/62793 "2021-06-14T23:36:55Z")

</div>

I would like to solve some similar optimization problems, which are mathematical formulation (cost and constraints) are same, but just model parameter values or size of model parameters are different, in JuMP. Currently…

---

## [JuMP+EAGO+@NLexpressions gives numeric instability](https://discourse.julialang.org/t/jump-eago-nlexpressions-gives-numeric-instability/61093)

<div class="topic-metadata">

**Author:** [@blob](https://discourse.julialang.org/u/blob)\
**Replies:** 5\
**Last updated:** [June 14, 2021, 10:38pm UTC](https://discourse.julialang.org/t/jump-eago-nlexpressions-gives-numeric-instability/61093 "2021-06-14T22:38:04Z")

</div>

I want to use EAGO.jl as an alternative solver to ipopt for nonlinear problems. I ran the example from the website (GitHub - PSORLab/EAGO.jl: A development environment for robust and global optimization) and it works fin…

---

## [List comprehension of JuMP variables](https://discourse.julialang.org/t/list-comprehension-of-jump-variables/62848)

<div class="topic-metadata">

**Author:** [@anon94806364](https://discourse.julialang.org/u/anon94806364)\
**Replies:** 8\
**Last updated:** [June 14, 2021, 5:42am UTC](https://discourse.julialang.org/t/list-comprehension-of-jump-variables/62848 "2021-06-14T05:42:03Z")

</div>

Beginner to Julia and want to quickly recapitulate an ILP model I wrote in Python to evaluate speed in JuMP. I’m wondering how list comprehensions work for JuMP objects? In Python, I use list comprehension to make the …

---

## [Silly question regarding vectorized syntax \[JUMP\]](https://discourse.julialang.org/t/silly-question-regarding-vectorized-syntax-jump/62853)

<div class="topic-metadata">

**Author:** [@Jameli](https://discourse.julialang.org/u/Jameli)\
**Replies:** 2\
**Last updated:** [June 14, 2021, 12:16am UTC](https://discourse.julialang.org/t/silly-question-regarding-vectorized-syntax-jump/62853 "2021-06-14T00:16:08Z")

</div>

Hello everyone! I’m having some trouble with some basic concepts about vectorized syntax. My data were structured this way (just to show that everything is in matrix form): U = \[ ATumor zeros(tr, tr) zeros(tr, g…

---

## [Does JuMP work well with vectorized data?](https://discourse.julialang.org/t/does-jump-work-well-with-vectorized-data/62852)

<div class="topic-metadata">

**Author:** [@Jameli](https://discourse.julialang.org/u/Jameli)\
**Replies:** 1\
**Last updated:** [June 13, 2021, 11:19pm UTC](https://discourse.julialang.org/t/does-jump-work-well-with-vectorized-data/62852 "2021-06-13T23:19:29Z")

</div>

Hello, everyone! Greetings from Brazil! I’ve come from MATLAB in order to gain some speed regarding LP’s problems. And searching about JuMP, I found this topic Memory consumption and time of @constraint · Issue #969 · j…

---

## [API documentation for gurobi.jl](https://discourse.julialang.org/t/api-documentation-for-gurobi-jl/62825)

<div class="topic-metadata">

**Author:** [@anon94806364](https://discourse.julialang.org/u/anon94806364)\
**Replies:** 4\
**Last updated:** [June 13, 2021, 10:04pm UTC](https://discourse.julialang.org/t/api-documentation-for-gurobi-jl/62825 "2021-06-13T22:04:08Z")

</div>

I’ve been trying to solve an ILP in Python where the primary bottle neck appears to be model construction. Multiple sources cite that model construction is heavily language dependent (whereas the optimization is language…

---

## [Manifold optimization with additional constraints](https://discourse.julialang.org/t/manifold-optimization-with-additional-constraints/62799)

<div class="topic-metadata">

**Author:** [@Jae-Mo\_Lihm](https://discourse.julialang.org/u/Jae-Mo_Lihm)\
**Replies:** 1\
**Last updated:** [June 13, 2021, 9:53pm UTC](https://discourse.julialang.org/t/manifold-optimization-with-additional-constraints/62799 "2021-06-13T21:53:25Z")

</div>

I want to minimize f(x), with two constraints: (1) x is a unitary matrix, and (2) f\_i(x) \>= 0 for i=1, …, N. (In my case, f\_i(x) are quadratic functions, e.g. abs(x\[1, 1\])^2) - 0.5. Because of the unitarity constraint, …

---

## [Problems in the Gurobi installation](https://discourse.julialang.org/t/problems-in-the-gurobi-installation/62630)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 7\
**Last updated:** [June 9, 2021, 3:54pm UTC](https://discourse.julialang.org/t/problems-in-the-gurobi-installation/62630 "2021-06-09T15:54:52Z")

</div>

Dear all, I have the Gurobi software on my computer. I want to install the Gurobi package in Julia. I have followed the steps on GitHub - jump-dev/Gurobi.jl: Julia interface for Gurobi Optimizer An error message appea…

---

## [Benders framework of cplex in JuMP](https://discourse.julialang.org/t/benders-framework-of-cplex-in-jump/62557)

<div class="topic-metadata">

**Author:** [@BYS](https://discourse.julialang.org/u/BYS)\
**Replies:** 4\
**Last updated:** [June 8, 2021, 4:33am UTC](https://discourse.julialang.org/t/benders-framework-of-cplex-in-jump/62557 "2021-06-08T04:33:10Z")

</div>

Hi, everyone Does JuMP support the Benders decomposition interface of cplex(IBM Documentation)? I find cplex doesn’t support the examples for Julia. I have a model,which the master problem is MILP, and the subproblem is…

---

## [Newton method in PowerModels.jl](https://discourse.julialang.org/t/newton-method-in-powermodels-jl/61568)

<div class="topic-metadata">

**Author:** [@Mariana](https://discourse.julialang.org/u/Mariana)\
**Replies:** 3\
**Last updated:** [June 7, 2021, 5:21pm UTC](https://discourse.julialang.org/t/newton-method-in-powermodels-jl/61568 "2021-06-07T17:21:41Z")

</div>

Hello! I am trying to run a power flow in PowerModels.jl by using Newton method. I am running compute\_ac\_pf, but the result of this function is a dictionary containing generation and voltages at the buses, and it does n…

---

## [Constraints of function in the Set MathOptInterface.Interval{Float64} are not implemented](https://discourse.julialang.org/t/constraints-of-function-in-the-set-mathoptinterface-interval-float64-are-not-implemented/62441)

<div class="topic-metadata">

**Author:** [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Replies:** 2\
**Last updated:** [June 7, 2021, 8:19am UTC](https://discourse.julialang.org/t/constraints-of-function-in-the-set-mathoptinterface-interval-float64-are-not-implemented/62441 "2021-06-07T08:19:29Z")

</div>

The model is a bi\_level model with Gurobi solver. There are a number of continuous variables and one binary variable. When solving this model, it shows such wrong. What does it mean? How can I find the wrong constraint…

---

## [JuMP: Error while fixing variable defined as DenseAxisArray using map function](https://discourse.julialang.org/t/jump-error-while-fixing-variable-defined-as-denseaxisarray-using-map-function/62461)

<div class="topic-metadata">

**Author:** [@trathi](https://discourse.julialang.org/u/trathi)\
**Replies:** 4\
**Last updated:** [June 7, 2021, 1:11am UTC](https://discourse.julialang.org/t/jump-error-while-fixing-variable-defined-as-denseaxisarray-using-map-function/62461 "2021-06-07T01:11:55Z")

</div>

I came across this error when trying to fix a variable defined as DenseAxisArray. For example: using JuMP m=Model() @variable(m, x\[0:2,1:3\] \>=0) map(y-\>fix(y,0.0; force=true), x\[0, :\]) This gives an error: MethodErro…

---

## [Can I use generalized constraints in JuMP?](https://discourse.julialang.org/t/can-i-use-generalized-constraints-in-jump/62392)

<div class="topic-metadata">

**Author:** [@iiitr](https://discourse.julialang.org/u/iiitr)\
**Replies:** 2\
**Last updated:** [June 7, 2021, 12:15am UTC](https://discourse.julialang.org/t/can-i-use-generalized-constraints-in-jump/62392 "2021-06-07T00:15:09Z")

</div>

Hi, all, There is a simple programming with generalized constraints (min(…)), but the julia tells me errors as follows: ERROR: LoadError: MethodError: no method matching isless(::AffExpr, ::AffExpr) Closest candidates…

---

## [Solving optimization problems with bilinear matrix inequalities (BMI) in Julia](https://discourse.julialang.org/t/solving-optimization-problems-with-bilinear-matrix-inequalities-bmi-in-julia/62407)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 3\
**Last updated:** [June 6, 2021, 1:25pm UTC](https://discourse.julialang.org/t/solving-optimization-problems-with-bilinear-matrix-inequalities-bmi-in-julia/62407 "2021-06-06T13:25:24Z")

</div>

Dear All, Is there a way one can formulate and solve optimization problems with bilinear matrix inequalities in Julia/JuMP? For example, \\begin{array}{ll} \\textrm{minimize} & c^{T}x\\\\ \\textrm{subject to} & A\_{0}+\\s…

---

## [Right solver for JuMP to find every solution of a linear system of equations with integer solutions](https://discourse.julialang.org/t/right-solver-for-jump-to-find-every-solution-of-a-linear-system-of-equations-with-integer-solutions/44709)

<div class="topic-metadata">

**Author:** [@damaro](https://discourse.julialang.org/u/damaro)\
**Replies:** 28\
**Last updated:** [June 4, 2021, 5:03am UTC](https://discourse.julialang.org/t/right-solver-for-jump-to-find-every-solution-of-a-linear-system-of-equations-with-integer-solutions/44709 "2021-06-04T05:03:25Z")

</div>

I have been struggling to find an equivalent Julia function to Mathematica FindInstance. The reason behind this is to find every solution of a system of equations with positive integer solutions. I provide a concrete …

---

## [Array of @NLexpression](https://discourse.julialang.org/t/array-of-nlexpression/62324)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 1\
**Last updated:** [June 3, 2021, 8:43am UTC](https://discourse.julialang.org/t/array-of-nlexpression/62324 "2021-06-03T08:43:31Z")

</div>

can we add array of nl expressions with name in macro using JuMP mm=Model() for i in 1:5 @NLexpression(mm,pp\[i\],i) end ERROR: An object of name pp is already attached to this model. If this is intended, …

---

## [How to do division in a linear model with JuMP](https://discourse.julialang.org/t/how-to-do-division-in-a-linear-model-with-jump/62077)

<div class="topic-metadata">

**Author:** [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Replies:** 9\
**Last updated:** [June 3, 2021, 12:45am UTC](https://discourse.julialang.org/t/how-to-do-division-in-a-linear-model-with-jump/62077 "2021-06-03T00:45:30Z")

</div>

There is a constraint “P=Q./R”, where P and Q are vector{variableRef}, Q is array{Float64,2} JuMP model is as follow: using JuMP,Gurobi,LinearAlgebra model=Model(Gurobi.Optimizer) Q=\[1,2,3\] …

---

## [Obtain gradient of function at end of iterations in Optim.jl](https://discourse.julialang.org/t/obtain-gradient-of-function-at-end-of-iterations-in-optim-jl/62244)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 3\
**Last updated:** [June 3, 2021, 12:02am UTC](https://discourse.julialang.org/t/obtain-gradient-of-function-at-end-of-iterations-in-optim-jl/62244 "2021-06-03T00:02:53Z")

</div>

Is it possible to obtain the gradient of the objective function at the iterations limit? There is a field in the object returned that is named g\_residual, that would give me the max norm of the gradient, but I am interes…

---

## [Multithread on JuMP for Benders cut](https://discourse.julialang.org/t/multithread-on-jump-for-benders-cut/62189)

<div class="topic-metadata">

**Author:** [@Hilaire\_Foillard](https://discourse.julialang.org/u/Hilaire_Foillard)\
**Replies:** 2\
**Last updated:** [June 1, 2021, 8:33pm UTC](https://discourse.julialang.org/t/multithread-on-jump-for-benders-cut/62189 "2021-06-01T20:33:52Z")

</div>

Hello, I’m looking for multithreading for my Benders cuts: indeed, the subproblem can be decomposed in several independent subproblems that can be executed in parallel (i use CPLEX solver). When I run my program, my note…

---

## [How to pass a SymPy expression supported by JuMP](https://discourse.julialang.org/t/how-to-pass-a-sympy-expression-supported-by-jump/62109)

<div class="topic-metadata">

**Author:** [@maoc](https://discourse.julialang.org/u/maoc)\
**Replies:** 6\
**Last updated:** [June 1, 2021, 8:31pm UTC](https://discourse.julialang.org/t/how-to-pass-a-sympy-expression-supported-by-jump/62109 "2021-06-01T20:31:16Z")

</div>

I would like to convert a SymPy expression in order to use as an objetive function in JuMP. Suppose my variable involves two variables p \[1,1\] and p \[1,2\]. using SymPy using JuMP, Ipopt # expr is my SymPy expression…

---

## [JuMP/NumFOCUS contributor survey](https://discourse.julialang.org/t/jump-numfocus-contributor-survey/62141)

<div class="topic-metadata">

**Author:** [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Replies:** 2\
**Last updated:** [June 1, 2021, 12:35pm UTC](https://discourse.julialang.org/t/jump-numfocus-contributor-survey/62141 "2021-06-01T12:35:03Z")

</div>

Hi JuMP community, JuMP is participating in a research project being conducted by NumFOCUS. The research is looking into understanding the diversity, inclusion and barriers to participation within NumFOCUS-sponsored pro…

---

## [Bug in JuMP](https://discourse.julialang.org/t/bug-in-jump/62129)

<div class="topic-metadata">

**Author:** [@JohnZ](https://discourse.julialang.org/u/JohnZ)\
**Replies:** 2\
**Last updated:** [May 31, 2021, 6:02pm UTC](https://discourse.julialang.org/t/bug-in-jump/62129 "2021-05-31T18:02:13Z")

</div>

I am running into an unusual error if I specify a method (such as dual simplex, barrier) to use. The solver finds a solution but then I get an error message and Julia exits. The code below reproduces the error. Is this …

---

## [Understanding of implies](https://discourse.julialang.org/t/understanding-of-implies/61978)

<div class="topic-metadata">

**Author:** [@sogrbilja](https://discourse.julialang.org/u/sogrbilja)\
**Replies:** 14\
**Last updated:** [May 31, 2021, 12:41pm UTC](https://discourse.julialang.org/t/understanding-of-implies/61978 "2021-05-31T12:41:32Z")

</div>

Can someone explain to me how should I read this and which values can variables have? model = Model() @variable(model, x\[1:2\], Bin) @constraint(model, x\[1\] \<= x\[2\]) Should I read it like: this constraint will ensure th…

---

## [Return Tuple from JuMP](https://discourse.julialang.org/t/return-tuple-from-jump/62026)

<div class="topic-metadata">

**Author:** [@mjanun](https://discourse.julialang.org/u/mjanun)\
**Replies:** 3\
**Last updated:** [May 29, 2021, 8:21am UTC](https://discourse.julialang.org/t/return-tuple-from-jump/62026 "2021-05-29T08:21:32Z")

</div>

I have few questions on JuMP. Can we return JuMP results as a named tuple of termination status and variable values? See MWE below. Variables will not always contain values, eg. if model is infeasible, so I don’t know ho…

---

## [Using JuMP in Python Environment](https://discourse.julialang.org/t/using-jump-in-python-environment/61165)

<div class="topic-metadata">

**Author:** [@asavasci](https://discourse.julialang.org/u/asavasci)\
**Replies:** 2\
**Last updated:** [May 28, 2021, 1:52am UTC](https://discourse.julialang.org/t/using-jump-in-python-environment/61165 "2021-05-28T01:52:48Z")

</div>

I am trying to embed JuMP-based Julia script into a Python-based computing framework using PyCall. However, I am facing problems when I define JuMP variable as from julia import Ipopt from julia.JuMP import Model from …

---

## [Solve for Hermitian PSD with non-linear objective in JuMP](https://discourse.julialang.org/t/solve-for-hermitian-psd-with-non-linear-objective-in-jump/61539)

<div class="topic-metadata">

**Author:** [@nhardy](https://discourse.julialang.org/u/nhardy)\
**Replies:** 19\
**Last updated:** [May 27, 2021, 1:28am UTC](https://discourse.julialang.org/t/solve-for-hermitian-psd-with-non-linear-objective-in-jump/61539 "2021-05-27T01:28:32Z")

</div>

I am new to using JuMP, and was hoping for some help. I am trying to estimate the elements of a matrix that is: Hermitian (in general complex numbers) Semi-positive definite diagonal elements are \>= 0 trace == 1 After…

---

## [Enumerating all possible solutions of Knapsack problem](https://discourse.julialang.org/t/enumerating-all-possible-solutions-of-knapsack-problem/61800)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 3\
**Last updated:** [May 26, 2021, 3:57am UTC](https://discourse.julialang.org/t/enumerating-all-possible-solutions-of-knapsack-problem/61800 "2021-05-26T03:57:36Z")

</div>

Dear All, I would like to ask, if anyone has experimented with an algorithm to enumerate all possible solutions of the knapsack problem. I have seen scientific papers solving this problem and would like to know, if some…

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

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