# Optimization (Mathematical)

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

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

**Page:** 118

---

## [Suggestions for styling Julia/JuMP code in a Latex?](https://discourse.julialang.org/t/suggestions-for-styling-julia-jump-code-in-a-latex/6269)

<div class="topic-metadata">

**Author:** [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)\
**Replies:** 6\
**Last updated:** [September 13, 2018, 7:30pm UTC](https://discourse.julialang.org/t/suggestions-for-styling-julia-jump-code-in-a-latex/6269 "2018-09-13T19:30:42Z")

</div>

Are there any suggestions around how to best style Julia/JuMP code in Latex?

---

## [How to generate graph?](https://discourse.julialang.org/t/how-to-generate-graph/14911)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 6\
**Last updated:** [September 13, 2018, 7:06pm UTC](https://discourse.julialang.org/t/how-to-generate-graph/14911 "2018-09-13T19:06:20Z")

</div>

How to generate graph of a mathematical model? I’ve already tried using PyPlot, and I still could not. using JuMP, Cbc m = Model(solver = CbcSolver()) #Declaração das variáveis @defVar(m, x1 \>= 0) @defVar(m, x2 \>= 0)…

---

## [Syntactical Question about optimize](https://discourse.julialang.org/t/syntactical-question-about-optimize/14771)

<div class="topic-metadata">

**Author:** [@OvidiusCicero](https://discourse.julialang.org/u/OvidiusCicero)\
**Replies:** 3\
**Last updated:** [September 11, 2018, 1:55pm UTC](https://discourse.julialang.org/t/syntactical-question-about-optimize/14771 "2018-09-11T13:55:23Z")

</div>

Hi, someone not knowing much about optimization here… Why does this code searching for the minimum of the two-dimensional paraboloid optimize(x-\>x\[1\]^2+x\[2\]^2,\[1.0, 1.0\]) work without given algorithm whilst this one-d…

---

## [Get basic variables of Gurobi solution](https://discourse.julialang.org/t/get-basic-variables-of-gurobi-solution/14605)

<div class="topic-metadata">

**Author:** [@stelmo](https://discourse.julialang.org/u/stelmo)\
**Replies:** 3\
**Last updated:** [September 8, 2018, 3:15am UTC](https://discourse.julialang.org/t/get-basic-variables-of-gurobi-solution/14605 "2018-09-08T03:15:25Z")

</div>

Hi, Does anyone know how to get the basic variables after Gurobi solves an LP? It is not enough to just check for nonzero numbers in the solution since there could be degenerate basic variables. Gurobi exposes the funct…

---

## [How Define a Complex JuMP Variable](https://discourse.julialang.org/t/how-define-a-complex-jump-variable/14362)

<div class="topic-metadata">

**Author:** [@muriloasouza](https://discourse.julialang.org/u/muriloasouza)\
**Replies:** 3\
**Last updated:** [September 3, 2018, 8:16pm UTC](https://discourse.julialang.org/t/how-define-a-complex-jump-variable/14362 "2018-09-03T20:16:06Z")

</div>

How can this be done? I remember there was a Complex128 syntax or something, but i couldn’t find how to use it in a JuMP variable. Here’s my problem, assume i already have the values of Rf, Xlf and Xcf: Nt = 2; hmax = …

---

## [Huber objective](https://discourse.julialang.org/t/huber-objective/14338)

<div class="topic-metadata">

**Author:** [@Zranz](https://discourse.julialang.org/u/Zranz)\
**Replies:** 2\
**Last updated:** [August 31, 2018, 11:40pm UTC](https://discourse.julialang.org/t/huber-objective/14338 "2018-08-31T23:40:46Z")

</div>

Hi. I wanted to know if it is possible to place a Huber loss in the objective of a quadratic problem in JuMP 0.18. The Huber function can be defined as follows: huber(a,delta)= abs(a) \<= delta ? 1/2\*a^2 : delta\*(abs(a)…

---

## [is the code correct to set parameters in Gurobi](https://discourse.julialang.org/t/is-the-code-correct-to-set-parameters-in-gurobi/14226)

<div class="topic-metadata">

**Author:** [@Summer](https://discourse.julialang.org/u/Summer)\
**Replies:** 2\
**Last updated:** [August 30, 2018, 4:49am UTC](https://discourse.julialang.org/t/is-the-code-correct-to-set-parameters-in-gurobi/14226 "2018-08-30T04:49:43Z")

</div>

Hello, I am using Gurobi as the solver in Julia to solve the problem but now encountered the out-of-memory error. I understand that Gurobi has parameters such as NodefileStart and Thread to deal with this problem (h…

---

## [Optim.jl - computing value, gradient and hessian simultaneously](https://discourse.julialang.org/t/optim-jl-computing-value-gradient-and-hessian-simultaneously/1219)

<div class="topic-metadata">

**Author:** [@piever](https://discourse.julialang.org/u/piever)\
**Replies:** 17\
**Last updated:** [August 28, 2018, 7:58pm UTC](https://discourse.julialang.org/t/optim-jl-computing-value-gradient-and-hessian-simultaneously/1219 "2018-08-28T19:58:45Z")

</div>

I’ve seen in the documentation of Optim.jl that there is a basic trick to avoid recomputing the same quantity when evaluating a function and its gradient (and potentially also its hessian). The idea is to store whatever …

---

## [Need help with NLopt AUGLAG termination criteria](https://discourse.julialang.org/t/need-help-with-nlopt-auglag-termination-criteria/14189)

<div class="topic-metadata">

**Author:** [@ivborissov](https://discourse.julialang.org/u/ivborissov)\
**Replies:** 0\
**Last updated:** [August 28, 2018, 12:57pm UTC](https://discourse.julialang.org/t/need-help-with-nlopt-auglag-termination-criteria/14189 "2018-08-28T12:57:49Z")

</div>

Hi, I have an optimization problem with equality constraints and I use NLopt LN\_AUGLAG solver with derivative-free local solver like LN\_NELDERMEAD or LN\_SBPLX. However I don’t have a clear understanding how to choose to…

---

## [JuMP solver callback arguments](https://discourse.julialang.org/t/jump-solver-callback-arguments/13936)

<div class="topic-metadata">

**Author:** [@Zacharie\_ALES](https://discourse.julialang.org/u/Zacharie_ALES)\
**Replies:** 4\
**Last updated:** [August 27, 2018, 9:02am UTC](https://discourse.julialang.org/t/jump-solver-callback-arguments/13936 "2018-08-27T09:02:06Z")

</div>

Hello, I use CPLEX and a callback to solve several instances of a problem. In the callback I need to access variables (for example it could be the size of the problem or any additional information about the instance cu…

---

## [The kernel appears to have died. It will restart automatically, when using NLopt](https://discourse.julialang.org/t/the-kernel-appears-to-have-died-it-will-restart-automatically-when-using-nlopt/11362)

<div class="topic-metadata">

**Author:** [@Ludo](https://discourse.julialang.org/u/Ludo)\
**Replies:** 1\
**Last updated:** [August 26, 2018, 2:06pm UTC](https://discourse.julialang.org/t/the-kernel-appears-to-have-died-it-will-restart-automatically-when-using-nlopt/11362 "2018-08-26T14:06:14Z")

</div>

Trying to find a solve a NL system using a derivative-free (LN\_COBYLA or GN\_ISRES) algorithm with NLopt, within JuMP. I receive the following error message: The kernel appears to have died. It will restart automatically…

---

## [JuMP Ipopt on Julia 0.7](https://discourse.julialang.org/t/jump-ipopt-on-julia-0-7/14041)

<div class="topic-metadata">

**Author:** [@Bernard\_GODARD](https://discourse.julialang.org/u/Bernard_GODARD)\
**Replies:** 4\
**Last updated:** [August 26, 2018, 3:35pm UTC](https://discourse.julialang.org/t/jump-ipopt-on-julia-0-7/14041 "2018-08-26T15:35:32Z")

</div>

This is a continuation of Julia 0.7 and JuMP: ERROR: cosd is not defined for type Variable - #5 by tkoolen trying to get my JuMP problem converted to Julia 0.7. How to create an Ipopt problem with JuMP on Julia 0.7? Acc…

---

## [JuMP beginners help](https://discourse.julialang.org/t/jump-beginners-help/14016)

<div class="topic-metadata">

**Author:** [@Jon\_Norberg](https://discourse.julialang.org/u/Jon_Norberg)\
**Replies:** 2\
**Last updated:** [August 25, 2018, 6:18am UTC](https://discourse.julialang.org/t/jump-beginners-help/14016 "2018-08-25T06:18:22Z")

</div>

Hi, I have the following problem: N=10 r=rand(N)\*2 a=rand(N,N)\*0.5-0.25 \[a\[i,i\]=1.0 for i=1:N\] m = Model(solver = NLoptSolver(algorithm=:LD\_MMA)) @variable(m, x\[1:N\] \>= 0 ) @variable(m, 1.0 \>= h\[1:N…

---

## [Heuristic methods for solving the p-median problem](https://discourse.julialang.org/t/heuristic-methods-for-solving-the-p-median-problem/14022)

<div class="topic-metadata">

**Author:** [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Replies:** 0\
**Last updated:** [August 25, 2018, 3:00am UTC](https://discourse.julialang.org/t/heuristic-methods-for-solving-the-p-median-problem/14022 "2018-08-25T03:00:53Z")

</div>

Are there any Julia implementations of heuristic methods (e.g. genetic algorithm, simulated annealing, tabu search, variable neighborhood search) for solving the p-median problem? I did find a Lagrangian relaxation imple…

---

## [Singular Exceptions on Windows OS](https://discourse.julialang.org/t/singular-exceptions-on-windows-os/13877)

<div class="topic-metadata">

**Author:** [@HSFengWang](https://discourse.julialang.org/u/HSFengWang)\
**Replies:** 9\
**Last updated:** [August 23, 2018, 8:14am UTC](https://discourse.julialang.org/t/singular-exceptions-on-windows-os/13877 "2018-08-23T08:14:50Z")

</div>

When I use LsqFit to loop some curve fitting, I come across some singular exceptions. Anyone could give me some guidance on this problem. My os is window 32. Thank you. func(x, p) = 1 ./ (p\[1\]+p\[2\] \* exp.(-p\[3\] \* x ))…

---

## [DFO algorithms for constrained optimization](https://discourse.julialang.org/t/dfo-algorithms-for-constrained-optimization/13882)

<div class="topic-metadata">

**Author:** [@ivborissov](https://discourse.julialang.org/u/ivborissov)\
**Replies:** 0\
**Last updated:** [August 22, 2018, 1:32pm UTC](https://discourse.julialang.org/t/dfo-algorithms-for-constrained-optimization/13882 "2018-08-22T13:32:27Z")

</div>

Hi, could you please recommend me “free” solvers/algorithms for derivative-free optimization which support inequality/equality and bound constraints. Currently I use AUGLAG from NLopt with NELDERMEAD,SBPLX or BOBYQA as l…

---

## [@NLconstraint not working with splatting syntax](https://discourse.julialang.org/t/nlconstraint-not-working-with-splatting-syntax/13796)

<div class="topic-metadata">

**Author:** [@Arrigo\_Benedetti](https://discourse.julialang.org/u/Arrigo_Benedetti)\
**Replies:** 2\
**Last updated:** [August 22, 2018, 7:02am UTC](https://discourse.julialang.org/t/nlconstraint-not-working-with-splatting-syntax/13796 "2018-08-22T07:02:01Z")

</div>

I am trying to solve a constrained non linear optimization problem with JuMP/Ipopt and since the cost function and the constraint are functions of vector variables, I am using the splatting syntax as suggested in the JuM…

---

## [Dynamically adding constraints with @constraintref](https://discourse.julialang.org/t/dynamically-adding-constraints-with-constraintref/13830)

<div class="topic-metadata">

**Author:** [@mm0063](https://discourse.julialang.org/u/mm0063)\
**Replies:** 1\
**Last updated:** [August 21, 2018, 1:24pm UTC](https://discourse.julialang.org/t/dynamically-adding-constraints-with-constraintref/13830 "2018-08-21T13:24:38Z")

</div>

Dear all, I am trying to dynamically add constraints to my model as in the example below. However, this formulation results in the error stated below the formulation. I believe that the problem occurs due to the \[t in t…

---

## [Error handling in JuMP](https://discourse.julialang.org/t/error-handling-in-jump/13584)

<div class="topic-metadata">

**Author:** [@shoshievass](https://discourse.julialang.org/u/shoshievass)\
**Replies:** 2\
**Last updated:** [August 16, 2018, 8:58pm UTC](https://discourse.julialang.org/t/error-handling-in-jump/13584 "2018-08-16T20:58:03Z")

</div>

I’m trying to use a JuMP model as an input to an ODE solver (using the DifferentialEquations.jl package). It seems to work well most of the time, but occasionally, the solver will output warnings at intermediate values a…

---

## [User defined functions with vector constraints](https://discourse.julialang.org/t/user-defined-functions-with-vector-constraints/13574)

<div class="topic-metadata">

**Author:** [@Libbum](https://discourse.julialang.org/u/Libbum)\
**Replies:** 0\
**Last updated:** [August 16, 2018, 3:25pm UTC](https://discourse.julialang.org/t/user-defined-functions-with-vector-constraints/13574 "2018-08-16T15:25:37Z")

</div>

I’ve been thrown in the deep end with a problem that looks to be possible with current Julia tooling, but being new to the language and this particular subset of the mathematics I’m having a hard time. In a MWE format: …

---

## [Invalid variable type present in SDP Optimal Power Flow formulation](https://discourse.julialang.org/t/invalid-variable-type-present-in-sdp-optimal-power-flow-formulation/13536)

<div class="topic-metadata">

**Author:** [@Alvaro\_Jose\_Gonzalez](https://discourse.julialang.org/u/Alvaro_Jose_Gonzalez)\
**Replies:** 3\
**Last updated:** [August 16, 2018, 2:21am UTC](https://discourse.julialang.org/t/invalid-variable-type-present-in-sdp-optimal-power-flow-formulation/13536 "2018-08-16T02:21:49Z")

</div>

I am trying to recreate the SDP formulation of the OPF given by Lavaei and Low 2013. After defining the whole model, I receive a warning of an invalid variable. Am I missing any type declaration besides the one for the …

---

## [JuMP/Ipopt failing on simple problem](https://discourse.julialang.org/t/jump-ipopt-failing-on-simple-problem/13209)

<div class="topic-metadata">

**Author:** [@Arrigo\_Benedetti](https://discourse.julialang.org/u/Arrigo_Benedetti)\
**Replies:** 4\
**Last updated:** [August 14, 2018, 10:44pm UTC](https://discourse.julialang.org/t/jump-ipopt-failing-on-simple-problem/13209 "2018-08-14T22:44:38Z")

</div>

In order to debug the issue that I mentioned in the thread https://discourse.julialang.org/t/error-in-jump-nlexpression/13147 I decided to write a simple program to solve a constrained nonlinear optimization problem in o…

---

## [JuMP implementation of "Real-Time Order Fulfillment Decisions"](https://discourse.julialang.org/t/jump-implementation-of-real-time-order-fulfillment-decisions/13303)

<div class="topic-metadata">

**Author:** [@clausherther](https://discourse.julialang.org/u/clausherther)\
**Replies:** 0\
**Last updated:** [August 12, 2018, 3:28pm UTC](https://discourse.julialang.org/t/jump-implementation-of-real-time-order-fulfillment-decisions/13303 "2018-08-12T15:28:32Z")

</div>

Hello, I was wondering if anyone knew of a JuMP (or any other, really) implementation of this paper: “Benefits of Reevaluating Real-Time Order Fulfillment Decisions”. https://www.researchgate.net/publication/220391384…

---

## [Error in JuMP @NLexpression](https://discourse.julialang.org/t/error-in-jump-nlexpression/13147)

<div class="topic-metadata">

**Author:** [@Arrigo\_Benedetti](https://discourse.julialang.org/u/Arrigo_Benedetti)\
**Replies:** 0\
**Last updated:** [August 10, 2018, 6:34am UTC](https://discourse.julialang.org/t/error-in-jump-nlexpression/13147 "2018-08-10T06:34:09Z")

</div>

I am running the following code with Julia 0.6.4: using JuMP using NLopt using FastGaussQuadrature using SpecialFunctions function FisherInf(args...) N = 32 t = \[x\[i\] for i=1:N\] lambda = \[args\[i\] for i…

---

## [Deleting @NLconstraint from JuMP model](https://discourse.julialang.org/t/deleting-nlconstraint-from-jump-model/13002)

<div class="topic-metadata">

**Author:** [@chkwon](https://discourse.julialang.org/u/chkwon)\
**Replies:** 3\
**Last updated:** [August 8, 2018, 3:19pm UTC](https://discourse.julialang.org/t/deleting-nlconstraint-from-jump-model/13002 "2018-08-08T15:19:59Z")

</div>

JuMP v0.18: When I want to delete all @NLconstraints added to the JuMP model, is it safe and sufficient to do the following? m.nlpdata.nlconstr = Array{JuMP.GenericRangeConstraint{JuMP.NonlinearExprData},1}(0)

---

## [JuMP joins NumFOCUS](https://discourse.julialang.org/t/jump-joins-numfocus/12954)

<div class="topic-metadata">

**Author:** [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Replies:** 0\
**Last updated:** [August 6, 2018, 6:53pm UTC](https://discourse.julialang.org/t/jump-joins-numfocus/12954 "2018-08-06T18:53:51Z")

</div>

Enjoy JuliaCon!

---

## [Performance of Optim.jl vs. Matlab's fminunc](https://discourse.julialang.org/t/performance-of-optim-jl-vs-matlabs-fminunc/12866)

<div class="topic-metadata">

**Author:** [@tyleransom](https://discourse.julialang.org/u/tyleransom)\
**Replies:** 12\
**Last updated:** [August 6, 2018, 11:43am UTC](https://discourse.julialang.org/t/performance-of-optim-jl-vs-matlabs-fminunc/12866 "2018-08-06T11:43:54Z")

</div>

I’ve been comparing the performance of Optim.jl with Matlab’s fminunc. Surprisingly, Optim’s L-BFGS algorithm doesn’t always beat fminunc. I was wondering if anyone knows why this might be. Here’s the set up: Use a si…

---

## [Guroubi decides not to apply usercuts during the search?](https://discourse.julialang.org/t/guroubi-decides-not-to-apply-usercuts-during-the-search/12886)

<div class="topic-metadata">

**Author:** [@CBongiova](https://discourse.julialang.org/u/CBongiova)\
**Replies:** 0\
**Last updated:** [August 4, 2018, 8:21am UTC](https://discourse.julialang.org/t/guroubi-decides-not-to-apply-usercuts-during-the-search/12886 "2018-08-04T08:21:27Z")

</div>

\*\* Same question posted on Github at: https://github.com/JuliaOpt/JuMP.jl/issues/1391#issuecomment-410490319 Hello, I have an MILP which I solve through a branch-and-cut procedure (hence using a callback function). I a…

---

## [JuMP 0.18 in julia v0.7](https://discourse.julialang.org/t/jump-0-18-in-julia-v0-7/12897)

<div class="topic-metadata">

**Author:** [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Replies:** 4\
**Last updated:** [August 4, 2018, 9:42pm UTC](https://discourse.julialang.org/t/jump-0-18-in-julia-v0-7/12897 "2018-08-04T21:42:49Z")

</div>

Currently trying to get my head around Julia v0.7. I’m not totally sure whether JuMP 0.18 should work in v0.7 or what the current state is. Getting a bit confused with all the different versions lately (v0.6,v0.7, JuMP …

---

## [MPB Callback for both heuristic solution and lazy constraint](https://discourse.julialang.org/t/mpb-callback-for-both-heuristic-solution-and-lazy-constraint/12815)

<div class="topic-metadata">

**Author:** [@mbesancon](https://discourse.julialang.org/u/mbesancon)\
**Replies:** 1\
**Last updated:** [August 2, 2018, 11:50pm UTC](https://discourse.julialang.org/t/mpb-callback-for-both-heuristic-solution-and-lazy-constraint/12815 "2018-08-02T23:50:21Z")

</div>

Is it possible to have a callback add a heuristic solution and a constraint using MathProgBase? It seemed unclear how to register it in that case, using setlazycallback! or setheuristiccallback!

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

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