# Optimization (Mathematical)

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

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

**Page:** 105

---

## [JuMP nonlinear optimization not converging for camera calibration code](https://discourse.julialang.org/t/jump-nonlinear-optimization-not-converging-for-camera-calibration-code/33565)

<div class="topic-metadata">

**Author:** [@brianguenter](https://discourse.julialang.org/u/brianguenter)\
**Replies:** 2\
**Last updated:** [January 20, 2020, 3:25pm UTC](https://discourse.julialang.org/t/jump-nonlinear-optimization-not-converging-for-camera-calibration-code/33565 "2020-01-20T15:25:21Z")

</div>

I am using JuMP optimization to compute distortion correction parameters in camera images. This is a first step toward a more complete camera calibration package. It’s the first time I’ve used JuMP and the optimization…

---

## [Problem with Mosek](https://discourse.julialang.org/t/problem-with-mosek/33427)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 4\
**Last updated:** [January 16, 2020, 1:51am UTC](https://discourse.julialang.org/t/problem-with-mosek/33427 "2020-01-16T01:51:29Z")

</div>

Dear All, I am trying to solve an SDP using Convex.jl and Mosek. My Mosek version is 9.1.11, and Convex.jl version is 0.12.6. My Julia version is 1.3. I have installed Mosek with an academic license, and it seems to be …

---

## [Barycentric interpolation formula with interval arithmetic](https://discourse.julialang.org/t/barycentric-interpolation-formula-with-interval-arithmetic/33380)

<div class="topic-metadata">

**Author:** [@ArjunNarayanan](https://discourse.julialang.org/u/ArjunNarayanan)\
**Replies:** 0\
**Last updated:** [January 15, 2020, 6:07am UTC](https://discourse.julialang.org/t/barycentric-interpolation-formula-with-interval-arithmetic/33380 "2020-01-15T06:07:16Z")

</div>

Barycentric interpolation is a numerically stable algorithm to evaluate Lagrange interpolating polynomials. An implementation in Julia is available at BarycentricInterpolation.jl. The procedure takes as input a set of n…

---

## [Problem in @NLobjective](https://discourse.julialang.org/t/problem-in-nlobjective/33190)

<div class="topic-metadata">

**Author:** [@GiuliaM](https://discourse.julialang.org/u/GiuliaM)\
**Replies:** 2\
**Last updated:** [January 13, 2020, 10:22am UTC](https://discourse.julialang.org/t/problem-in-nlobjective/33190 "2020-01-13T10:22:00Z")

</div>

Hi everyone! I’m a new Julia user. I am using Julia 1.2 and JuMP v0.20.0 for some optimization problems. I have a constrained nonlinear optimization and I would like to define a nonlinear objective function composed b…

---

## [Need help debugging an NLopt optimization](https://discourse.julialang.org/t/need-help-debugging-an-nlopt-optimization/33229)

<div class="topic-metadata">

**Author:** [@mingjia1025](https://discourse.julialang.org/u/mingjia1025)\
**Replies:** 1\
**Last updated:** [January 11, 2020, 8:01am UTC](https://discourse.julialang.org/t/need-help-debugging-an-nlopt-optimization/33229 "2020-01-11T08:01:48Z")

</div>

I’m trying to use the LD\_MMA algoritmn in NLopt to fit my model. I get Xtol reached after 2 iterations and the values of the variables don’t seem to change from the starting values. Actually when I leave out the xtol re…

---

## [Save objective values in an optimization loop](https://discourse.julialang.org/t/save-objective-values-in-an-optimization-loop/33192)

<div class="topic-metadata">

**Author:** [@yordiak](https://discourse.julialang.org/u/yordiak)\
**Replies:** 2\
**Last updated:** [January 10, 2020, 2:43pm UTC](https://discourse.julialang.org/t/save-objective-values-in-an-optimization-loop/33192 "2020-01-10T14:43:42Z")

</div>

Hello, here is my code using JuMP, Plots, Gurobi m=Model(with\_optimizer(Gurobi.Optimizer)) @variable(m, x\>=0) @variable(m, y\>=0) k=0 obj\_val=true while k\<=1 φ(x,y)=3\*x+k\*y @objective(m, Max, φ(x,y)) …

---

## [Maximum Likelihood Multivariate Model](https://discourse.julialang.org/t/maximum-likelihood-multivariate-model/33156)

<div class="topic-metadata">

**Author:** [@Maximilian](https://discourse.julialang.org/u/Maximilian)\
**Replies:** 15\
**Last updated:** [January 10, 2020, 12:09am UTC](https://discourse.julialang.org/t/maximum-likelihood-multivariate-model/33156 "2020-01-10T00:09:06Z")

</div>

I am trying to optimize a likelihood function for the multivariate case. This is the code I am using using Optim, LinearAlgebra, ForwardDiff #observed covariance cov\_obs = \[1.3629 0.408729 0.581832 0.…

---

## [Stop Julia at certain optimiality gap and return decision variables](https://discourse.julialang.org/t/stop-julia-at-certain-optimiality-gap-and-return-decision-variables/2957)

<div class="topic-metadata">

**Author:** [@Duaa](https://discourse.julialang.org/u/Duaa)\
**Replies:** 12\
**Last updated:** [January 9, 2020, 4:43pm UTC](https://discourse.julialang.org/t/stop-julia-at-certain-optimiality-gap-and-return-decision-variables/2957 "2020-01-09T16:43:04Z")

</div>

I have a MILP problem and I am trying to solve it using CPLEX package through JuMP in Julia Language. However, the problem takes a long time to be solved. Is there a way to stop the program and return decision variables …

---

## [Connection between solver and Julia's JuMP Package](https://discourse.julialang.org/t/connection-between-solver-and-julias-jump-package/33076)

<div class="topic-metadata">

**Author:** [@Josa9321](https://discourse.julialang.org/u/Josa9321)\
**Replies:** 7\
**Last updated:** [January 8, 2020, 11:40pm UTC](https://discourse.julialang.org/t/connection-between-solver-and-julias-jump-package/33076 "2020-01-08T23:40:09Z")

</div>

I’m looking for ways or tips to connect a simple solver with the JuMP Package. I started reading the manual of Math Opt Interface (I don’t know the right terms, but I’ll call it the Backend of the JuMP), also I’m trying …

---

## [Automatic differentiation of f(x) constructed by decomposition of a matrix M(x)](https://discourse.julialang.org/t/automatic-differentiation-of-f-x-constructed-by-decomposition-of-a-matrix-m-x/33061)

<div class="topic-metadata">

**Author:** [@juandarias](https://discourse.julialang.org/u/juandarias)\
**Replies:** 7\
**Last updated:** [January 8, 2020, 5:36pm UTC](https://discourse.julialang.org/t/automatic-differentiation-of-f-x-constructed-by-decomposition-of-a-matrix-m-x/33061 "2020-01-08T17:36:43Z")

</div>

I have some objective function f(x), e.g. some type of error function for which I want to calculate its gradient and hessian. To construct f(x), I need the eigenvectors of a certain matrix \\textbf{M}(x). I have tried bo…

---

## [Plot Optim trace/error convergence](https://discourse.julialang.org/t/plot-optim-trace-error-convergence/32632)

<div class="topic-metadata">

**Author:** [@Andre\_Mello](https://discourse.julialang.org/u/Andre_Mello)\
**Replies:** 9\
**Last updated:** [January 7, 2020, 6:43pm UTC](https://discourse.julialang.org/t/plot-optim-trace-error-convergence/32632 "2020-01-07T18:43:46Z")

</div>

Hi, all. I’m using Optim.jl to solve an optimization problem and I want to plot its trace/error convergence. However I have some issues and I couldn’t find much info on that so far. Just to make things clearer, I want …

---

## [Working efficiently with sparse variables in JuMP](https://discourse.julialang.org/t/working-efficiently-with-sparse-variables-in-jump/32240)

<div class="topic-metadata">

**Author:** [@hellemo](https://discourse.julialang.org/u/hellemo)\
**Replies:** 10\
**Last updated:** [January 7, 2020, 10:12am UTC](https://discourse.julialang.org/t/working-efficiently-with-sparse-variables-in-jump/32240 "2020-01-07T10:12:22Z")

</div>

After using JuMP mostly for smaller, nonlinear problems, I did some testing for larger LP/MILP models, and noticed that one can easily get a performance hit in problem creation when there are many sparse variables (a com…

---

## [sIpopt extension in JuMP?](https://discourse.julialang.org/t/sipopt-extension-in-jump/32899)

<div class="topic-metadata">

**Author:** [@mandart](https://discourse.julialang.org/u/mandart)\
**Replies:** 6\
**Last updated:** [January 6, 2020, 9:29pm UTC](https://discourse.julialang.org/t/sipopt-extension-in-jump/32899 "2020-01-06T21:29:05Z")

</div>

Hi, is there a way to use the sIpopt extension to Ipopt (https://projects.coin-or.org/Ipopt/wiki/sIpopt) within JuMP? I can set up a JuMP model with a call to the AMPL sIpopt executable using AmplNLWriter.jl. However, s…

---

## [Optimization problem](https://discourse.julialang.org/t/optimization-problem/33026)

<div class="topic-metadata">

**Author:** [@Caterina\_Cerutti](https://discourse.julialang.org/u/Caterina_Cerutti)\
**Replies:** 1\
**Last updated:** [January 6, 2020, 4:34pm UTC](https://discourse.julialang.org/t/optimization-problem/33026 "2020-01-06T16:34:10Z")

</div>

EXERCISE: A municipalized company must purchase rubbish bins in an area of the city. There are n types of bins on the market, each characterized by a ci cost and a Ki capacity (i = 1, …, n). M collection points have bee…

---

## [Simplify MINLP problem to speed up results](https://discourse.julialang.org/t/simplify-minlp-problem-to-speed-up-results/32522)

<div class="topic-metadata">

**Author:** [@Hector\_Esteban](https://discourse.julialang.org/u/Hector_Esteban)\
**Replies:** 5\
**Last updated:** [December 26, 2019, 6:41pm UTC](https://discourse.julialang.org/t/simplify-minlp-problem-to-speed-up-results/32522 "2019-12-26T18:41:31Z")

</div>

Hey people, I want to optimize the path of a vehicle consisting on an array/vector of states of the form \[x\_i,y\_i,theta\_i\] and my control inputs are \[kappa\_i,dS\_i\]. As I am dealing with a MINLP problem (MI because I per…

---

## [Libopenspecfun.dll could not be found error](https://discourse.julialang.org/t/libopenspecfun-dll-could-not-be-found-error/32649)

<div class="topic-metadata">

**Author:** [@Xentios](https://discourse.julialang.org/u/Xentios)\
**Replies:** 3\
**Last updated:** [December 26, 2019, 6:38pm UTC](https://discourse.julialang.org/t/libopenspecfun-dll-could-not-be-found-error/32649 "2019-12-26T18:38:03Z")

</div>

ERROR: LoadError: InitError: could not load library “C:\\Users\\Xentios.julia\\artifacts\\e062344a002c2afdfcf57091b975e56fd80de418\\bin\\libopenspecfun.dll” The specified module could not be found. I am using Gurobi with JuM…

---

## [Empty sums in expressions](https://discourse.julialang.org/t/empty-sums-in-expressions/32454)

<div class="topic-metadata">

**Author:** [@waumpel](https://discourse.julialang.org/u/waumpel)\
**Replies:** 2\
**Last updated:** [December 20, 2019, 8:00pm UTC](https://discourse.julialang.org/t/empty-sums-in-expressions/32454 "2019-12-20T20:00:36Z")

</div>

When you create an expression that is an empty sum, it evaluates to Val{false}() instead of 0: model = Model() @expression(model, sum(1 for i in 1:0)) julia\> Val{false}() A similar problem was posted in the GitHub issu…

---

## [\[Example\] Use automatic differentiation to find Lagrange multiplier](https://discourse.julialang.org/t/example-use-automatic-differentiation-to-find-lagrange-multiplier/32476)

<div class="topic-metadata">

**Author:** [@timueh](https://discourse.julialang.org/u/timueh)\
**Replies:** 2\
**Last updated:** [December 19, 2019, 12:11pm UTC](https://discourse.julialang.org/t/example-use-automatic-differentiation-to-find-lagrange-multiplier/32476 "2019-12-19T12:11:25Z")

</div>

Hi there, this post is about a toy example that explores whether and how automatic differentiation (AD) can be used to determine Lagrange multipliers. Setup Take the following toy problem f(\\varepsilon) = \\underset{x\_…

---

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

<div class="topic-metadata">

**Author:** [@edljk](https://discourse.julialang.org/u/edljk)\
**Replies:** 4\
**Last updated:** [December 18, 2019, 3:40pm UTC](https://discourse.julialang.org/t/user-defined-functions-with-large-vector-inputs/32434 "2019-12-18T15:40:39Z")

</div>

JuMP documentation suggest to use splatting for user-defined functions with vector inputs. For medium size data this works pretty well but for large scale vectors I encounter a memory issue: julia\> f(x...) = sum(x\[i\] fo…

---

## [KNITRO 'option\_file' is not working](https://discourse.julialang.org/t/knitro-option-file-is-not-working/32410)

<div class="topic-metadata">

**Author:** [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Replies:** 3\
**Last updated:** [December 18, 2019, 8:32am UTC](https://discourse.julialang.org/t/knitro-option-file-is-not-working/32410 "2019-12-18T08:32:24Z")

</div>

Hi all, I’m trying to pass an option file to KNITRO solver and it gives me the following error: using JuMP, KNITRO m = Model(with\_optimizer(KNITRO.Optimizer, option\_file="knitro.opt")) ERROR: MathOptInterface.Unsuppor…

---

## [How can I significantly improve the speed of this linear programming problem in JuMP?](https://discourse.julialang.org/t/how-can-i-significantly-improve-the-speed-of-this-linear-programming-problem-in-jump/32125)

<div class="topic-metadata">

**Author:** [@zxjroger](https://discourse.julialang.org/u/zxjroger)\
**Replies:** 12\
**Last updated:** [December 15, 2019, 7:34pm UTC](https://discourse.julialang.org/t/how-can-i-significantly-improve-the-speed-of-this-linear-programming-problem-in-jump/32125 "2019-12-15T19:34:11Z")

</div>

I am doing Bayesian estimation in Julia. For each iteration of Bayesian estimation, there is a for-loop to compute the bounds of some variables in my model. Each bound is computed by a linear programming problem. I am tr…

---

## [MIP starts in JuMP - an example](https://discourse.julialang.org/t/mip-starts-in-jump-an-example/32198)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 1\
**Last updated:** [December 12, 2019, 5:27pm UTC](https://discourse.julialang.org/t/mip-starts-in-jump-an-example/32198 "2019-12-12T17:27:19Z")

</div>

Dear all, Could anyone provide a simple example of how can I use MIP starts in integer programming in Julia language? I have a problem and a feasible solution, but I cannot to use this solution inside of the CPLEX. Fo…

---

## [Ifelse statement leads to a length(hess\_I) \> 0 AssertionError](https://discourse.julialang.org/t/ifelse-statement-leads-to-a-length-hess-i-0-assertionerror/32139)

<div class="topic-metadata">

**Author:** [@DanielPompermayer](https://discourse.julialang.org/u/DanielPompermayer)\
**Replies:** 3\
**Last updated:** [December 11, 2019, 9:02pm UTC](https://discourse.julialang.org/t/ifelse-statement-leads-to-a-length-hess-i-0-assertionerror/32139 "2019-12-11T21:02:32Z")

</div>

Hey there, I’m new to JuMP but I need to solve an optimization problem which I am not being able to run. Let’s say I have a circumference with a given radius of 5 and such a circumference is built from the a and b comp…

---

## [Solver-dependent callbacks in JuMP -- How to do it right?](https://discourse.julialang.org/t/solver-dependent-callbacks-in-jump-how-to-do-it-right/32130)

<div class="topic-metadata">

**Author:** [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Replies:** 8\
**Last updated:** [December 11, 2019, 8:21pm UTC](https://discourse.julialang.org/t/solver-dependent-callbacks-in-jump-how-to-do-it-right/32130 "2019-12-11T20:21:11Z")

</div>

Inspired by this answer, I tried to create a small example using the JuMP direct\_model together with solver-specific callbacks. I adapted the knapsack example provided with JuMP to reject solutions using the most efficie…

---

## [Precompiling JuMP and GLPK cause segfaults](https://discourse.julialang.org/t/precompiling-jump-and-glpk-cause-segfaults/31905)

<div class="topic-metadata">

**Author:** [@amca01](https://discourse.julialang.org/u/amca01)\
**Replies:** 4\
**Last updated:** [December 11, 2019, 4:10pm UTC](https://discourse.julialang.org/t/precompiling-jump-and-glpk-cause-segfaults/31905 "2019-12-11T16:10:34Z")

</div>

I’m using Julia 1.2.0. Just now, I tried to install JuMP and GLPK (using Pkg.add), and then tried to use them with using .... The attempt to precompile led to a slew of errors, and a segmentation fault (this is in Linu…

---

## [SolveTime() for Multi-Start options](https://discourse.julialang.org/t/solvetime-for-multi-start-options/32065)

<div class="topic-metadata">

**Author:** [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Replies:** 2\
**Last updated:** [December 11, 2019, 2:42am UTC](https://discourse.julialang.org/t/solvetime-for-multi-start-options/32065 "2019-12-11T02:42:42Z")

</div>

Hi all, Is there a way to call solution time for each starting point of the solver? For example, when an NLP solver (e.g. KNITRO) generates 100 different starting points, you get 100 local optimal values (or infeasibil…

---

## [Unknown error from ForwardDiff](https://discourse.julialang.org/t/unknown-error-from-forwarddiff/32119)

<div class="topic-metadata">

**Author:** [@bdeonovic](https://discourse.julialang.org/u/bdeonovic)\
**Replies:** 1\
**Last updated:** [December 10, 2019, 9:34pm UTC](https://discourse.julialang.org/t/unknown-error-from-forwarddiff/32119 "2019-12-10T21:34:26Z")

</div>

Need some help debugging an error from ForwardDiff. Let me know what additional information would help! ERROR: Stacktrace: \[1\] ≺(::Nothing, ::Type) at C:\\Users\\bdeon\\.julia\\packages\\ForwardDiff\\DVizx\\src\\dual.jl:49 \[…

---

## [Particle Swarm Optimization solver and JuMP?](https://discourse.julialang.org/t/particle-swarm-optimization-solver-and-jump/32025)

<div class="topic-metadata">

**Author:** [@bienpierre](https://discourse.julialang.org/u/bienpierre)\
**Replies:** 2\
**Last updated:** [December 10, 2019, 6:58am UTC](https://discourse.julialang.org/t/particle-swarm-optimization-solver-and-jump/32025 "2019-12-10T06:58:37Z")

</div>

Hello, I would like to solve a non linear optimisation problem which is non smooth. I programmed the problem with JuMP and I tried to solve it with Ipopt solver. However, Ipopt is not able to solve it. I had a look abou…

---

## [Need help with prod() or any custom function with JuMP](https://discourse.julialang.org/t/need-help-with-prod-or-any-custom-function-with-jump/31962)

<div class="topic-metadata">

**Author:** [@Xentios](https://discourse.julialang.org/u/Xentios)\
**Replies:** 7\
**Last updated:** [December 9, 2019, 12:14pm UTC](https://discourse.julialang.org/t/need-help-with-prod-or-any-custom-function-with-jump/31962 "2019-12-09T12:14:36Z")

</div>

All I want is to be able to run an optimization which can use prod() or any custom function i can make. I tried everything normal and NL objectives, constraints vs… Ipopt optimizer does what i want but it does with fl…

---

## [Convex.jl : remarkable increase in perf in dev version (0.13.0) compared to v0.12.6, (now as fast as R/CVXR)](https://discourse.julialang.org/t/convex-jl-remarkable-increase-in-perf-in-dev-version-0-13-0-compared-to-v0-12-6-now-as-fast-as-r-cvxr/31966)

<div class="topic-metadata">

**Author:** [@reumle](https://discourse.julialang.org/u/reumle)\
**Replies:** 1\
**Last updated:** [December 7, 2019, 1:02pm UTC](https://discourse.julialang.org/t/convex-jl-remarkable-increase-in-perf-in-dev-version-0-13-0-compared-to-v0-12-6-now-as-fast-as-r-cvxr/31966 "2019-12-07T13:02:13Z")

</div>

The new version performs magnitudes better than its predecessor on the (simple) benchmark described in Convex.jl (+SCS) more than 100\* slower than R counterpart, CVXR + SCS - #8 by reumle. This enables me to try problem…

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

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