# Optimization (Mathematical)

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

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

**Page:** 116

---

## [Applicationerror: solver (gurobi) did not exit normally](https://discourse.julialang.org/t/applicationerror-solver-gurobi-did-not-exit-normally/17201)

<div class="topic-metadata">

**Author:** [@Vondoe79](https://discourse.julialang.org/u/Vondoe79)\
**Replies:** 2\
**Last updated:** [November 14, 2018, 9:59pm UTC](https://discourse.julialang.org/t/applicationerror-solver-gurobi-did-not-exit-normally/17201 "2018-11-14T21:59:43Z")

</div>

Hi there, I am getting this “applicationerror: solver (gurobi) did not exit normally”, the first time since using JuMP in 2 years. I have tried to look it up online, but no avail. Can anyone here please help me figure w…

---

## [JuMP and user defined objective function: JuMPArray dimension problem](https://discourse.julialang.org/t/jump-and-user-defined-objective-function-jumparray-dimension-problem/17470)

<div class="topic-metadata">

**Author:** [@axelle](https://discourse.julialang.org/u/axelle)\
**Replies:** 8\
**Last updated:** [November 14, 2018, 1:29pm UTC](https://discourse.julialang.org/t/jump-and-user-defined-objective-function-jumparray-dimension-problem/17470 "2018-11-14T13:29:37Z")

</div>

Good afternoon, I had a look at previous topices on this subject and could not find the solution to my error. I have an optimization problem with a non linear user defined objective function called bk\_obj. This functio…

---

## [GLPK + Homebrew erros - Not properly installed / Key "10.14" not found / Build errors](https://discourse.julialang.org/t/glpk-homebrew-erros-not-properly-installed-key-10-14-not-found-build-errors/17439)

<div class="topic-metadata">

**Author:** [@miqlliot](https://discourse.julialang.org/u/miqlliot)\
**Replies:** 4\
**Last updated:** [November 13, 2018, 5:04pm UTC](https://discourse.julialang.org/t/glpk-homebrew-erros-not-properly-installed-key-10-14-not-found-build-errors/17439 "2018-11-13T17:04:23Z")

</div>

Hi, I am using Julia for my Operations Research studies, but have struggled for over 3 months getting it running locally and have to use the online JuliaBox service. I have now managed to finally get the atom-integratio…

---

## [Moore-Penrose Generalized Inverse of Sparse Matrix](https://discourse.julialang.org/t/moore-penrose-generalized-inverse-of-sparse-matrix/17414)

<div class="topic-metadata">

**Author:** [@Paul\_McVay](https://discourse.julialang.org/u/Paul_McVay)\
**Replies:** 2\
**Last updated:** [November 12, 2018, 3:01am UTC](https://discourse.julialang.org/t/moore-penrose-generalized-inverse-of-sparse-matrix/17414 "2018-11-12T03:01:46Z")

</div>

Is there any package that provides a function to calculate a generalized inverse of a sparse matrix? I know the LinearAlgebra package provides pinv and the SparseArrays provides capabilities for the creation of sparse ma…

---

## [Solve standard continuous relaxation of model in v0.19-alpha](https://discourse.julialang.org/t/solve-standard-continuous-relaxation-of-model-in-v0-19-alpha/17416)

<div class="topic-metadata">

**Author:** [@vtjeng](https://discourse.julialang.org/u/vtjeng)\
**Replies:** 1\
**Last updated:** [November 12, 2018, 3:33am UTC](https://discourse.julialang.org/t/solve-standard-continuous-relaxation-of-model-in-v0-19-alpha/17416 "2018-11-12T03:33:42Z")

</div>

JuMP (up to 0.18.4) allowed you to pass the keyword relaxation=True to solve the standard relaxation of a model (for example, onw with integer constraints). JuMP.jl/NEWS.md at 4b04d34fac5af2494611d972c24095d3ecbc20e8 · j…

---

## [Adding a new variable to an existing variable array](https://discourse.julialang.org/t/adding-a-new-variable-to-an-existing-variable-array/17390)

<div class="topic-metadata">

**Author:** [@borelian](https://discourse.julialang.org/u/borelian)\
**Replies:** 1\
**Last updated:** [November 10, 2018, 7:42pm UTC](https://discourse.julialang.org/t/adding-a-new-variable-to-an-existing-variable-array/17390 "2018-11-10T19:42:04Z")

</div>

Hi. I’m teaching Column Generation on Jump. Hence, given a set of columns x\[1:N\] I’ll like add a new variable x\[N+1\] to the previous variable set. If I try @defVar(master, x\[N+1\]\>=0, objective=1) JUMP assumes that I…

---

## [Optim and complex numbers: InexactError thrown](https://discourse.julialang.org/t/optim-and-complex-numbers-inexacterror-thrown/17338)

<div class="topic-metadata">

**Author:** [@axelle](https://discourse.julialang.org/u/axelle)\
**Replies:** 8\
**Last updated:** [November 9, 2018, 1:56pm UTC](https://discourse.julialang.org/t/optim-and-complex-numbers-inexacterror-thrown/17338 "2018-11-09T13:56:00Z")

</div>

Good morning, I encounter some issues when some complex numbers arise in my optimisation. I think it might be due to my function u(c) = c^gamma where sometimes c turns out negative (c being different expressions defined…

---

## [\[JuMP\] Is it possible to switch solver version back and forth? (e.g. Gurobi 7.5 \<-\> 8.0)](https://discourse.julialang.org/t/jump-is-it-possible-to-switch-solver-version-back-and-forth-e-g-gurobi-7-5-8-0/10932)

<div class="topic-metadata">

**Author:** [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Replies:** 5\
**Last updated:** [November 8, 2018, 2:39pm UTC](https://discourse.julialang.org/t/jump-is-it-possible-to-switch-solver-version-back-and-forth-e-g-gurobi-7-5-8-0/10932 "2018-11-08T14:39:00Z")

</div>

Is it possible to switch solver version back and forth? (e.g. Gurobi 7.5 ↔ 8.0) Also, is there any command to display Solver version that I am using on Julia? using JuMP, Gurobi m = Model(solver = GurobiSolver()) @vari…

---

## [Fminbox and linesearch issues for box constrained optimization](https://discourse.julialang.org/t/fminbox-and-linesearch-issues-for-box-constrained-optimization/17273)

<div class="topic-metadata">

**Author:** [@axelle](https://discourse.julialang.org/u/axelle)\
**Replies:** 3\
**Last updated:** [November 8, 2018, 11:41am UTC](https://discourse.julialang.org/t/fminbox-and-linesearch-issues-for-box-constrained-optimization/17273 "2018-11-08T11:41:18Z")

</div>

Good afternoon, I cannot figure out the right syntax for a box constrained optimization but where i need to change the line search as I was getting an error: ArgumentError: Value and slope at step length = 0 must be fin…

---

## [Julia novice. Integer programming code optimization error](https://discourse.julialang.org/t/julia-novice-integer-programming-code-optimization-error/6926)

<div class="topic-metadata">

**Author:** [@yold6](https://discourse.julialang.org/u/yold6)\
**Replies:** 4\
**Last updated:** [November 5, 2018, 4:43am UTC](https://discourse.julialang.org/t/julia-novice-integer-programming-code-optimization-error/6926 "2018-11-05T04:43:52Z")

</div>

Hello and thanks for reading this. I am new to Julia and am attempting to use JuMP to generate entries for Fanduel football tournament contests with a top heavy payoff structure. The code are my modifications to code ori…

---

## [Help with a Constraint](https://discourse.julialang.org/t/help-with-a-constraint/13827)

<div class="topic-metadata">

**Author:** [@muriloasouza](https://discourse.julialang.org/u/muriloasouza)\
**Replies:** 15\
**Last updated:** [November 1, 2018, 1:37pm UTC](https://discourse.julialang.org/t/help-with-a-constraint/13827 "2018-11-01T13:37:35Z")

</div>

Hello, I need some help to write a constraint for my problem. This constraint has the following matrix: using JuMP, CouenneNL Nt = 2; L = 0; C = 0; h = 0; hmax = 5; Y = zeros(Nt,Nt,hmax); b = 2; v = 10; for h = 3:2:…

---

## [Help with Tag type parameter in ForwardDiff.jl (+ Optim.jl)](https://discourse.julialang.org/t/help-with-tag-type-parameter-in-forwarddiff-jl-optim-jl/16969)

<div class="topic-metadata">

**Author:** [@skarp](https://discourse.julialang.org/u/skarp)\
**Replies:** 6\
**Last updated:** [October 31, 2018, 2:45pm UTC](https://discourse.julialang.org/t/help-with-tag-type-parameter-in-forwarddiff-jl-optim-jl/16969 "2018-10-31T14:45:33Z")

</div>

Hello. I understand from the documentation of ForwardDiff.jl that the package uses a Tag type parameter to avoid something called ‘perturbation confusion’: http://www.juliadiff.org/ForwardDiff.jl/stable/dev/how\_it\_work…

---

## [Gurobi fail to precompile](https://discourse.julialang.org/t/gurobi-fail-to-precompile/16993)

<div class="topic-metadata">

**Author:** [@Ksun46](https://discourse.julialang.org/u/Ksun46)\
**Replies:** 0\
**Last updated:** [October 31, 2018, 4:46am UTC](https://discourse.julialang.org/t/gurobi-fail-to-precompile/16993 "2018-10-31T04:46:09Z")

</div>

I didn’t call Gurobi for a long time. It used to work find. But today when I did, I got this INFO: Precompiling module Gurobi. WARNING: Module Compat with uuid 1366427411356359 is missing from the cache. This may mean m…

---

## [Semi-infinite programming with JuMP](https://discourse.julialang.org/t/semi-infinite-programming-with-jump/16953)

<div class="topic-metadata">

**Author:** [@Azzaare](https://discourse.julialang.org/u/Azzaare)\
**Replies:** 1\
**Last updated:** [October 30, 2018, 7:59am UTC](https://discourse.julialang.org/t/semi-infinite-programming-with-jump/16953 "2018-10-30T07:59:43Z")

</div>

Hi there, I was wondering if there is any plan to have some semi-infinite solver interfaced through JuMP at some point (for instance NSIPS). I suppose it is not the case, but it doesn’t hurt to ask :wink:

---

## [Inconsistency between standard errors from Hessian and Gradient in ForwardDiff/Optim](https://discourse.julialang.org/t/inconsistency-between-standard-errors-from-hessian-and-gradient-in-forwarddiff-optim/16769)

<div class="topic-metadata">

**Author:** [@cosmia](https://discourse.julialang.org/u/cosmia)\
**Replies:** 6\
**Last updated:** [October 26, 2018, 11:12pm UTC](https://discourse.julialang.org/t/inconsistency-between-standard-errors-from-hessian-and-gradient-in-forwarddiff-optim/16769 "2018-10-26T23:12:04Z")

</div>

I have been using Optim package with AD recently, and I am having some strange behaviour with the gradient. I am using Optim and NLSolversBase in the context of Maximum Likelihood Estimation, and passing a TwiceDifferent…

---

## [Assertion error with MOI.initialize(d, \[:Grad\])](https://discourse.julialang.org/t/assertion-error-with-moi-initialize-d-grad/16796)

<div class="topic-metadata">

**Author:** [@chkwon](https://discourse.julialang.org/u/chkwon)\
**Replies:** 1\
**Last updated:** [October 26, 2018, 12:39pm UTC](https://discourse.julialang.org/t/assertion-error-with-moi-initialize-d-grad/16796 "2018-10-26T12:39:05Z")

</div>

I’m on JuMP#v0.19-alpha. using JuMP plants = \["seattle", "san-diego"\] markets = \["new-york", "chicago", "topeka"\] distance = \[ 2.5 1.7 1.8 ; 2.5 1.8 1.4 \] d = Dict() for i in 1:length(plants), j in 1:leng…

---

## [Sensitivity (post-optimality) analysis of a linear model?](https://discourse.julialang.org/t/sensitivity-post-optimality-analysis-of-a-linear-model/16785)

<div class="topic-metadata">

**Author:** [@amca01](https://discourse.julialang.org/u/amca01)\
**Replies:** 2\
**Last updated:** [October 25, 2018, 11:32pm UTC](https://discourse.julialang.org/t/sensitivity-post-optimality-analysis-of-a-linear-model/16785 "2018-10-25T23:32:44Z")

</div>

I have been experimenting with simple LP problems using JuMP and the solvers CbcSolver and GLPKSolverLP. (I’d like to try ClpSolver but I keep getting errors when I try to build it.) Now I can solve my models fine, but…

---

## [Updating options in Ipopt](https://discourse.julialang.org/t/updating-options-in-ipopt/16013)

<div class="topic-metadata">

**Author:** [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Replies:** 4\
**Last updated:** [October 24, 2018, 8:40am UTC](https://discourse.julialang.org/t/updating-options-in-ipopt/16013 "2018-10-24T08:40:17Z")

</div>

Is it possible to easily update the options used in Ipopt? Trying to change the value of mu using the :mu\_init option but it seems that Ipopt uses an immutable struct so I don’t have access. I used it in Julia v0.6 and …

---

## [How to get the Solution Pool using Julia/CPLEX?](https://discourse.julialang.org/t/how-to-get-the-solution-pool-using-julia-cplex/16684)

<div class="topic-metadata">

**Author:** [@Giovanna\_Abreu](https://discourse.julialang.org/u/Giovanna_Abreu)\
**Replies:** 0\
**Last updated:** [October 23, 2018, 2:25pm UTC](https://discourse.julialang.org/t/how-to-get-the-solution-pool-using-julia-cplex/16684 "2018-10-23T14:25:39Z")

</div>

Hi everyone, I need the solution pool for storing multiple solutions of a MIP model. I using Julia and the packages JuMP and CPLEX as a solver. So I need to collect solutions within a given percentage of the optimal sol…

---

## [ReverseDiffSparse Deprecation Warnings Julia 0.7 (JuMP)](https://discourse.julialang.org/t/reversediffsparse-deprecation-warnings-julia-0-7-jump/16611)

<div class="topic-metadata">

**Author:** [@rhuffman](https://discourse.julialang.org/u/rhuffman)\
**Replies:** 1\
**Last updated:** [October 21, 2018, 9:34pm UTC](https://discourse.julialang.org/t/reversediffsparse-deprecation-warnings-julia-0-7-jump/16611 "2018-10-21T21:34:31Z")

</div>

I’m working to update my code from Julia 0.6.3 to 0.7/1.0, and I’m running into an issue with ReverseDiffSparse.jl. I do not directly use this module, but my code does use JuMP and Ipopt. It appears that ReverseDiffSpar…

---

## [Macro for generating @NLconstraint](https://discourse.julialang.org/t/macro-for-generating-nlconstraint/16535)

<div class="topic-metadata">

**Author:** [@chkwon](https://discourse.julialang.org/u/chkwon)\
**Replies:** 3\
**Last updated:** [October 20, 2018, 10:27pm UTC](https://discourse.julialang.org/t/macro-for-generating-nlconstraint/16535 "2018-10-20T22:27:55Z")

</div>

On julia v0.7 and JuMP v0.18: using JuMP macro zero\_constraint(m, expr) quote @NLconstraint($(esc(m)), $(esc(expr)) == 0) end end m = Model() @variable(m, x) @variable(m, y) @zero\_constraint(m, x) …

---

## [Build NLexpression in steps](https://discourse.julialang.org/t/build-nlexpression-in-steps/15199)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 1\
**Last updated:** [October 19, 2018, 5:12pm UTC](https://discourse.julialang.org/t/build-nlexpression-in-steps/15199 "2018-10-19T17:12:50Z")

</div>

I want to build an NLexpression which is the sum of elements of an array containing both JuMP variables and Float64s, something like: model = Model() @variable(model, x\[1:2\]) xx = \[x\[1\]; 3.0; 4.0; 5.0; x\[2\]\] @NLexpressi…

---

## [@expression instead of constraints](https://discourse.julialang.org/t/expression-instead-of-constraints/16508)

<div class="topic-metadata">

**Author:** [@Rasoul](https://discourse.julialang.org/u/Rasoul)\
**Replies:** 7\
**Last updated:** [October 19, 2018, 4:12pm UTC](https://discourse.julialang.org/t/expression-instead-of-constraints/16508 "2018-10-19T16:12:50Z")

</div>

I have two trigonometric variables (i.e., cs\_fr and si\_fr) in my code and at the same time, there are two trigonometric terms (i.e., cs\_to and si\_to) which linearly depend on cs\_fr and si\_fr. I have defined cs\_fr and si\_…

---

## [Querying \`JuMP.NLPEvaluator\` for objective value and constraints with MathProgBase](https://discourse.julialang.org/t/querying-jump-nlpevaluator-for-objective-value-and-constraints-with-mathprogbase/16427)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 5\
**Last updated:** [October 17, 2018, 9:51pm UTC](https://discourse.julialang.org/t/querying-jump-nlpevaluator-for-objective-value-and-constraints-with-mathprogbase/16427 "2018-10-17T21:51:56Z")

</div>

I have an NLP model nlp\_model, and I want to evaluate its objective function / constraints at a point x. I first create an NLPEvaluator as mpb\_model = JuMP.NLPEvaluator(nlp\_model) and then try to query it with MathProgBa…

---

## [Cost for reactive power in PowerModels?](https://discourse.julialang.org/t/cost-for-reactive-power-in-powermodels/16441)

<div class="topic-metadata">

**Author:** [@timueh](https://discourse.julialang.org/u/timueh)\
**Replies:** 1\
**Last updated:** [October 17, 2018, 3:27pm UTC](https://discourse.julialang.org/t/cost-for-reactive-power-in-powermodels/16441 "2018-10-17T15:27:38Z")

</div>

Hi there, I am using PowerModels quite a bit – thanks @ccoffrin for this nice tool! Usually, the cost function for optimal power flow problems depends solely on the active power. For several reasons, I would like to ad…

---

## [How to pass a preconditioner to NLopt?](https://discourse.julialang.org/t/how-to-pass-a-preconditioner-to-nlopt/16361)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 0\
**Last updated:** [October 15, 2018, 7:46pm UTC](https://discourse.julialang.org/t/how-to-pass-a-preconditioner-to-nlopt/16361 "2018-10-15T19:46:03Z")

</div>

I found very scarce documentation about this. https://nlopt.readthedocs.io/en/stable/NLopt\_Reference/#preconditioning-with-approximate-hessians This only describes the C interface, and it seems to only support the meth…

---

## [JuMP.NLPEvaluator output format](https://discourse.julialang.org/t/jump-nlpevaluator-output-format/16280)

<div class="topic-metadata">

**Author:** [@astor87](https://discourse.julialang.org/u/astor87)\
**Replies:** 1\
**Last updated:** [October 14, 2018, 4:48am UTC](https://discourse.julialang.org/t/jump-nlpevaluator-output-format/16280 "2018-10-14T04:48:23Z")

</div>

I am trying to evaluate my constraints from my nonlinear program using IPOPT. From this discussion (https://groups.google.com/forum/#!searchin/julia-opt/evaluating$20constraints%7Csort:date/julia-opt/m1ObRwgrvGE/Mo8bjsZ1…

---

## [Distance optimization over a matrix of observations](https://discourse.julialang.org/t/distance-optimization-over-a-matrix-of-observations/16198)

<div class="topic-metadata">

**Author:** [@jtackm](https://discourse.julialang.org/u/jtackm)\
**Replies:** 6\
**Last updated:** [October 12, 2018, 4:21pm UTC](https://discourse.julialang.org/t/distance-optimization-over-a-matrix-of-observations/16198 "2018-10-12T16:21:04Z")

</div>

Given a MxN matrix A with M observations and N features, as well as a non-linear distance function f, with observations being identical (f(A\[i, :\], A\[j, :\]) == 0.0 for each i,j). I would like to disturb the observations…

---

## [Writing an indicator function in JuMP](https://discourse.julialang.org/t/writing-an-indicator-function-in-jump/16145)

<div class="topic-metadata">

**Author:** [@shoshievass](https://discourse.julialang.org/u/shoshievass)\
**Replies:** 7\
**Last updated:** [October 11, 2018, 2:46pm UTC](https://discourse.julialang.org/t/writing-an-indicator-function-in-jump/16145 "2018-10-11T14:46:39Z")

</div>

I’d like to penalize negative values for a linear function of parameters without using an @constraint (since I’d like it to be possible, but costly to violate the constraint) Is there a way to do this within JuMP w/o de…

---

## [Sum of squares optimization](https://discourse.julialang.org/t/sum-of-squares-optimization/15075)

<div class="topic-metadata">

**Author:** [@Rasoul](https://discourse.julialang.org/u/Rasoul)\
**Replies:** 5\
**Last updated:** [October 10, 2018, 12:34pm UTC](https://discourse.julialang.org/t/sum-of-squares-optimization/15075 "2018-10-10T12:34:42Z")

</div>

I have the following optimization problem that I want to solve by the sum of squares approach. It has a linear objective function and I am looking for the best set of (a, b, and c) that satisfies a specific polynomial. m…

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

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