# Optimization (Mathematical)

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

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

**Page:** 14

---

## [Using Second-Order Cone Constraints with Logarithms in JuMP and Gurobi's C API](https://discourse.julialang.org/t/using-second-order-cone-constraints-with-logarithms-in-jump-and-gurobis-c-api/125769)

<div class="topic-metadata">

**Author:** [@Beyza\_Aydin](https://discourse.julialang.org/u/Beyza_Aydin)\
**Replies:** 7\
**Last updated:** [February 24, 2025, 7:47pm UTC](https://discourse.julialang.org/t/using-second-order-cone-constraints-with-logarithms-in-jump-and-gurobis-c-api/125769 "2025-02-24T19:47:28Z")

</div>

Hello, I am using JuMP with the Gurobi optimizer to solve a problem involving both second-order cone constraints and logarithmic constraints. I want to model the constraint ||x||\_1 \>= K\*||x||\_2 which I coded as: const…

---

## [Save JuMP Model to File](https://discourse.julialang.org/t/save-jump-model-to-file/126220)

<div class="topic-metadata">

**Author:** [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Replies:** 2\
**Last updated:** [February 23, 2025, 8:38pm UTC](https://discourse.julialang.org/t/save-jump-model-to-file/126220 "2025-02-23T20:38:07Z")

</div>

I want to save a JuMP model to a .MPS file without appending .MPS to the filename in the second argument to write\_to\_file, .i.e. not using write\_to\_file(model,"test.MPS"). The approach below does not work. julia\> usi…

---

## [Constraints of type MathOptInterface.ScalarNonlinearFunction-in-MathOptInterface.LessThan{Float64} are not supported by the solver](https://discourse.julialang.org/t/constraints-of-type-mathoptinterface-scalarnonlinearfunction-in-mathoptinterface-lessthan-float64-are-not-supported-by-the-solver/126178)

<div class="topic-metadata">

**Author:** [@leonie25](https://discourse.julialang.org/u/leonie25)\
**Replies:** 7\
**Last updated:** [February 23, 2025, 4:20am UTC](https://discourse.julialang.org/t/constraints-of-type-mathoptinterface-scalarnonlinearfunction-in-mathoptinterface-lessthan-float64-are-not-supported-by-the-solver/126178 "2025-02-23T04:20:46Z")

</div>

I am working on an optimization problem and build a model using Gurobi Optimizer with JuMP. It has some nonlinear constraints: @constraint(model, f\[i\] + func(qe\[i\])\<= M1 \* (1 - x\[(i, j)\]) + f\[j\]) where f, qe, x are non…

---

## [JuMP: declaring a vector of PSD matrices](https://discourse.julialang.org/t/jump-declaring-a-vector-of-psd-matrices/126179)

<div class="topic-metadata">

**Author:** [@healyp](https://discourse.julialang.org/u/healyp)\
**Replies:** 1\
**Last updated:** [February 22, 2025, 6:48pm UTC](https://discourse.julialang.org/t/jump-declaring-a-vector-of-psd-matrices/126179 "2025-02-22T18:48:47Z")

</div>

in JuMP it’s very straightforward to declare a PSD matrix variable. If S \\succeq 0, I can simply say @variable(m, S\[1:4,1:4\], PSD) But if I now want a set, or vector, of them, like, S\_i \\succeq 0, i \\in \[1,\\ldots,k\] I…

---

## [MultiObjectiveAlgorithms.jl (skipping infeasible solutions)](https://discourse.julialang.org/t/multiobjectivealgorithms-jl-skipping-infeasible-solutions/126003)

<div class="topic-metadata">

**Author:** [@saikrishna-nadella](https://discourse.julialang.org/u/saikrishna-nadella)\
**Replies:** 9\
**Last updated:** [February 19, 2025, 4:32pm UTC](https://discourse.julialang.org/t/multiobjectivealgorithms-jl-skipping-infeasible-solutions/126003 "2025-02-19T16:32:16Z")

</div>

Hi, I am using MultiObjectiveAlgorithms.jl with EpsilonConstraint method. When a small number of SolutionLimit is used, it went well and pareto front could be obtained. But, when I increase SolutionLimit to higher value…

---

## [ExaModels optimizer API for JuMP has convergence issue](https://discourse.julialang.org/t/examodels-optimizer-api-for-jump-has-convergence-issue/126032)

<div class="topic-metadata">

**Author:** [@KSepetanc](https://discourse.julialang.org/u/KSepetanc)\
**Replies:** 5\
**Last updated:** [February 19, 2025, 12:30am UTC](https://discourse.julialang.org/t/examodels-optimizer-api-for-jump-has-convergence-issue/126032 "2025-02-19T00:30:18Z")

</div>

It is my understanding that convergence should not depend on selection of AD package. I have tested many AD options on the same model and only one option has different convergence (number of iterations and reported value…

---

## [Difficulty in using JuMP with Complex Functions](https://discourse.julialang.org/t/difficulty-in-using-jump-with-complex-functions/126045)

<div class="topic-metadata">

**Author:** [@MechRob](https://discourse.julialang.org/u/MechRob)\
**Replies:** 3\
**Last updated:** [February 18, 2025, 11:42pm UTC](https://discourse.julialang.org/t/difficulty-in-using-jump-with-complex-functions/126045 "2025-02-18T23:42:04Z")

</div>

I am trying to create an optimization problem with JuMP. In order to create the constraints I have a function, which I generated its elements with Symbolics. When I pass numerical values, I can calculate the terms in ten…

---

## [Where NLPModels.jl stands in comparition to JuMP?](https://discourse.julialang.org/t/where-nlpmodels-jl-stands-in-comparition-to-jump/126033)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [February 18, 2025, 3:32pm UTC](https://discourse.julialang.org/t/where-nlpmodels-jl-stands-in-comparition-to-jump/126033 "2025-02-18T15:32:56Z")

</div>

I have just discovered NLPModels.jl. How does it stand compared to JuMP ? I even understood there is a package to translate one “model format” (??) to the other, but I don’t have quite clear how the two packages positio…

---

## [OR-Tools for JuMP](https://discourse.julialang.org/t/or-tools-for-jump/106171)

<div class="topic-metadata">

**Author:** [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Replies:** 6\
**Last updated:** [February 18, 2025, 7:04am UTC](https://discourse.julialang.org/t/or-tools-for-jump/106171 "2025-02-18T07:04:54Z")

</div>

Are there plans to add the solvers in OR-Tools to JuMP? OR-Tools has 2 LP solvers, PDLP and GLOP, and a constraint programming solver, CP-SAT, which solves integer linear programs (no continuous variables) and more gener…

---

## [Issue parsing Ipopt\_jll string option when there is blank space in path](https://discourse.julialang.org/t/issue-parsing-ipopt-jll-string-option-when-there-is-blank-space-in-path/125943)

<div class="topic-metadata">

**Author:** [@KSepetanc](https://discourse.julialang.org/u/KSepetanc)\
**Replies:** 4\
**Last updated:** [February 17, 2025, 6:48pm UTC](https://discourse.julialang.org/t/issue-parsing-ipopt-jll-string-option-when-there-is-blank-space-in-path/125943 "2025-02-17T18:48:14Z")

</div>

The following code does not work when called from path that has blank space. using JuMP, AmplNLWriter, Ipopt\_jll mod = Model(() -\> AmplNLWriter.Optimizer(Ipopt\_jll.amplexe)) set\_attribute(mod, "output\_file", joinpath(@…

---

## [Optim.jl and runtime dispatch detected errors](https://discourse.julialang.org/t/optim-jl-and-runtime-dispatch-detected-errors/125981)

<div class="topic-metadata">

**Author:** [@Miroboru](https://discourse.julialang.org/u/Miroboru)\
**Replies:** 1\
**Last updated:** [February 17, 2025, 6:36pm UTC](https://discourse.julialang.org/t/optim-jl-and-runtime-dispatch-detected-errors/125981 "2025-02-17T18:36:23Z")

</div>

I have a piece of simulation software that makes millions of calls to Optim.optimize during runs. I seemingly have a lot of allocations, so I use JET and tested my code with @report\_opt. The result was a large number of …

---

## [Macro to substitute parameters used for JuMP model](https://discourse.julialang.org/t/macro-to-substitute-parameters-used-for-jump-model/125936)

<div class="topic-metadata">

**Author:** [@KSepetanc](https://discourse.julialang.org/u/KSepetanc)\
**Replies:** 2\
**Last updated:** [February 16, 2025, 11:27pm UTC](https://discourse.julialang.org/t/macro-to-substitute-parameters-used-for-jump-model/125936 "2025-02-16T23:27:24Z")

</div>

I read available topics on macros but still can not make working macro to substitute parameter. What I want is instead of creating new variable (for example Pmax) to use @Pmax macro that will expand @Pmax(g) to data\[:gen…

---

## [\[DICE: GAMS -\> JuMP\] How to debug JuMP model errors (find the culpit)?](https://discourse.julialang.org/t/dice-gams-jump-how-to-debug-jump-model-errors-find-the-culpit/125578)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 6\
**Last updated:** [February 15, 2025, 4:15pm UTC](https://discourse.julialang.org/t/dice-gams-jump-how-to-debug-jump-model-errors-find-the-culpit/125578 "2025-02-15T16:15:00Z")

</div>

Hello, this post il dual :slight\_smile: It’s at the same time a request for help for a specific case, but also a much more general question. I am trying to port the Nordhaus’s DICE climate change model v2023 to Julia, …

---

## [Some thoughts and questions on smooth non-linear optimization, degrees of freedom, optimizers, MLPs](https://discourse.julialang.org/t/some-thoughts-and-questions-on-smooth-non-linear-optimization-degrees-of-freedom-optimizers-mlps/125892)

<div class="topic-metadata">

**Author:** [@BdeKoning](https://discourse.julialang.org/u/BdeKoning)\
**Replies:** 0\
**Last updated:** [February 14, 2025, 7:02am UTC](https://discourse.julialang.org/t/some-thoughts-and-questions-on-smooth-non-linear-optimization-degrees-of-freedom-optimizers-mlps/125892 "2025-02-14T07:02:43Z")

</div>

Although I’d like to pose my thoughts and questions on a quite general group of optimization problems, my thoughts on these topics came from working on the following optimization problem: The second lens surface is a…

---

## [JuMP-dev 2025](https://discourse.julialang.org/t/jump-dev-2025/121176)

<div class="topic-metadata">

**Author:** [@odow](https://discourse.julialang.org/u/odow)\
**Replies:** 2\
**Last updated:** [February 13, 2025, 7:22pm UTC](https://discourse.julialang.org/t/jump-dev-2025/121176 "2025-02-13T19:22:02Z")

</div>

Dear all, We are pleased to announce that JuMP-dev 2025 will take place November 17-20, 2025 in Auckland, New Zealand. If you’ve ever wanted a conference excuse for a summer holiday in Aotearoa New Zealand, now is y…

---

## [Choosing between Symmetric and Hermitian programmatically in JuMP](https://discourse.julialang.org/t/choosing-between-symmetric-and-hermitian-programmatically-in-jump/125701)

<div class="topic-metadata">

**Author:** [@araujoms](https://discourse.julialang.org/u/araujoms)\
**Replies:** 9\
**Last updated:** [February 9, 2025, 8:55pm UTC](https://discourse.julialang.org/t/choosing-between-symmetric-and-hermitian-programmatically-in-jump/125701 "2025-02-09T20:55:17Z")

</div>

I want to switch between Symmetric and Hermitian variables depending on the input data. For data I’d like to define a variable a, that can be either and then create the variable, e.g. a = Symmetric model = Model() @vari…

---

## [Nonlinear System of Equations with Bounds/Constraints on Unknowns](https://discourse.julialang.org/t/nonlinear-system-of-equations-with-bounds-constraints-on-unknowns/37257)

<div class="topic-metadata">

**Author:** [@bielim](https://discourse.julialang.org/u/bielim)\
**Replies:** 30\
**Last updated:** [February 8, 2025, 6:12am UTC](https://discourse.julialang.org/t/nonlinear-system-of-equations-with-bounds-constraints-on-unknowns/37257 "2025-02-08T06:12:25Z")

</div>

I am trying to find a numerical solution to the following nonlinear system of equations: M\_1 - w\_1 θ\_1 α\_1 - w\_2 θ\_2 α\_2 = 0 M\_2 - w\_1 θ\_1^2 (α\_1+1) α\_1 - w\_2 θ\_2^2 (α\_2+1) α\_2 = 0 M\_3 - w\_1 θ\_1^3 (α\_1+2) (α\_1+1) α\_1 …

---

## [Selection of Mosek Optimizer in JuMP not respected](https://discourse.julialang.org/t/selection-of-mosek-optimizer-in-jump-not-respected/125623)

<div class="topic-metadata">

**Author:** [@saikrishna-nadella](https://discourse.julialang.org/u/saikrishna-nadella)\
**Replies:** 6\
**Last updated:** [February 7, 2025, 8:35pm UTC](https://discourse.julialang.org/t/selection-of-mosek-optimizer-in-jump-not-respected/125623 "2025-02-07T20:35:38Z")

</div>

Hi, I am using MosekTools with JuMP. I have been facing problem in forcing solver attributes to Mosek. for example, following seems to work set\_attribute(myModel, “MSK\_IPAR\_PRESOLVE\_USE”, 0) but, following does not w…

---

## [JuMP & Ipopt: failed to converge solution for standard Rosenbrock](https://discourse.julialang.org/t/jump-ipopt-failed-to-converge-solution-for-standard-rosenbrock/125533)

<div class="topic-metadata">

**Author:** [@GY3090](https://discourse.julialang.org/u/GY3090)\
**Replies:** 3\
**Last updated:** [February 7, 2025, 7:58am UTC](https://discourse.julialang.org/t/jump-ipopt-failed-to-converge-solution-for-standard-rosenbrock/125533 "2025-02-07T07:58:54Z")

</div>

Hi everyone, I am new to Julia (and programming in general). I encountered an error while using JuMP and Ipopt to solve unconstrained maximization for a standard Rosenbrock function. It reports that “EXIT: Optimal Soluti…

---

## [Trouble with Optimization.jl errors](https://discourse.julialang.org/t/trouble-with-optimization-jl-errors/125410)

<div class="topic-metadata">

**Author:** [@Bill\_Holmes](https://discourse.julialang.org/u/Bill_Holmes)\
**Replies:** 2\
**Last updated:** [February 6, 2025, 3:46am UTC](https://discourse.julialang.org/t/trouble-with-optimization-jl-errors/125410 "2025-02-06T03:46:24Z")

</div>

Hello all. I’m running into an issue with Optimization.jl when trying to estimate parameters of ODEs. The specific issue is that some optimizers work while others don’t. Furthermore, different optimizers throw different …

---

## [Best practice for constraints with initial condition "exception"](https://discourse.julialang.org/t/best-practice-for-constraints-with-initial-condition-exception/125522)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [February 4, 2025, 7:42pm UTC](https://discourse.julialang.org/t/best-practice-for-constraints-with-initial-condition-exception/125522 "2025-02-04T19:42:02Z")

</div>

While translating the DICE model from GAMS code to JuMP I come up with situations where I have different constraints for initial values and following ones. This for exampe works: @constraint(m, mres0, RES0\[1\] == res00)…

---

## [Resuming a run by writing and reading back LP file](https://discourse.julialang.org/t/resuming-a-run-by-writing-and-reading-back-lp-file/125449)

<div class="topic-metadata">

**Author:** [@saikrishna-nadella](https://discourse.julialang.org/u/saikrishna-nadella)\
**Replies:** 5\
**Last updated:** [February 4, 2025, 6:10pm UTC](https://discourse.julialang.org/t/resuming-a-run-by-writing-and-reading-back-lp-file/125449 "2025-02-04T18:10:26Z")

</div>

I am implementing bender’s decomposition using JuMP in Julia. Feasibility cuts are added to the master problem continuously until the subproblem is feasible for the candidate solution of master problem. The run takes too…

---

## [Order of initial values for set\_start\_value in JuMP/Ipopt models](https://discourse.julialang.org/t/order-of-initial-values-for-set-start-value-in-jump-ipopt-models/125511)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 2\
**Last updated:** [February 4, 2025, 12:55am UTC](https://discourse.julialang.org/t/order-of-initial-values-for-set-start-value-in-jump-ipopt-models/125511 "2025-02-04T00:55:35Z")

</div>

I am optimizing a model in Jump with IPOPT. The model has T x 6 variables: a1\_t, a2\_t...a6\_t with t = 1...T When defining initial values using the function, set\_start\_value.(all\_variables(model), initial\_values) The ex…

---

## [Forwarding a macro that returns a variable?](https://discourse.julialang.org/t/forwarding-a-macro-that-returns-a-variable/125508)

<div class="topic-metadata">

**Author:** [@brunompacheco](https://discourse.julialang.org/u/brunompacheco)\
**Replies:** 5\
**Last updated:** [February 4, 2025, 12:19am UTC](https://discourse.julialang.org/t/forwarding-a-macro-that-returns-a-variable/125508 "2025-02-04T00:19:42Z")

</div>

I am trying to forward the @variable macro from JuMP, so that instead of passing a model to it, I pass my custom struct that has a model as a field. I was able to do it when the new macro is declared locally: using JuMP…

---

## [Restrictions when adding a binary variable - Local Infeasibility (Ipopt, Juniper)](https://discourse.julialang.org/t/restrictions-when-adding-a-binary-variable-local-infeasibility-ipopt-juniper/121870)

<div class="topic-metadata">

**Author:** [@fynnhoffmann54](https://discourse.julialang.org/u/fynnhoffmann54)\
**Replies:** 15\
**Last updated:** [January 23, 2025, 8:27am UTC](https://discourse.julialang.org/t/restrictions-when-adding-a-binary-variable-local-infeasibility-ipopt-juniper/121870 "2025-01-23T08:27:21Z")

</div>

Hello, I am trying to model a nonlinear optimization problem involving binary variables and continuous variables. Specifically, I cannot understand why a binary variable “z\_sys\_to\_HP(s)” makes the model unusable. My mo…

---

## [\`Zygote.gradient\` is 54000 TIMES slower than \`jax.gradient\`](https://discourse.julialang.org/t/zygote-gradient-is-54000-times-slower-than-jax-gradient/125396)

<div class="topic-metadata">

**Author:** [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Replies:** 80\
**Last updated:** [February 1, 2025, 9:25pm UTC](https://discourse.julialang.org/t/zygote-gradient-is-54000-times-slower-than-jax-gradient/125396 "2025-02-01T21:25:46Z")

</div>

I’m almost unable to compute ant gradients (EDIT 9 hrs later: meant to say “any gradients”, but got gradients for ants) in Zygote. I initially attempted to optimize my model using around a million parameters, but it got …

---

## [Model building is slow when adding a large number of constraints, but the model necessitates a certain type of refrencing of constraints](https://discourse.julialang.org/t/model-building-is-slow-when-adding-a-large-number-of-constraints-but-the-model-necessitates-a-certain-type-of-refrencing-of-constraints/125424)

<div class="topic-metadata">

**Author:** [@MarkusGabl](https://discourse.julialang.org/u/MarkusGabl)\
**Replies:** 4\
**Last updated:** [February 1, 2025, 4:55am UTC](https://discourse.julialang.org/t/model-building-is-slow-when-adding-a-large-number-of-constraints-but-the-model-necessitates-a-certain-type-of-refrencing-of-constraints/125424 "2025-02-01T04:55:42Z")

</div>

Hi there JuMP-Crew Given a symmetric matrix Q and the all ones matrix E and a set of vectors v\_1,…,v\_n called “Vertex\_Set” and a set of two-tuples of these vectors (or rather their indices) called “Inclusion\_Set”, I wa…

---

## [Solving MCP with PathSolver with indexing](https://discourse.julialang.org/t/solving-mcp-with-pathsolver-with-indexing/124488)

<div class="topic-metadata">

**Author:** [@jmc](https://discourse.julialang.org/u/jmc)\
**Replies:** 31\
**Last updated:** [January 31, 2025, 7:23pm UTC](https://discourse.julialang.org/t/solving-mcp-with-pathsolver-with-indexing/124488 "2025-01-31T19:23:36Z")

</div>

Hello, I am trying to solve an MCP that requires performing operations across some indices. Here is a MWE: using JuMP using Random using LinearAlgebra using BenchmarkTools using JuMP import PATHSolver PATHSolver.c\_ap…

---

## [Return inequality direction for normalized constraint](https://discourse.julialang.org/t/return-inequality-direction-for-normalized-constraint/125356)

<div class="topic-metadata">

**Author:** [@karlzhu](https://discourse.julialang.org/u/karlzhu)\
**Replies:** 2\
**Last updated:** [January 29, 2025, 9:08pm UTC](https://discourse.julialang.org/t/return-inequality-direction-for-normalized-constraint/125356 "2025-01-29T21:08:06Z")

</div>

I’m implementing something from a paper that assumes I have an LP of the following form: So for each constraint i in my specific model I need to figure out what the vectors u\_i, g\_i and element b\_i are. I’m able to g…

---

## [Why using JuMP or AMPL gives different number of nonzeros in Lagrangian Hessian?](https://discourse.julialang.org/t/why-using-jump-or-ampl-gives-different-number-of-nonzeros-in-lagrangian-hessian/125259)

<div class="topic-metadata">

**Author:** [@slmontes](https://discourse.julialang.org/u/slmontes)\
**Replies:** 4\
**Last updated:** [January 28, 2025, 1:39pm UTC](https://discourse.julialang.org/t/why-using-jump-or-ampl-gives-different-number-of-nonzeros-in-lagrangian-hessian/125259 "2025-01-28T13:39:09Z")

</div>

Hello, I was comparing NLP optimization between JuMP and AMPL and noticed that even when the problems are identical and the presolve option is turned off in AMPL, the number of nonzeros in Lagrangian Hessian varies. Th…

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

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