# Optimization (Mathematical)

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

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

**Page:** 112

---

## [Robust or global multivariate rootfinder](https://discourse.julialang.org/t/robust-or-global-multivariate-rootfinder/23169)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 8\
**Last updated:** [April 16, 2019, 3:31pm UTC](https://discourse.julialang.org/t/robust-or-global-multivariate-rootfinder/23169 "2019-04-16T15:31:10Z")

</div>

I have a function in about 3–7 variables (varies, ideally 7) and I am looking for a root. It is best to treat the function as a “black box”, just delivering values and not derivatives, though I will try to make it work …

---

## [JuMP: use AD within a JuMP model to define a derivative-based constraint](https://discourse.julialang.org/t/jump-use-ad-within-a-jump-model-to-define-a-derivative-based-constraint/23085)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 0\
**Last updated:** [April 12, 2019, 4:27pm UTC](https://discourse.julialang.org/t/jump-use-ad-within-a-jump-model-to-define-a-derivative-based-constraint/23085 "2019-04-12T16:27:14Z")

</div>

I have a JuMP (v0.18.5) model with nonlinear constraints, and I’m trying to encode a new constraint which depends on the Jacobian of the nonlinear constraints. As an example, consider the simpler case of solving a linea…

---

## [Optim.jl - No default objective type for IPNewton](https://discourse.julialang.org/t/optim-jl-no-default-objective-type-for-ipnewton/23036)

<div class="topic-metadata">

**Author:** [@ferrolho](https://discourse.julialang.org/u/ferrolho)\
**Replies:** 5\
**Last updated:** [April 12, 2019, 10:19am UTC](https://discourse.julialang.org/t/optim-jl-no-default-objective-type-for-ipnewton/23036 "2019-04-12T10:19:46Z")

</div>

Please consider the following code snippet using Optim.jl: using Optim dof = 7 fun(x) = 0.0; x0 = fill(0.1, dof) df = TwiceDifferentiable(fun, x0) lx = fill(-1.2, dof); ux = fill(+1.2, dof) dfc = TwiceDifferentiableC…

---

## [SDP trace minimization with affine constraints: help to formulate the problem](https://discourse.julialang.org/t/sdp-trace-minimization-with-affine-constraints-help-to-formulate-the-problem/22505)

<div class="topic-metadata">

**Author:** [@dapz](https://discourse.julialang.org/u/dapz)\
**Replies:** 7\
**Last updated:** [April 10, 2019, 8:35am UTC](https://discourse.julialang.org/t/sdp-trace-minimization-with-affine-constraints-help-to-formulate-the-problem/22505 "2019-04-10T08:35:12Z")

</div>

Hi, I need to solve the following convex optimization problem: min\_{X}\\quad tr(X) s.t. A(X)=b and X semi-definite positive, where A computes rank-1 projections: A(X)=\[\<aᵢaᵢᵀ,X\>\]\_{i=1}^n. However I never really used op…

---

## [Quadratic Programming Problem - CPL](https://discourse.julialang.org/t/quadratic-programming-problem-cpl/21068)

<div class="topic-metadata">

**Author:** [@Rajat\_Sanyal](https://discourse.julialang.org/u/Rajat_Sanyal)\
**Replies:** 9\
**Last updated:** [April 10, 2019, 4:39pm UTC](https://discourse.julialang.org/t/quadratic-programming-problem-cpl/21068 "2019-04-10T16:39:30Z")

</div>

I am trying to solve a convex QP. Let us consider the following example: using JuMP, CPLEX m = Model(with\_optimizer(CPLEX.Optimizer)) @variable(m,x\[1:5\],lower\_bound=0) A = rand(5,5).\*2 .- 1 c = rand(5,1) A = A'\*A @objec…

---

## [Define a variable in two ranges](https://discourse.julialang.org/t/define-a-variable-in-two-ranges/22959)

<div class="topic-metadata">

**Author:** [@muriloasouza](https://discourse.julialang.org/u/muriloasouza)\
**Replies:** 2\
**Last updated:** [April 10, 2019, 12:00pm UTC](https://discourse.julialang.org/t/define-a-variable-in-two-ranges/22959 "2019-04-10T12:00:24Z")

</div>

Is there anyway i can define a JuMP variable in two different ranges? Say the first range is between 3:6 and the second one between 9:12.

---

## [How to define a single anonymous binary variable in JuMP 0.19](https://discourse.julialang.org/t/how-to-define-a-single-anonymous-binary-variable-in-jump-0-19/22966)

<div class="topic-metadata">

**Author:** [@daschw](https://discourse.julialang.org/u/daschw)\
**Replies:** 2\
**Last updated:** [April 9, 2019, 6:40pm UTC](https://discourse.julialang.org/t/how-to-define-a-single-anonymous-binary-variable-in-jump-0-19/22966 "2019-04-09T18:40:00Z")

</div>

Until JuMP 0.18 I was able to do using JuMP m = Model() x = @variable(m, category = :Bin) With 0.19 I get: julia\> using JuMP julia\> m = Model() A JuMP Model Feasibility problem with: Variables: 0 Model mode: AUTOMATI…

---

## [writeLP in JuMP 0.19?](https://discourse.julialang.org/t/writelp-in-jump-0-19/22955)

<div class="topic-metadata">

**Author:** [@mposs](https://discourse.julialang.org/u/mposs)\
**Replies:** 1\
**Last updated:** [April 9, 2019, 1:49pm UTC](https://discourse.julialang.org/t/writelp-in-jump-0-19/22955 "2019-04-09T13:49:16Z")

</div>

Hello Is there an equivalent to writeLP in the new version of JuMP? I need to print a MILP in proper format (e.g., lp or mps) Best, Michael.

---

## [Continuous relative/absolute residual](https://discourse.julialang.org/t/continuous-relative-absolute-residual/22949)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 9\
**Last updated:** [April 9, 2019, 1:33pm UTC](https://discourse.julialang.org/t/continuous-relative-absolute-residual/22949 "2019-04-09T13:33:03Z")

</div>

This is, strictly speaking, not a Julia but a math question, but I am running into this with AD and optimization. I am solving a parametric system f(x, \\theta) = g(x, \\theta) for x given \\theta. I could implement thi…

---

## [Steps to create additional table on matrix](https://discourse.julialang.org/t/steps-to-create-additional-table-on-matrix/22834)

<div class="topic-metadata">

**Author:** [@WILSON\_MASIH](https://discourse.julialang.org/u/WILSON_MASIH)\
**Replies:** 4\
**Last updated:** [April 6, 2019, 8:57pm UTC](https://discourse.julialang.org/t/steps-to-create-additional-table-on-matrix/22834 "2019-04-06T20:57:47Z")

</div>

A=zeros(5,5) # it represent 5x5 matrix having 0 number for i in 1:5 for j in 1:5 A\[i,j\]=i+j # square bracket for indices.as indices start from 1 end end A output :5x5 Array 2.0 3.0 4.0 5.0 6.0 3.0 4…

---

## [How to get value of a Dict() after optimization in Julia 1.1.0](https://discourse.julialang.org/t/how-to-get-value-of-a-dict-after-optimization-in-julia-1-1-0/22617)

<div class="topic-metadata">

**Author:** [@yan25y](https://discourse.julialang.org/u/yan25y)\
**Replies:** 4\
**Last updated:** [April 6, 2019, 3:30pm UTC](https://discourse.julialang.org/t/how-to-get-value-of-a-dict-after-optimization-in-julia-1-1-0/22617 "2019-04-06T15:30:28Z")

</div>

I’m using JuMP to solve an optimization problem using Julia 1.1.0. I expressed my variable in dictionary form so I can see which variable gets picked. When I do the optimization on my Mac, I’m able to see the result usin…

---

## [LU Factorizations in julia](https://discourse.julialang.org/t/lu-factorizations-in-julia/22819)

<div class="topic-metadata">

**Author:** [@WILSON\_MASIH](https://discourse.julialang.org/u/WILSON_MASIH)\
**Replies:** 3\
**Last updated:** [April 6, 2019, 5:54am UTC](https://discourse.julialang.org/t/lu-factorizations-in-julia/22819 "2019-04-06T05:54:42Z")

</div>

PA=LU Alu=lu(A) A\\b=Alu\\b det(A)=det(Alu)

---

## [Constant objective function is not supported on JuMP 0.19?](https://discourse.julialang.org/t/constant-objective-function-is-not-supported-on-jump-0-19/22775)

<div class="topic-metadata">

**Author:** [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Replies:** 3\
**Last updated:** [April 5, 2019, 6:15pm UTC](https://discourse.julialang.org/t/constant-objective-function-is-not-supported-on-jump-0-19/22775 "2019-04-05T18:15:05Z")

</div>

Good evening! I have set my objective function as a constant to check if the constraints set is feasible and JuMP returns an error. It seems like JuMP does not allow constant objective functions. Here is an example. u…

---

## [Error JuMP in Julia version 0.7](https://discourse.julialang.org/t/error-jump-in-julia-version-0-7/22804)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 1\
**Last updated:** [April 5, 2019, 4:45pm UTC](https://discourse.julialang.org/t/error-jump-in-julia-version-0-7/22804 "2019-04-05T16:45:12Z")

</div>

Hello Users, I don’t know that happened, but Julia don’t recognize the Package JuMP. When I run “using JuMP” the the errors appears: julia\> Pkg.add(“JuMP”) WARNING: Base.Pkg is deprecated, run using Pkg instead in …

---

## [Julia vs R vs Python: simple MLE problem](https://discourse.julialang.org/t/julia-vs-r-vs-python-simple-mle-problem/9012)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 43\
**Last updated:** [April 5, 2019, 3:55pm UTC](https://discourse.julialang.org/t/julia-vs-r-vs-python-simple-mle-problem/9012 "2019-04-05T15:55:00Z")

</div>

This is the draft of my new post (https://www.codementor.io/zhuojiadai/draft/gnqi4njro) on Julia vs R vs Python on a simple MLE problem. Unfortunately, Julia comes out slightly worse due to long compilation times. Welco…

---

## [Mosek w/ multiple bound SecondOrderCones](https://discourse.julialang.org/t/mosek-w-multiple-bound-secondordercones/22777)

<div class="topic-metadata">

**Author:** [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Replies:** 3\
**Last updated:** [April 5, 2019, 10:23am UTC](https://discourse.julialang.org/t/mosek-w-multiple-bound-secondordercones/22777 "2019-04-05T10:23:24Z")

</div>

Good evening! I have ‘multiple bound set’ issue regarding SecondOrderCone constraints with Mosek. (JuMP 0.19 / Mosek v8.1.0.80 ) using JuMP, Mosek, MosekTools, SCS m = Model(with\_optimizer(Mosek.Optimizer)) @variables…

---

## [Solving a binary quadratic problem in CPLEX](https://discourse.julialang.org/t/solving-a-binary-quadratic-problem-in-cplex/22771)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 3\
**Last updated:** [April 5, 2019, 3:31am UTC](https://discourse.julialang.org/t/solving-a-binary-quadratic-problem-in-cplex/22771 "2019-04-05T03:31:34Z")

</div>

Hello colleagues, I have the code: m = Model(with\_optimizer(CPLEX.Optimizer, CPX\_PARAM\_TILIM=1800,CPX\_PARAM\_SCRIND=0,CPX\_PARAM\_EPGAP=0.01)) @variables m begin x\[i in 1:5\] \>=3, Int end @objective(m,Min,sum(x\[i\]^2 fo…

---

## [Getting Gap and #Nodes in JuMP v0.19](https://discourse.julialang.org/t/getting-gap-and-nodes-in-jump-v0-19/22566)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 4\
**Last updated:** [March 31, 2019, 9:12pm UTC](https://discourse.julialang.org/t/getting-gap-and-nodes-in-jump-v0-19/22566 "2019-03-31T21:12:11Z")

</div>

Dear users, I have tried to use the command GAP = MOI.get(model, MOI.RelativeGap()) Nodes = MOI.get(modelo, MOI.NodeCount()) to obtain the relative GAP of my solution. Some colleagues in this group helped me, but thi…

---

## [Query Solution Time](https://discourse.julialang.org/t/query-solution-time/22263)

<div class="topic-metadata">

**Author:** [@octavia9](https://discourse.julialang.org/u/octavia9)\
**Replies:** 9\
**Last updated:** [March 31, 2019, 9:09pm UTC](https://discourse.julialang.org/t/query-solution-time/22263 "2019-03-31T21:09:28Z")

</div>

Hello, I am very new to Julia and JuMP. I am using CPLEX 12.8 together with my optimization problem. Instead of using self-defined time function to capture the total time spent in the optimization process, is there a d…

---

## [GAP and CPUTime in JuMP v0.19](https://discourse.julialang.org/t/gap-and-cputime-in-jump-v0-19/22521)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 5\
**Last updated:** [March 31, 2019, 5:29pm UTC](https://discourse.julialang.org/t/gap-and-cputime-in-jump-v0-19/22521 "2019-03-31T17:29:39Z")

</div>

Dear users, I begin to use the JuMP v0.19 today. Some functions in previous versions were implemented, for example getobjvalue(model) and getsolvetime(model). But, this commands are not working in this version! Pleas…

---

## [Infeasible integer - solution CPLEX](https://discourse.julialang.org/t/infeasible-integer-solution-cplex/22502)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 5\
**Last updated:** [March 29, 2019, 6:57pm UTC](https://discourse.julialang.org/t/infeasible-integer-solution-cplex/22502 "2019-03-29T18:57:34Z")

</div>

Hello Julia’s users, I have a little question. I am solving a complex integer problem using CPLEX. Many times, a long computation time does not provide an integer feasible solution. If I limit the CPU time (for exampl…

---

## [Pardiso linear solver with Ipopt](https://discourse.julialang.org/t/pardiso-linear-solver-with-ipopt/6417)

<div class="topic-metadata">

**Author:** [@JackDevine](https://discourse.julialang.org/u/JackDevine)\
**Replies:** 6\
**Last updated:** [March 29, 2019, 2:52pm UTC](https://discourse.julialang.org/t/pardiso-linear-solver-with-ipopt/6417 "2019-03-29T14:52:27Z")

</div>

I have installed Pardiso 5.0 and I have gotten it to work with Pardiso.jl by following the instructions in the README. When I try getting Ipopt.jl to work with PARDISO by following the steps in this issue, I run into pro…

---

## [JuMP/cplex: setting array of variables to zero (in one shot), in heuristic callback](https://discourse.julialang.org/t/jump-cplex-setting-array-of-variables-to-zero-in-one-shot-in-heuristic-callback/22462)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 0\
**Last updated:** [March 28, 2019, 3:02pm UTC](https://discourse.julialang.org/t/jump-cplex-setting-array-of-variables-to-zero-in-one-shot-in-heuristic-callback/22462 "2019-03-28T15:02:21Z")

</div>

Dear community, I use JuMP 0.18.5 together with CPLEX 0.4.4 and want to set new solution values in a heuristic callback. I have a quite nasty array of variables julia\>model\[:x\] x\[w,i,t\] ∈ {0,1} ∀ w ∈ {1,2,…,19,20}, i …

---

## [Trying to use another solver with Ipopt.jl besides Mumps](https://discourse.julialang.org/t/trying-to-use-another-solver-with-ipopt-jl-besides-mumps/22426)

<div class="topic-metadata">

**Author:** [@pedrohvbsilva](https://discourse.julialang.org/u/pedrohvbsilva)\
**Replies:** 0\
**Last updated:** [March 27, 2019, 6:56pm UTC](https://discourse.julialang.org/t/trying-to-use-another-solver-with-ipopt-jl-besides-mumps/22426 "2019-03-27T18:56:29Z")

</div>

I’ve been trying to use Pardiso as linear solver in one of my programs, i have a academic license of Pardiso, and try to put de libpardiso.dll, in Ipopt.jl package dir. I’m using Julia 1.1.0, JuMP v0.19 and Windows 10. m…

---

## [Numerical Accuracy of the Solver](https://discourse.julialang.org/t/numerical-accuracy-of-the-solver/22297)

<div class="topic-metadata">

**Author:** [@Rajat\_Sanyal](https://discourse.julialang.org/u/Rajat_Sanyal)\
**Replies:** 6\
**Last updated:** [March 27, 2019, 12:43pm UTC](https://discourse.julialang.org/t/numerical-accuracy-of-the-solver/22297 "2019-03-27T12:43:02Z")

</div>

I am solving a MIP problem using CPLEX solver. I have the following constraint: x \\geq x\_{\\min}y, where x is a non-negative variable and y is a binary variable. Let us consider x\_{\\min} = 20, but I am getting the optima…

---

## [Initial guess in MINLP](https://discourse.julialang.org/t/initial-guess-in-minlp/22223)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 4\
**Last updated:** [March 24, 2019, 4:59pm UTC](https://discourse.julialang.org/t/initial-guess-in-minlp/22223 "2019-03-24T16:59:00Z")

</div>

Hello, Something strange happens with my program. using JuMP, Ipopt, CPLEX, Juniper m = Model(solver=juniper) @variable(m, x, start = 0.0) @variable(m, y, start = 0.0) @NLobjective(m, Min, sin((1-5x))^2 + 100(cos(y…

---

## [Basic usage of MultiJuMP](https://discourse.julialang.org/t/basic-usage-of-multijump/21542)

<div class="topic-metadata">

**Author:** [@orhan\_abar](https://discourse.julialang.org/u/orhan_abar)\
**Replies:** 2\
**Last updated:** [March 23, 2019, 10:52pm UTC](https://discourse.julialang.org/t/basic-usage-of-multijump/21542 "2019-03-23T22:52:09Z")

</div>

I am planning to start working on multi objective optimization and found MultiJuMP. But the example on the read me page is throwing an error. It looks like it doesn’t recognize the main function of the optimization. Does…

---

## [Deleting containerized constraints](https://discourse.julialang.org/t/deleting-containerized-constraints/21971)

<div class="topic-metadata">

**Author:** [@Di11on](https://discourse.julialang.org/u/Di11on)\
**Replies:** 13\
**Last updated:** [March 22, 2019, 4:50pm UTC](https://discourse.julialang.org/t/deleting-containerized-constraints/21971 "2019-03-22T16:50:12Z")

</div>

Hi folks, I am translating an electricity production cost model from GAMS to JuMP and am struggling to get reasonable model generation times. Generally these models consist of running 365 single-day optimisations to run…

---

## [SOS1 variables are not supported](https://discourse.julialang.org/t/sos1-variables-are-not-supported/22012)

<div class="topic-metadata">

**Author:** [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Replies:** 5\
**Last updated:** [March 21, 2019, 9:40pm UTC](https://discourse.julialang.org/t/sos1-variables-are-not-supported/22012 "2019-03-21T21:40:06Z")

</div>

I’m trying to build a SOS1 constraint using JuMP MOI (with Gurobi, CPLEX, Mosek). m = Model(with\_optimizer(Mosek.Optimizer)) @variable(m, x\[1:3\]) @constraint(m, x in MOI.SOS1(\[1, 2, 3\])) But it gives me an error saying…

---

## [Generate nonlinear expressions in an explicit loop](https://discourse.julialang.org/t/generate-nonlinear-expressions-in-an-explicit-loop/20447)

<div class="topic-metadata">

**Author:** [@ncostilla](https://discourse.julialang.org/u/ncostilla)\
**Replies:** 1\
**Last updated:** [March 21, 2019, 3:09pm UTC](https://discourse.julialang.org/t/generate-nonlinear-expressions-in-an-explicit-loop/20447 "2019-03-21T15:09:06Z")

</div>

I want to generate nonlinear expressions in an explicit loop. I know You can iterate over constraints and store references like in the next example: @variable(m, x\[1:5\] \>= 0) @constraintref myCons\[1:5\] for i = 1:5 myC…

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

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