# Optimization (Mathematical)

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

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

**Page:** 101

---

## [Second order cone constraint in JuMP 0.19 with JuMP solver](https://discourse.julialang.org/t/second-order-cone-constraint-in-jump-0-19-with-jump-solver/37214)

<div class="topic-metadata">

**Author:** [@Chengda\_Ji](https://discourse.julialang.org/u/Chengda_Ji)\
**Replies:** 1\
**Last updated:** [April 8, 2020, 12:18pm UTC](https://discourse.julialang.org/t/second-order-cone-constraint-in-jump-0-19-with-jump-solver/37214 "2020-04-08T12:18:08Z")

</div>

Hi all, When trying to implement the SOCP in JuMP and Mosek, the Mosek solver stalls and SLOW\_PROGRESS JuMP status show up. After checking the results, I notice that it is not feasible, and the upper bounds are depresse…

---

## [Affine expression in objective function](https://discourse.julialang.org/t/affine-expression-in-objective-function/37108)

<div class="topic-metadata">

**Author:** [@bandaya](https://discourse.julialang.org/u/bandaya)\
**Replies:** 9\
**Last updated:** [April 7, 2020, 3:34pm UTC](https://discourse.julialang.org/t/affine-expression-in-objective-function/37108 "2020-04-07T15:34:07Z")

</div>

Hi, In a linear programming problem, I am trying to optimize a constraint, essentially replacing the objective function with LHS of the constraint to minimize. The error from JuMP suggests that it does not support affine…

---

## [Visualizing Newton-Raphson](https://discourse.julialang.org/t/visualizing-newton-raphson/37164)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 3\
**Last updated:** [April 7, 2020, 3:33pm UTC](https://discourse.julialang.org/t/visualizing-newton-raphson/37164 "2020-04-07T15:33:47Z")

</div>

I’ve been studying the Newton-Raphson algorithm and coded up a simple example to show some of its shortcomings with particular functions. I’m posting here simply to share with the community and, as always, I welcome feed…

---

## [Improving performance for SDPs with "matrix trace constraints"](https://discourse.julialang.org/t/improving-performance-for-sdps-with-matrix-trace-constraints/37172)

<div class="topic-metadata">

**Author:** [@martincornejo](https://discourse.julialang.org/u/martincornejo)\
**Replies:** 1\
**Last updated:** [April 7, 2020, 2:56pm UTC](https://discourse.julialang.org/t/improving-performance-for-sdps-with-matrix-trace-constraints/37172 "2020-04-07T14:56:35Z")

</div>

I’ve been working on an SDP model with (among other variables) a hermitian variable W of dimensions n x n. Although it would be nice to have support for complex variables in JuMP, a simple workaround is to declare 2 matr…

---

## [JuMP 0.18: how to delete constraints (without reference)?](https://discourse.julialang.org/t/jump-0-18-how-to-delete-constraints-without-reference/37175)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 2\
**Last updated:** [April 7, 2020, 2:56pm UTC](https://discourse.julialang.org/t/jump-0-18-how-to-delete-constraints-without-reference/37175 "2020-04-07T14:56:11Z")

</div>

Dear folks, I like to solve the root relaxation of a MILP manually, meaning that I treat the problem as an LP while dynamically adding cutting planes and resolve until no violated cuts are found. I’d like to get rid of …

---

## [Method Error using round on JuMP Variable](https://discourse.julialang.org/t/method-error-using-round-on-jump-variable/37136)

<div class="topic-metadata">

**Author:** [@Cyrus\_the\_man](https://discourse.julialang.org/u/Cyrus_the_man)\
**Replies:** 1\
**Last updated:** [April 7, 2020, 1:15am UTC](https://discourse.julialang.org/t/method-error-using-round-on-jump-variable/37136 "2020-04-07T01:15:37Z")

</div>

MethodError: no method matching round(::Type{Int64}, ::GenericAffExpr{Float64,VariableRef}) I’m using Julia 1.3.1 on Jupyter Notebooks and have encountered a method error using an Ipop solver. Within dynamic constraint…

---

## [Use Roots.Brent() in fzero Roots.jl](https://discourse.julialang.org/t/use-roots-brent-in-fzero-roots-jl/37126)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 3\
**Last updated:** [April 7, 2020, 12:00am UTC](https://discourse.julialang.org/t/use-roots-brent-in-fzero-roots-jl/37126 "2020-04-07T00:00:26Z")

</div>

Hello, I would like to use the method Brent-Dekker in Roots.jl without using the find\_zero wrapper since I will only do one run of root-finding for the function of interest. fzero seems to be the way to go, but I don’t …

---

## [Solving an optimal control problem with JuMP](https://discourse.julialang.org/t/solving-an-optimal-control-problem-with-jump/36570)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 16\
**Last updated:** [March 28, 2020, 4:50pm UTC](https://discourse.julialang.org/t/solving-an-optimal-control-problem-with-jump/36570 "2020-03-28T16:50:55Z")

</div>

I am trying to solve an optimal control problem using JuMP. My problem involves a set of ODEs and an objective function that needs the final conditions of the solution of the ODEs. The input on which I want to optimize …

---

## [@constraint macro vs autodiff vs provide gradient](https://discourse.julialang.org/t/constraint-macro-vs-autodiff-vs-provide-gradient/37073)

<div class="topic-metadata">

**Author:** [@ramon.abritta](https://discourse.julialang.org/u/ramon.abritta)\
**Replies:** 2\
**Last updated:** [April 5, 2020, 11:56pm UTC](https://discourse.julialang.org/t/constraint-macro-vs-autodiff-vs-provide-gradient/37073 "2020-04-05T23:56:28Z")

</div>

Hello, I have been using Julia for about 3 weeks. A lot still to learn. In my optimization problem, I need as much speed as possible (using Grey Wolf Optimizer with many NLP calls). I am aware that, as mentioned in JuM…

---

## [Supressing verbosity of dual Models (JuMP, Dualization and Mosek)](https://discourse.julialang.org/t/supressing-verbosity-of-dual-models-jump-dualization-and-mosek/37065)

<div class="topic-metadata">

**Author:** [@martincornejo](https://discourse.julialang.org/u/martincornejo)\
**Replies:** 2\
**Last updated:** [April 5, 2020, 7:25pm UTC](https://discourse.julialang.org/t/supressing-verbosity-of-dual-models-jump-dualization-and-mosek/37065 "2020-04-05T19:25:33Z")

</div>

I have tried multiple methods to silence the verbosity of “dualized Mosek”. (Currently using JuMP v0.20.2 and Dualization v0.2.2) julia\> model = Model(with\_optimizer(() -\> Dualization.DualOptimizer(Mosek.Optimizer()))) …

---

## [Check if a solver supports VariablePrimalStart](https://discourse.julialang.org/t/check-if-a-solver-supports-variableprimalstart/37015)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 1\
**Last updated:** [April 4, 2020, 9:32pm UTC](https://discourse.julialang.org/t/check-if-a-solver-supports-variableprimalstart/37015 "2020-04-04T21:32:49Z")

</div>

Is there a way to check if a solver supports MOI.VariablePrimalStart? Something like this: MOI.supports(JuMP.backend(m), MOI.VariablePrimalStart) but it seems that I’m missing something:

---

## [Does someone have experience in Augmented Lagrangian in julia?](https://discourse.julialang.org/t/does-someone-have-experience-in-augmented-lagrangian-in-julia/36872)

<div class="topic-metadata">

**Author:** [@Markus\_Hauschel](https://discourse.julialang.org/u/Markus_Hauschel)\
**Replies:** 12\
**Last updated:** [April 3, 2020, 2:23pm UTC](https://discourse.julialang.org/t/does-someone-have-experience-in-augmented-lagrangian-in-julia/36872 "2020-04-03T14:23:10Z")

</div>

It seems that most of the posts, I can find, are old. My code is currently in R and I think about porting to Julia. Does it work well?

---

## [How to use Julia to create Golden section search](https://discourse.julialang.org/t/how-to-use-julia-to-create-golden-section-search/36916)

<div class="topic-metadata">

**Author:** [@11129](https://discourse.julialang.org/u/11129)\
**Replies:** 5\
**Last updated:** [April 3, 2020, 5:22am UTC](https://discourse.julialang.org/t/how-to-use-julia-to-create-golden-section-search/36916 "2020-04-03T05:22:39Z")

</div>

How to use code to reach the Golden section search.

---

## [Best way of checking whether a polyhedron contains an integral point](https://discourse.julialang.org/t/best-way-of-checking-whether-a-polyhedron-contains-an-integral-point/36766)

<div class="topic-metadata">

**Author:** [@python15](https://discourse.julialang.org/u/python15)\
**Replies:** 8\
**Last updated:** [April 2, 2020, 6:57pm UTC](https://discourse.julialang.org/t/best-way-of-checking-whether-a-polyhedron-contains-an-integral-point/36766 "2020-04-02T18:57:41Z")

</div>

Hey! I’m quite new to Julia and try to solve the following problem efficiently: For a given bounded polyhedron (by the linear equations Ax = 0 and bounds on x), I have to check whether it contains a non-negative integr…

---

## [Optim.jl - How to find local maxima of multivariate function](https://discourse.julialang.org/t/optim-jl-how-to-find-local-maxima-of-multivariate-function/36853)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 3\
**Last updated:** [April 1, 2020, 4:21pm UTC](https://discourse.julialang.org/t/optim-jl-how-to-find-local-maxima-of-multivariate-function/36853 "2020-04-01T16:21:56Z")

</div>

Pardon my ignorance (if you’ve seen any recent posts of mine you’ll know I’ve been studying calculus lately) but I’m trying to understand how to find local maxima of a multivariate function with Optim.jl. Given the follo…

---

## [Number of constraints](https://discourse.julialang.org/t/number-of-constraints/36798)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 1\
**Last updated:** [March 31, 2020, 7:59pm UTC](https://discourse.julialang.org/t/number-of-constraints/36798 "2020-03-31T19:59:57Z")

</div>

Dear all, The command num\_constraints() can determine the number of equality constraints in a given model? How can I find this?

---

## [Procedural Nonlinear Constaint Generation - String to NLconstraint](https://discourse.julialang.org/t/procedural-nonlinear-constaint-generation-string-to-nlconstraint/34799)

<div class="topic-metadata">

**Author:** [@r-b0](https://discourse.julialang.org/u/r-b0)\
**Replies:** 9\
**Last updated:** [March 30, 2020, 1:53am UTC](https://discourse.julialang.org/t/procedural-nonlinear-constaint-generation-string-to-nlconstraint/34799 "2020-03-30T01:53:29Z")

</div>

I am implementing a large scale nonlinear program solver using the JuMP interface to IPOPT. The Nonlinear Modeling section of JuMP v0.21.0 documentation clearly explicates that all expressions used in NLconstraint and N…

---

## [Solving an optimal control problem with Optim.jl](https://discourse.julialang.org/t/solving-an-optimal-control-problem-with-optim-jl/36635)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 4\
**Last updated:** [March 28, 2020, 2:17pm UTC](https://discourse.julialang.org/t/solving-an-optimal-control-problem-with-optim-jl/36635 "2020-03-28T14:17:57Z")

</div>

I am trying to solve an optimal control problem in Julia. I tried using NLOptControl.jl and JuMP.jl but ran into some difficulties. See this post. Therefore I am trying to use Optim.jl as an optimizer. Since my optimiza…

---

## [Bug when using DSDP versus SCS optimiser with JuMP](https://discourse.julialang.org/t/bug-when-using-dsdp-versus-scs-optimiser-with-jump/36554)

<div class="topic-metadata">

**Author:** [@tdp](https://discourse.julialang.org/u/tdp)\
**Replies:** 2\
**Last updated:** [March 28, 2020, 8:30am UTC](https://discourse.julialang.org/t/bug-when-using-dsdp-versus-scs-optimiser-with-jump/36554 "2020-03-28T08:30:04Z")

</div>

Hi, How do I resolve the error below generated when I run my code using the DSDP optimiser? I get the right answer, without errors, when I run my code using the SCS optimiser instead. (This question is a follow-up to t…

---

## [Installing Ipopt](https://discourse.julialang.org/t/installing-ipopt/35608)

<div class="topic-metadata">

**Author:** [@varun\_yaramasu](https://discourse.julialang.org/u/varun_yaramasu)\
**Replies:** 8\
**Last updated:** [March 27, 2020, 4:46pm UTC](https://discourse.julialang.org/t/installing-ipopt/35608 "2020-03-27T16:46:58Z")

</div>

julia\> Pkg.build("Ipopt") Building CodecZlib ─→ \`C:\\Users\\yaramasv\\.juliapro\\JuliaPro\_v1.3.1-1\\packages\\CodecZlib\\5t9zO\\deps\\build.log\` Building MbedTLS ───→ \`C:\\Users\\yaramasv\\.juliapro\\JuliaPro\_v1.3.1-1\\packages\\…

---

## [Point Julia to Cbc built from source](https://discourse.julialang.org/t/point-julia-to-cbc-built-from-source/36516)

<div class="topic-metadata">

**Author:** [@joshuastowell25](https://discourse.julialang.org/u/joshuastowell25)\
**Replies:** 5\
**Last updated:** [March 27, 2020, 3:30pm UTC](https://discourse.julialang.org/t/point-julia-to-cbc-built-from-source/36516 "2020-03-27T15:30:57Z")

</div>

Hello All, I am trying to get JuMP and Cbc to use multithreading. Turns out that in order to do this you have to build Cbc from source with the --enable-cbc-parallel option. I have followed the cbc build instructions i…

---

## [Convert model with anonymous variables to "readable" form](https://discourse.julialang.org/t/convert-model-with-anonymous-variables-to-readable-form/36594)

<div class="topic-metadata">

**Author:** [@richard046](https://discourse.julialang.org/u/richard046)\
**Replies:** 5\
**Last updated:** [March 27, 2020, 2:29pm UTC](https://discourse.julialang.org/t/convert-model-with-anonymous-variables-to-readable-form/36594 "2020-03-27T14:29:34Z")

</div>

Hello, I have a code(written by others) that builds a JuMP model, but I can’t see what are the constraints, becouse it has \_\_anon\_\_ variables, like this: Min \_\_anon\_\_ + \_\_anon\_\_ Subject to \_\_anon\_\_ - \_\_anon\_\_ == 0.5 …

---

## [Potential bug on relative gap calculation](https://discourse.julialang.org/t/potential-bug-on-relative-gap-calculation/36323)

<div class="topic-metadata">

**Author:** [@Diego](https://discourse.julialang.org/u/Diego)\
**Replies:** 3\
**Last updated:** [March 27, 2020, 2:54am UTC](https://discourse.julialang.org/t/potential-bug-on-relative-gap-calculation/36323 "2020-03-27T02:54:09Z")

</div>

Whatever the MIP tolerance I get the relative mip gap is always zero. I am using: MOI.get(model, MOI.RelativeGap()) JuMP v"0.20.1" Xpress v"0.10.0" Seems to be an issue either in JuMP or in Xpress

---

## [Scalar product in objective](https://discourse.julialang.org/t/scalar-product-in-objective/36550)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 1\
**Last updated:** [March 26, 2020, 1:43pm UTC](https://discourse.julialang.org/t/scalar-product-in-objective/36550 "2020-03-26T13:43:51Z")

</div>

I’ll illustrate the problem with the following simple example: import JuMP l = ones(4) model= JuMP.Model() JuMP.@variable(model, x) JuMP.@variable(model, y1) JuMP.@variable(model, y2) epxr = \[ JuMP.@expression(model…

---

## [Dispatching on the type of a constraint or variable](https://discourse.julialang.org/t/dispatching-on-the-type-of-a-constraint-or-variable/36524)

<div class="topic-metadata">

**Author:** [@gleyland](https://discourse.julialang.org/u/gleyland)\
**Replies:** 2\
**Last updated:** [March 26, 2020, 6:51am UTC](https://discourse.julialang.org/t/dispatching-on-the-type-of-a-constraint-or-variable/36524 "2020-03-26T06:51:54Z")

</div>

Hi, How do I write a function signature such that I can dispatch on whether an argument is a variable or a constraint? I’d like to do this: function f(x::TypeOfVariable) ... end function f(x::TypeOfConstraint) ... end…

---

## [Performance MIPstart](https://discourse.julialang.org/t/performance-mipstart/36464)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 2\
**Last updated:** [March 25, 2020, 12:59pm UTC](https://discourse.julialang.org/t/performance-mipstart/36464 "2020-03-25T12:59:21Z")

</div>

I’ll share an experience. I have a mixed linear optimization problem. When I use a feasibre solution (MIPstart), sometimes CPLEX performs worse than if I let it determine an incumbent solution automatically. Sometimes…

---

## [Save optimum variables](https://discourse.julialang.org/t/save-optimum-variables/36405)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 3\
**Last updated:** [March 23, 2020, 11:46pm UTC](https://discourse.julialang.org/t/save-optimum-variables/36405 "2020-03-23T23:46:50Z")

</div>

Dear all, I have the following optimization problem implemented: using JuMP, CPLEX, Printf n=50 function Problem(c) modelo = Model(with\_optimizer(CPLEX.Optimizer)) (n, n) = size(c) @variable(modelo, x\[1:n…

---

## [Optimality gap of Global solver in NLopt](https://discourse.julialang.org/t/optimality-gap-of-global-solver-in-nlopt/36144)

<div class="topic-metadata">

**Author:** [@ahmadreza-marandi](https://discourse.julialang.org/u/ahmadreza-marandi)\
**Replies:** 11\
**Last updated:** [March 23, 2020, 12:07pm UTC](https://discourse.julialang.org/t/optimality-gap-of-global-solver-in-nlopt/36144 "2020-03-23T12:07:37Z")

</div>

Hi all, I have an extremely hard NLP that I want to solve via @NLopt. I can get the code running but there is no output unless the algorithm gets terminated. Now I have two questions: Is it possible to extract the opt…

---

## [Modify/reasign objective function of a model in JuMP](https://discourse.julialang.org/t/modify-reasign-objective-function-of-a-model-in-jump/36363)

<div class="topic-metadata">

**Author:** [@martincornejo](https://discourse.julialang.org/u/martincornejo)\
**Replies:** 1\
**Last updated:** [March 22, 2020, 9:19pm UTC](https://discourse.julialang.org/t/modify-reasign-objective-function-of-a-model-in-jump/36363 "2020-03-22T21:19:53Z")

</div>

I’m implementing a consensus ADMM model, and for that I wold like to iteratively solve two models, exchange information between them and solve them again with a modified objective function. The problem I’m facing right …

---

## [JuMP Multiple Models Design Question](https://discourse.julialang.org/t/jump-multiple-models-design-question/36230)

<div class="topic-metadata">

**Author:** [@torgo](https://discourse.julialang.org/u/torgo)\
**Replies:** 5\
**Last updated:** [March 22, 2020, 12:26am UTC](https://discourse.julialang.org/t/jump-multiple-models-design-question/36230 "2020-03-22T00:26:35Z")

</div>

What is the rationale behind throwing an error in this? using JuMP m1 = Model() @variable(m1, x \>= 0) m2 = Model() @variable(m2, x \>= 0) @objective(m1, Min, x) # this will error w/ variable not owned gives ERROR: L…

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

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