# Optimization (Mathematical)

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

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

**Page:** 72

---

## [Autodifferentiation of a recursive function](https://discourse.julialang.org/t/autodifferentiation-of-a-recursive-function/71972)

<div class="topic-metadata">

**Author:** [@mvsoom](https://discourse.julialang.org/u/mvsoom)\
**Replies:** 27\
**Last updated:** [November 28, 2021, 9:40pm UTC](https://discourse.julialang.org/t/autodifferentiation-of-a-recursive-function/71972 "2021-11-28T21:40:53Z")

</div>

I am interested in wavelets W\_n(t,p) that are generated by convolving a Chebyshev polynomial of the first kind T\_n(x) with a complex sinusoid \\exp(pt): W\_n(t,p) = T\_n(t) \* \\exp(p t) Here n = 0,1,2,\\ldots, t \\in \\mathb…

---

## [Is there a lazy way to create another variable based on the dimensionality of one variable?](https://discourse.julialang.org/t/is-there-a-lazy-way-to-create-another-variable-based-on-the-dimensionality-of-one-variable/72153)

<div class="topic-metadata">

**Author:** [@iiitr](https://discourse.julialang.org/u/iiitr)\
**Replies:** 1\
**Last updated:** [November 27, 2021, 8:12am UTC](https://discourse.julialang.org/t/is-there-a-lazy-way-to-create-another-variable-based-on-the-dimensionality-of-one-variable/72153 "2021-11-27T08:12:07Z")

</div>

Hi all, There are times when I need to create another variable based on the shape of one variable. Since, I don’t know the dimension of the variable. Therefore, I usually write a lot of if-elseif-else-end blocks to dete…

---

## [JuMPChance can not be added](https://discourse.julialang.org/t/jumpchance-can-not-be-added/72151)

<div class="topic-metadata">

**Author:** [@Xuekui\_wang](https://discourse.julialang.org/u/Xuekui_wang)\
**Replies:** 2\
**Last updated:** [November 27, 2021, 7:22am UTC](https://discourse.julialang.org/t/jumpchance-can-not-be-added/72151 "2021-11-27T07:22:51Z")

</div>

When I add JuMPChance, there are some errors: (@v1.6) pkg\> add JuMPChance Resolving package versions... ERROR: Unsatisfiable requirements detected for package JuMP \[4076af6c\]: JuMP \[4076af6c\] log: ├─possible versio…

---

## [Relaxation of MIP to LP, getdual, CPLEX](https://discourse.julialang.org/t/relaxation-of-mip-to-lp-getdual-cplex/1935)

<div class="topic-metadata">

**Author:** [@spuschel](https://discourse.julialang.org/u/spuschel)\
**Replies:** 4\
**Last updated:** [November 27, 2021, 3:44am UTC](https://discourse.julialang.org/t/relaxation-of-mip-to-lp-getdual-cplex/1935 "2021-11-27T03:44:01Z")

</div>

Hi guys. I’ve been reading this forum and the previous one (on Google) and I can’t seem to find an answer (although there are close examples) to my problem. It is about getting dual values out of an MIP. The standard w…

---

## [Integrating MathOptInterface into an industry-scale project (e.g. constraint management)](https://discourse.julialang.org/t/integrating-mathoptinterface-into-an-industry-scale-project-e-g-constraint-management/71943)

<div class="topic-metadata">

**Author:** [@pboes](https://discourse.julialang.org/u/pboes)\
**Replies:** 9\
**Last updated:** [November 25, 2021, 11:15pm UTC](https://discourse.julialang.org/t/integrating-mathoptinterface-into-an-industry-scale-project-e-g-constraint-management/71943 "2021-11-25T23:15:31Z")

</div>

Hi, I have been tasked by my employer to think about a general “Operations Research Framework” that guides future operations research projects, both at the level of project management (how to organise this in an agile w…

---

## [Defining variable model as x != 0 in JuMP](https://discourse.julialang.org/t/defining-variable-model-as-x-0-in-jump/71162)

<div class="topic-metadata">

**Author:** [@sbacelar](https://discourse.julialang.org/u/sbacelar)\
**Replies:** 16\
**Last updated:** [November 24, 2021, 4:44pm UTC](https://discourse.julialang.org/t/defining-variable-model-as-x-0-in-jump/71162 "2021-11-24T16:44:40Z")

</div>

I am trying to run my first example of optimization using JuMP. I have a problem with the definition of the values of x. I want to do x != 0 but it gives me an error. It only works for x \>= 0 or x \<= 0. using JuMP im…

---

## [JuMP @constraint with sparse matrix](https://discourse.julialang.org/t/jump-constraint-with-sparse-matrix/71940)

<div class="topic-metadata">

**Author:** [@Thomas](https://discourse.julialang.org/u/Thomas)\
**Replies:** 4\
**Last updated:** [November 24, 2021, 9:49am UTC](https://discourse.julialang.org/t/jump-constraint-with-sparse-matrix/71940 "2021-11-24T09:49:46Z")

</div>

I want to create PSD constraints with a sparse matrix of AffExpr as in the snippet below (rawdata is a Vector of tuples of the form (I, J, Va, Vs) containing row-col-values information) model = let println("Construc…

---

## [Convert ILP variables to strict integer values in JuMP](https://discourse.julialang.org/t/convert-ilp-variables-to-strict-integer-values-in-jump/71957)

<div class="topic-metadata">

**Author:** [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Replies:** 1\
**Last updated:** [November 23, 2021, 7:50pm UTC](https://discourse.julialang.org/t/convert-ilp-variables-to-strict-integer-values-in-jump/71957 "2021-11-23T19:50:01Z")

</div>

It has often happened that after solving a MILP, my integer or binary variables are getting a value something like 4.237436454375536e-11 or 1.0000000000008162 or even 4.0. In other words even though a variable is meant t…

---

## [Read optimization model files into Julia](https://discourse.julialang.org/t/read-optimization-model-files-into-julia/71851)

<div class="topic-metadata">

**Author:** [@ZHEN\_LIN](https://discourse.julialang.org/u/ZHEN_LIN)\
**Replies:** 7\
**Last updated:** [November 23, 2021, 12:23am UTC](https://discourse.julialang.org/t/read-optimization-model-files-into-julia/71851 "2021-11-23T00:23:40Z")

</div>

I would like to read into Julia some optimization models like the one given in the link below http://qplib.zib.de/QPLIB\_0067.html This is a quadratic optimization problem. It looks like it has formats including gms, lp…

---

## [User-cut with CPLEX](https://discourse.julialang.org/t/user-cut-with-cplex/71490)

<div class="topic-metadata">

**Author:** [@Matheus\_Diogenes\_And](https://discourse.julialang.org/u/Matheus_Diogenes_And)\
**Replies:** 2\
**Last updated:** [November 19, 2021, 4:23am UTC](https://discourse.julialang.org/t/user-cut-with-cplex/71490 "2021-11-19T04:23:28Z")

</div>

Greetings. This thread is related to this one. I am trying to use user-cut with JuMP 0.21.4, Julia 1.6.2, and CPLEX 12.10. Below follows the code I am running. using JuMP, CPLEX model = direct\_model(CPLEX.Optimizer())…

---

## [Results NLP problem](https://discourse.julialang.org/t/results-nlp-problem/71673)

<div class="topic-metadata">

**Author:** [@Francisco\_Javier\_Mar](https://discourse.julialang.org/u/Francisco_Javier_Mar)\
**Replies:** 1\
**Last updated:** [November 17, 2021, 5:49pm UTC](https://discourse.julialang.org/t/results-nlp-problem/71673 "2021-11-17T17:49:58Z")

</div>

Hello. Could you clarify a question for me. I am having certain problems with my mathematical model, this model is non-linear and the ipopt is the solver chosen for the resolution of the problem. My model has its minimum…

---

## [Performance of creating model with many terms](https://discourse.julialang.org/t/performance-of-creating-model-with-many-terms/71623)

<div class="topic-metadata">

**Author:** [@kiranshila](https://discourse.julialang.org/u/kiranshila)\
**Replies:** 3\
**Last updated:** [November 17, 2021, 12:40am UTC](https://discourse.julialang.org/t/performance-of-creating-model-with-many-terms/71623 "2021-11-17T00:40:29Z")

</div>

Hey everyone, I am working on implementing SVMs using JuMP and am running into some performance issues when trying to set up the Dual problem. Specifically, the setup of the objective function is proving to be very cos…

---

## [Memory consumption growth with many large MILP's in JuMP](https://discourse.julialang.org/t/memory-consumption-growth-with-many-large-milps-in-jump/61895)

<div class="topic-metadata">

**Author:** [@nlaws](https://discourse.julialang.org/u/nlaws)\
**Replies:** 63\
**Last updated:** [November 16, 2021, 11:21pm UTC](https://discourse.julialang.org/t/memory-consumption-growth-with-many-large-milps-in-jump/61895 "2021-11-16T23:21:34Z")

</div>

We are running into an issue with JuMP models run in an API that are leading to our servers running out of RAM. Oddly, it does appear that the memory consumption plateaus after some time/iterations. Also, it can be recre…

---

## [Advice on using ModelingToolkit to solve Lagrange Problems](https://discourse.julialang.org/t/advice-on-using-modelingtoolkit-to-solve-lagrange-problems/71473)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 29\
**Last updated:** [November 16, 2021, 7:41pm UTC](https://discourse.julialang.org/t/advice-on-using-modelingtoolkit-to-solve-lagrange-problems/71473 "2021-11-16T19:41:19Z")

</div>

How would I use ModelingToolkit.jl to solve Lagrange problems? I know of the @varable macro, and the @derivative macro, but I’m not sure the purpose of the @parameters macro.

---

## [Nonlinear expression without scalar expressions](https://discourse.julialang.org/t/nonlinear-expression-without-scalar-expressions/71544)

<div class="topic-metadata">

**Author:** [@chupin](https://discourse.julialang.org/u/chupin)\
**Replies:** 2\
**Last updated:** [November 16, 2021, 5:34pm UTC](https://discourse.julialang.org/t/nonlinear-expression-without-scalar-expressions/71544 "2021-11-16T17:34:52Z")

</div>

Hi, I’ve read that nonlinear optimization has limited support. Unfortunately, my objective function cannot be written with scalar expressions and my matrix variable is at least 1000x1000 and I need to call several functi…

---

## [Constraints using a matrix built from external function](https://discourse.julialang.org/t/constraints-using-a-matrix-built-from-external-function/71493)

<div class="topic-metadata">

**Author:** [@chupin](https://discourse.julialang.org/u/chupin)\
**Replies:** 3\
**Last updated:** [November 15, 2021, 9:29pm UTC](https://discourse.julialang.org/t/constraints-using-a-matrix-built-from-external-function/71493 "2021-11-15T21:29:19Z")

</div>

Hi, To build a constraint from a NxM matrix variable (denoted by h), I need to build another NxM matrix so I wrote an external function convexity(h). I tried this syntax (partial code): function convexity(h) …

---

## [Get branch-and-bound node depth with JuMP](https://discourse.julialang.org/t/get-branch-and-bound-node-depth-with-jump/71128)

<div class="topic-metadata">

**Author:** [@Matheus\_Diogenes\_And](https://discourse.julialang.org/u/Matheus_Diogenes_And)\
**Replies:** 12\
**Last updated:** [November 15, 2021, 7:09pm UTC](https://discourse.julialang.org/t/get-branch-and-bound-node-depth-with-jump/71128 "2021-11-15T19:09:36Z")

</div>

Greetings. I am facing a problem with JuMP 0.21.4 and Julia 1.6.2. I am working with an Integer Programming model using CPLEX 12.10 and I using callbacks to add some cuts, however, I need these cuts to be added only whe…

---

## [User defined functions with AmplNLWriter](https://discourse.julialang.org/t/user-defined-functions-with-amplnlwriter/71482)

<div class="topic-metadata">

**Author:** [@ver\_kh](https://discourse.julialang.org/u/ver_kh)\
**Replies:** 1\
**Last updated:** [November 15, 2021, 8:38am UTC](https://discourse.julialang.org/t/user-defined-functions-with-amplnlwriter/71482 "2021-11-15T08:38:28Z")

</div>

Can user-defined functions be used in JuMP model with AmplNLWriter?

---

## [Unable to fix a JuMP variable, when it hasn't been fixed](https://discourse.julialang.org/t/unable-to-fix-a-jump-variable-when-it-hasnt-been-fixed/71477)

<div class="topic-metadata">

**Author:** [@chkwon](https://discourse.julialang.org/u/chkwon)\
**Replies:** 1\
**Last updated:** [November 15, 2021, 4:34am UTC](https://discourse.julialang.org/t/unable-to-fix-a-jump-variable-when-it-hasnt-been-fixed/71477 "2021-11-15T04:34:33Z")

</div>

using JuMP m = Model() @variable(m, z \>= 0) @objective(m, Min, z) @show is\_fixed(z) fix(z, 1) The above code generates: is\_fixed(z) = false ERROR: LoadError: Unable to fix z to 1 because it has existing variable bounds…

---

## [Is optimization parallel?](https://discourse.julialang.org/t/is-optimization-parallel/71454)

<div class="topic-metadata">

**Author:** [@Darel](https://discourse.julialang.org/u/Darel)\
**Replies:** 3\
**Last updated:** [November 14, 2021, 10:54pm UTC](https://discourse.julialang.org/t/is-optimization-parallel/71454 "2021-11-14T22:54:54Z")

</div>

Hello, I’m completely new to Julia and wanted to code a simple optimization problem. For a given sparse matrix A (n,m), find sparse matrix X (m,m), minimizing the following objective: L = 1/2 ||A-AX||^2\_F + beta/2 ||X||…

---

## [Error when installing solvers for JuMP](https://discourse.julialang.org/t/error-when-installing-solvers-for-jump/71114)

<div class="topic-metadata">

**Author:** [@jyscao](https://discourse.julialang.org/u/jyscao)\
**Replies:** 4\
**Last updated:** [November 14, 2021, 6:22pm UTC](https://discourse.julialang.org/t/error-when-installing-solvers-for-jump/71114 "2021-11-14T18:22:56Z")

</div>

When I try to install one of the commonly used solvers like Cbc, Cpl or GLPK, I’d get the error message: dependencies errored. To see a full report either run import Pkg; Pkg.precompile() or load the packages. And when I…

---

## [JuMP 0.22 is released](https://discourse.julialang.org/t/jump-0-22-is-released/71241)

<div class="topic-metadata">

**Author:** [@odow](https://discourse.julialang.org/u/odow)\
**Replies:** 0\
**Last updated:** [November 10, 2021, 4:09am UTC](https://discourse.julialang.org/t/jump-0-22-is-released/71241 "2021-11-10T04:09:00Z")

</div>

Dear all, We’re happy to announce the release of JuMP v0.22 and MathOptInterface v0.10, which completes a major milestone on our path to JuMP v1.0. Indeed, similar to how Julia v1.0 was Julia v0.7 with deprecations rem…

---

## [GalacticOptim with AmplNLWriter optimizer](https://discourse.julialang.org/t/galacticoptim-with-amplnlwriter-optimizer/71137)

<div class="topic-metadata">

**Author:** [@ver\_kh](https://discourse.julialang.org/u/ver_kh)\
**Replies:** 10\
**Last updated:** [November 9, 2021, 1:33am UTC](https://discourse.julialang.org/t/galacticoptim-with-amplnlwriter-optimizer/71137 "2021-11-09T01:33:43Z")

</div>

Hello! I’m trying to use GalacticOptim.jl with AmplNLWriter.jl optimizer but it’s not working. using GalacticOptim, AmplNLWriter, Ipopt\_jll rosenbrock(x,p) = (p\[1\] - x\[1\])^2 + p\[2\] \* (x\[2\] - x\[1\]^2)^2 x0 = zeros(2) …

---

## [Problem in expressing the nonlinear objective](https://discourse.julialang.org/t/problem-in-expressing-the-nonlinear-objective/71127)

<div class="topic-metadata">

**Author:** [@FH96](https://discourse.julialang.org/u/FH96)\
**Replies:** 3\
**Last updated:** [November 8, 2021, 5:50pm UTC](https://discourse.julialang.org/t/problem-in-expressing-the-nonlinear-objective/71127 "2021-11-08T17:50:48Z")

</div>

Hi, I’m trying to express the NLobjective of a problem which is something like this : sum((A\*v\_j -v\_exp)^2) (A is a matrix) I tried different forms and I got error in each case #@NLobjective(model,Min,sum((dot(module\_f…

---

## [Help with global optimizers in NLopt and GalacticOptim](https://discourse.julialang.org/t/help-with-global-optimizers-in-nlopt-and-galacticoptim/71084)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 11\
**Last updated:** [November 8, 2021, 1:29am UTC](https://discourse.julialang.org/t/help-with-global-optimizers-in-nlopt-and-galacticoptim/71084 "2021-11-08T01:29:00Z")

</div>

This is a very simple optimization problem, but for some reason I cannot get NLopt to converge: using GalacticOptim using NLopt rosenbrock(x, p) = (p\[1\] - x\[1\])^2 + p\[2\] \* (x\[2\] - x\[1\]^2)^2 x0 = zeros(2) p = \[1.0, 10…

---

## [Conditional sum in constraint](https://discourse.julialang.org/t/conditional-sum-in-constraint/71100)

<div class="topic-metadata">

**Author:** [@Fabrizio](https://discourse.julialang.org/u/Fabrizio)\
**Replies:** 8\
**Last updated:** [November 7, 2021, 11:53pm UTC](https://discourse.julialang.org/t/conditional-sum-in-constraint/71100 "2021-11-07T23:53:02Z")

</div>

Dear all, the piece of code below works well with Jump until Ver 0.20.6, newer version of JuMP give to to me the error LoadError: KeyError: key (1, 1, 2, 1) not found The BRANCH set is a sparse set indicating the netwo…

---

## [Seeking a smart way to formulate an optimization problem](https://discourse.julialang.org/t/seeking-a-smart-way-to-formulate-an-optimization-problem/71056)

<div class="topic-metadata">

**Author:** [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Replies:** 4\
**Last updated:** [November 6, 2021, 10:12pm UTC](https://discourse.julialang.org/t/seeking-a-smart-way-to-formulate-an-optimization-problem/71056 "2021-11-06T22:12:04Z")

</div>

I recently received tremendous help from this forum in setting up a JuMP optimization problem. I have a similar, but larger problem that I would like to attack, but it is too large to use the same methodology as previou…

---

## [JuMP error for nonlinear optimization](https://discourse.julialang.org/t/jump-error-for-nonlinear-optimization/70983)

<div class="topic-metadata">

**Author:** [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Replies:** 17\
**Last updated:** [November 6, 2021, 2:21am UTC](https://discourse.julialang.org/t/jump-error-for-nonlinear-optimization/70983 "2021-11-06T02:21:25Z")

</div>

I’m trying to set up a nonlinear optimization problem and I’m getting an error I don’t understand… import JuMP as J import Ipopt function smoothabs(x) # Smooth approximation to abs(x) k = 1000 f = 2/k f\*log…

---

## [Set parameters to Gurobi](https://discourse.julialang.org/t/set-parameters-to-gurobi/70794)

<div class="topic-metadata">

**Author:** [@wiz21b](https://discourse.julialang.org/u/wiz21b)\
**Replies:** 4\
**Last updated:** [November 5, 2021, 6:51pm UTC](https://discourse.julialang.org/t/set-parameters-to-gurobi/70794 "2021-11-05T18:51:10Z")

</div>

Hello, I use Gurobi 9.1.2; Julia 1.6.2 and these packages: Gurobi v0.9.14 JuMP v0.21.10 (I’ve seen that the C API has changed) I try to tell Gurobi to use a specific optimizer (the PRIMAL (simplex) one): LP\_model =…

---

## [Namespace problems when running Optim in parallel?](https://discourse.julialang.org/t/namespace-problems-when-running-optim-in-parallel/2275)

<div class="topic-metadata">

**Author:** [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Replies:** 2\
**Last updated:** [November 5, 2021, 10:11am UTC](https://discourse.julialang.org/t/namespace-problems-when-running-optim-in-parallel/2275 "2021-11-05T10:11:33Z")

</div>

Hi, I keep running into errors such as: ERROR: LoadError: On worker 2: MethodError: no method matching minimizer(::Optim.MultivariateOptimizationResults{Float64,1,Optim.NewtonTrustRegion{Float64}}) or, the comical E…

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

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