# Optimization (Mathematical)

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

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

**Page:** 30

---

## [\`using JuMP\` reports an ERROR](https://discourse.julialang.org/t/using-jump-reports-an-error/111700)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 4\
**Last updated:** [March 17, 2024, 8:16pm UTC](https://discourse.julialang.org/t/using-jump-reports-an-error/111700 "2024-03-17T20:16:34Z")

</div>

It reports an ERROR when I using JuMP (version: JuMP v1.20.0): \[ Info: Precompiling JuMP \[4076af6c-e467-56ae-b986-b466b2749572\] ERROR: LoadError: ArgumentError: Package JuMP does not have SnoopPrecompile in its dependen…

---

## [How to create an user-function?](https://discourse.julialang.org/t/how-to-create-an-user-function/111702)

<div class="topic-metadata">

**Author:** [@Coral](https://discourse.julialang.org/u/Coral)\
**Replies:** 1\
**Last updated:** [March 17, 2024, 8:13pm UTC](https://discourse.julialang.org/t/how-to-create-an-user-function/111702 "2024-03-17T20:13:50Z")

</div>

Hello everyone, I am trying to do a trajectory optimization using Julia. To begin to familiarize myself with the environment I have tried to implement a simpler problem such as maximizing the height of ascent of a rocke…

---

## [Fail to precompiling JuMP](https://discourse.julialang.org/t/fail-to-precompiling-jump/111618)

<div class="topic-metadata">

**Author:** [@Kaiming\_Zhang](https://discourse.julialang.org/u/Kaiming_Zhang)\
**Replies:** 3\
**Last updated:** [March 17, 2024, 6:31pm UTC](https://discourse.julialang.org/t/fail-to-precompiling-jump/111618 "2024-03-17T18:31:37Z")

</div>

I’m using these packages: using JuMP, Distributions, MathProgBase, Ipopt, JuMPChance using Gurobi \[ Info: Precompiling JuMP \[4076af6c-e467-56ae-b986-b466b2749572\] ERROR: LoadError: UndefVarError: \`Grisu\` not defined…

---

## [Nonlinear Optimization with Many Constraints + Autodifferentiation: Which Julia Solution?](https://discourse.julialang.org/t/nonlinear-optimization-with-many-constraints-autodifferentiation-which-julia-solution/110678)

<div class="topic-metadata">

**Author:** [@SebKrantz](https://discourse.julialang.org/u/SebKrantz)\
**Replies:** 23\
**Last updated:** [March 15, 2024, 6:42pm UTC](https://discourse.julialang.org/t/nonlinear-optimization-with-many-constraints-autodifferentiation-which-julia-solution/110678 "2024-03-15T18:42:18Z")

</div>

I’m trying to rewrite a Matlab Package in Julia which solves a high-dimensional non-linear optimal transport problem in order to maximize economic welfare as predicted by a linked quantiative trade model. In particular, …

---

## [Use of integer variables Juniper Error (MI-NLP)](https://discourse.julialang.org/t/use-of-integer-variables-juniper-error-mi-nlp/111454)

<div class="topic-metadata">

**Author:** [@Erlendgh](https://discourse.julialang.org/u/Erlendgh)\
**Replies:** 2\
**Last updated:** [March 14, 2024, 10:40am UTC](https://discourse.julialang.org/t/use-of-integer-variables-juniper-error-mi-nlp/111454 "2024-03-14T10:40:16Z")

</div>

Hi, I’m trying to solve an optimization problem (MI-NLP) where I want certain variables to be integer values. I have tried to get a bunch of different packages/solver to work and landed on Juniper. My code works fine wh…

---

## [Setting WorkLimit for Gurobi.jl and JuMP](https://discourse.julialang.org/t/setting-worklimit-for-gurobi-jl-and-jump/111370)

<div class="topic-metadata">

**Author:** [@YuriS](https://discourse.julialang.org/u/YuriS)\
**Replies:** 5\
**Last updated:** [March 13, 2024, 6:07pm UTC](https://discourse.julialang.org/t/setting-worklimit-for-gurobi-jl-and-jump/111370 "2024-03-13T18:07:26Z")

</div>

Hi! I am solving a large instance MILP using Gurobi, and I am trying to set the WorkLimit parameter (see: https://www.gurobi.com/documentation/current/refman/worklimit.html) instead of setting a TimeLimit, but I am stru…

---

## [How to implement hermite-simpson collocation method?](https://discourse.julialang.org/t/how-to-implement-hermite-simpson-collocation-method/111448)

<div class="topic-metadata">

**Author:** [@Coral](https://discourse.julialang.org/u/Coral)\
**Replies:** 7\
**Last updated:** [March 13, 2024, 10:55am UTC](https://discourse.julialang.org/t/how-to-implement-hermite-simpson-collocation-method/111448 "2024-03-13T10:55:09Z")

</div>

Hello everyone. I am trying to do a trajectory optimization using Hermite-Simpson collocation method. I want to know if in the package jump or in other package exist a function call hermite-simpson or if i have to creat…

---

## [Convex.jl for SDP](https://discourse.julialang.org/t/convex-jl-for-sdp/111474)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 2\
**Last updated:** [March 12, 2024, 4:01am UTC](https://discourse.julialang.org/t/convex-jl-for-sdp/111474 "2024-03-12T04:01:56Z")

</div>

I am trying to follow up \[1, Example 1\]. This involves semidefinite programming described in Corollary 1: The following is what I’ve tried, and basically I think I need some specialized syntax for SDP. Trial Code us…

---

## [Nonconvex.jl variable names](https://discourse.julialang.org/t/nonconvex-jl-variable-names/111330)

<div class="topic-metadata">

**Author:** [@rtapia](https://discourse.julialang.org/u/rtapia)\
**Replies:** 9\
**Last updated:** [March 11, 2024, 11:44pm UTC](https://discourse.julialang.org/t/nonconvex-jl-variable-names/111330 "2024-03-11T23:44:04Z")

</div>

Hello, How does Nonconvex.jl differentiate variables? To define variables the definition simply define an upper and lower bound values addvar!(model, lower, upper), so how does it differentiate between variables across …

---

## [Nonconvex JuMP model to DictModel cannot see constraints](https://discourse.julialang.org/t/nonconvex-jump-model-to-dictmodel-cannot-see-constraints/111485)

<div class="topic-metadata">

**Author:** [@rtapia](https://discourse.julialang.org/u/rtapia)\
**Replies:** 2\
**Last updated:** [March 11, 2024, 11:40pm UTC](https://discourse.julialang.org/t/nonconvex-jump-model-to-dictmodel-cannot-see-constraints/111485 "2024-03-11T23:40:15Z")

</div>

Hello, Following the example from DictModel definition · Nonconvex.jl using JuMP, Nonconvex jump\_model = JuMP.Model() @variable jump\_model 0 \<= x\[i=1:3\] \<= 1 @constraint jump\_model sum(x) \<= 1 model = DictModel(jump\_mo…

---

## [Nonconvex and Matrix Variables](https://discourse.julialang.org/t/nonconvex-and-matrix-variables/82056)

<div class="topic-metadata">

**Author:** [@chupin](https://discourse.julialang.org/u/chupin)\
**Replies:** 9\
**Last updated:** [March 11, 2024, 11:20pm UTC](https://discourse.julialang.org/t/nonconvex-and-matrix-variables/82056 "2024-03-11T23:20:01Z")

</div>

Is there any way to deal with matrix variables with Nonconvex lib ? I tried something like: using Nonconvex Nonconvex.@load Ipopt f(x) = sqrt(x\[2,2\]) g(x, a, b) = (a\*x\[1,2\] + b)^3 - x\[2,1\] model = Model(f) addvar!(mo…

---

## [Assign variables as array of matrices in JuMP](https://discourse.julialang.org/t/assign-variables-as-array-of-matrices-in-jump/43884)

<div class="topic-metadata">

**Author:** [@umbe](https://discourse.julialang.org/u/umbe)\
**Replies:** 4\
**Last updated:** [July 30, 2020, 7:26am UTC](https://discourse.julialang.org/t/assign-variables-as-array-of-matrices-in-jump/43884 "2020-07-30T07:26:16Z")

</div>

Hello to everyone! I have a question concernig a possible way to provide the problem variables in JuMP. I would like to assign the variables in a 3-dimensional matrix, but one of the three dimensions is not constant. T…

---

## [A JuMP Formulation for the Minimum Up/Down Time Unit Commitment constraint](https://discourse.julialang.org/t/a-jump-formulation-for-the-minimum-up-down-time-unit-commitment-constraint/111458)

<div class="topic-metadata">

**Author:** [@Mouhamed](https://discourse.julialang.org/u/Mouhamed)\
**Replies:** 2\
**Last updated:** [March 11, 2024, 3:30pm UTC](https://discourse.julialang.org/t/a-jump-formulation-for-the-minimum-up-down-time-unit-commitment-constraint/111458 "2024-03-11T15:30:33Z")

</div>

Hi I’m new to JuMP and i’m currently struggling to generate a working constraint for the Minimum Up/Down Time. Indeed these are the “mathematical” formulation of what I wanna write: Σv(i) \<= u(t) for i in range \[t-UpTi…

---

## [How to solve a large quadratic programming problem](https://discourse.julialang.org/t/how-to-solve-a-large-quadratic-programming-problem/111200)

<div class="topic-metadata">

**Author:** [@aris](https://discourse.julialang.org/u/aris)\
**Replies:** 39\
**Last updated:** [March 9, 2024, 6:10pm UTC](https://discourse.julialang.org/t/how-to-solve-a-large-quadratic-programming-problem/111200 "2024-03-09T18:10:58Z")

</div>

Hello everyone, I was looking for the most appropriate way to solve the following minimization problem in Julia. \\arg\\min ||g-K f||^2+α||f||^2\\equiv \\arg\\min \\frac{1}{2}f^T(K^T K+αI)f-g^TKf s.t. f\\geq0 (where K,I a…

---

## [Help solving: Adding a few equations to ODE slows JuMP \>100x](https://discourse.julialang.org/t/help-solving-adding-a-few-equations-to-ode-slows-jump-100x/111321)

<div class="topic-metadata">

**Author:** [@lpz18](https://discourse.julialang.org/u/lpz18)\
**Replies:** 18\
**Last updated:** [March 8, 2024, 8:00pm UTC](https://discourse.julialang.org/t/help-solving-adding-a-few-equations-to-ode-slows-jump-100x/111321 "2024-03-08T20:00:54Z")

</div>

I’m using JuMP with Ipopt and AppleAccelerate.jl Following the rocket control tutorial, I coded a simplified set of differential equations where I optimize a control function. My simplified code takes \<2s to run: # dy…

---

## [Nonconvex.jl documentation](https://discourse.julialang.org/t/nonconvex-jl-documentation/111318)

<div class="topic-metadata">

**Author:** [@rtapia](https://discourse.julialang.org/u/rtapia)\
**Replies:** 3\
**Last updated:** [March 8, 2024, 5:24pm UTC](https://discourse.julialang.org/t/nonconvex-jl-documentation/111318 "2024-03-08T17:24:06Z")

</div>

Hello, This may be a silly question, but where can I find the applicable args and kwargs to the function optimize() in Nonconvex.jl are these the same as NLopt or other packages like JuMP? Additionally, based on Variou…

---

## [Changing polynomial bases](https://discourse.julialang.org/t/changing-polynomial-bases/111238)

<div class="topic-metadata">

**Author:** [@votroto](https://discourse.julialang.org/u/votroto)\
**Replies:** 7\
**Last updated:** [March 8, 2024, 1:43pm UTC](https://discourse.julialang.org/t/changing-polynomial-bases/111238 "2024-03-08T13:43:34Z")

</div>

Hello, I noticed there is a julia package MultivariateBases.jl for finding the bases of multivariate polynomials. Is there a simple way to get the coefficients corresponding to the basis generated basis elements? Thank …

---

## [How to print solver status and reason for termination for NLopt and Optimization.jl](https://discourse.julialang.org/t/how-to-print-solver-status-and-reason-for-termination-for-nlopt-and-optimization-jl/111308)

<div class="topic-metadata">

**Author:** [@structural](https://discourse.julialang.org/u/structural)\
**Replies:** 1\
**Last updated:** [March 7, 2024, 7:48pm UTC](https://discourse.julialang.org/t/how-to-print-solver-status-and-reason-for-termination-for-nlopt-and-optimization-jl/111308 "2024-03-07T19:48:18Z")

</div>

I am searching for a minimum using NLopt.LN\_SBPLX. The optimizer stops prematurely after ~100 iterations without throwing any errors or printing any messages. display(sol) simply returns the last parameter vector that wa…

---

## [Using SciPy Optimization](https://discourse.julialang.org/t/using-scipy-optimization/111317)

<div class="topic-metadata">

**Author:** [@rtapia](https://discourse.julialang.org/u/rtapia)\
**Replies:** 2\
**Last updated:** [March 7, 2024, 7:58pm UTC](https://discourse.julialang.org/t/using-scipy-optimization/111317 "2024-03-07T19:58:21Z")

</div>

Hello, Regarding the capabilities of SciPy.jl, it seems it cannot incorporate the constraints SciPy.NonlinearConstraints? Thanks

---

## [\[JuMP\] Speeding up constraint violation inspection](https://discourse.julialang.org/t/jump-speeding-up-constraint-violation-inspection/111303)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 1\
**Last updated:** [March 7, 2024, 6:59pm UTC](https://discourse.julialang.org/t/jump-speeding-up-constraint-violation-inspection/111303 "2024-03-07T18:59:20Z")

</div>

Hello, I’m trying to make an oracle that checks for constraint violations in a solved model (ie. constraints that were not initially in the model) and add some of them to the model to then reoptimize. The inspector look…

---

## [Julia Gurobi 11.0](https://discourse.julialang.org/t/julia-gurobi-11-0/108368)

<div class="topic-metadata">

**Author:** [@Z\_M](https://discourse.julialang.org/u/Z_M)\
**Replies:** 2\
**Last updated:** [January 5, 2024, 3:48am UTC](https://discourse.julialang.org/t/julia-gurobi-11-0/108368 "2024-01-05T03:48:01Z")

</div>

Hi! I want to know if Julia 1.9.2 supports Gurobi 11.0. I used Gurobi 9.5.2. Now I have updated Gurobi to 11.0. I wrote Pkg.add(“Gurobi”) in Julia, but it still uses Gurobi 9.5.2. What should I do? Thanks a lot

---

## [Fail to update Gurobi.jl for using Gurobi 11.0](https://discourse.julialang.org/t/fail-to-update-gurobi-jl-for-using-gurobi-11-0/111225)

<div class="topic-metadata">

**Author:** [@Chunjun](https://discourse.julialang.org/u/Chunjun)\
**Replies:** 3\
**Last updated:** [March 6, 2024, 2:27pm UTC](https://discourse.julialang.org/t/fail-to-update-gurobi-jl-for-using-gurobi-11-0/111225 "2024-03-06T14:27:52Z")

</div>

Hi! I’m working with Julia 1.5.3 and Gurobi 11.0 on Atom. I’ve acquired an academic license for Gurobi 11.0 and installed the Gurobi 11.0. I’ve set the correct environment path for Gurobi and placed the license there as…

---

## [Suggestions needed for bound-constrained least squares solver](https://discourse.julialang.org/t/suggestions-needed-for-bound-constrained-least-squares-solver/35611)

<div class="topic-metadata">

**Author:** [@mpf01](https://discourse.julialang.org/u/mpf01)\
**Replies:** 14\
**Last updated:** [March 5, 2024, 8:42pm UTC](https://discourse.julialang.org/t/suggestions-needed-for-bound-constrained-least-squares-solver/35611 "2024-03-05T20:42:01Z")

</div>

I’m looking for suggestions for a bound-constrained least-squares solver for minimize\_x 1/2||Ax-b||^2 subj to lb ≤ x ≤ ub where A is m-by-n and “tall”, ie, m \>\> n (eg, m=1K, n=10). The solver should have low setup c…

---

## [How to show the solution of all variables when using DualDecomposition.jl](https://discourse.julialang.org/t/how-to-show-the-solution-of-all-variables-when-using-dualdecomposition-jl/110975)

<div class="topic-metadata">

**Author:** [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Replies:** 2\
**Last updated:** [March 5, 2024, 4:23pm UTC](https://discourse.julialang.org/t/how-to-show-the-solution-of-all-variables-when-using-dualdecomposition-jl/110975 "2024-03-05T16:23:08Z")

</div>

I am trying to use the DualDecomposition package to solve the farmer test case. The @show DD.primal\_solution(algo) just shows the solution for the CROPS variables. How could I show all variables including CROPS, PURCH, a…

---

## [Comparing non-linear least squares solvers](https://discourse.julialang.org/t/comparing-non-linear-least-squares-solvers/104752)

<div class="topic-metadata">

**Author:** [@user664303](https://discourse.julialang.org/u/user664303)\
**Replies:** 37\
**Last updated:** [March 5, 2024, 9:34am UTC](https://discourse.julialang.org/t/comparing-non-linear-least-squares-solvers/104752 "2024-03-05T09:34:42Z")

</div>

I’m creating this thread as a resource for people looking to solve non-linear least squares problems in Julia, so they know what tools are available, what features they have and how well they perform. UPDATE: This compa…

---

## [Looping in expressions](https://discourse.julialang.org/t/looping-in-expressions/111162)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 1\
**Last updated:** [March 4, 2024, 10:11pm UTC](https://discourse.julialang.org/t/looping-in-expressions/111162 "2024-03-04T22:11:26Z")

</div>

Any preferred style of looping in expressions, objectives, or constraints that is syntactically superior and less error-prone? I see all the following works: using JuMP model = Model() @variable(model, x\[1:10\] \>= 0) @…

---

## [Reset Solver in Julia](https://discourse.julialang.org/t/reset-solver-in-julia/63756)

<div class="topic-metadata">

**Author:** [@Micah\_Mungal](https://discourse.julialang.org/u/Micah_Mungal)\
**Replies:** 8\
**Last updated:** [March 4, 2024, 8:27pm UTC](https://discourse.julialang.org/t/reset-solver-in-julia/63756 "2024-03-04T20:27:22Z")

</div>

I am trying to do a sensitivity analysis study using Julia and Gurobi as the solver. In doing the sensitivity analysis simulation, I am changing the coefficient of one of the optimization variables, building the model an…

---

## [Picking an AD Backend and Enzyme Errors](https://discourse.julialang.org/t/picking-an-ad-backend-and-enzyme-errors/111075)

<div class="topic-metadata">

**Author:** [@kiranshila](https://discourse.julialang.org/u/kiranshila)\
**Replies:** 8\
**Last updated:** [March 3, 2024, 10:24pm UTC](https://discourse.julialang.org/t/picking-an-ad-backend-and-enzyme-errors/111075 "2024-03-03T22:24:29Z")

</div>

I’m working on an optimization problem for a paper of the form cost(θ) =\> scalar, where θ is potentially large, maybe 100-200 dimensional. I was under the assumption reverse mode AD is appropriate for this task, howeve…

---

## [JuMP + Alpine: Handling scalar functions with vector input using @NLexpression](https://discourse.julialang.org/t/jump-alpine-handling-scalar-functions-with-vector-input-using-nlexpression/111019)

<div class="topic-metadata">

**Author:** [@smallpondtom](https://discourse.julialang.org/u/smallpondtom)\
**Replies:** 5\
**Last updated:** [March 2, 2024, 11:13pm UTC](https://discourse.julialang.org/t/jump-alpine-handling-scalar-functions-with-vector-input-using-nlexpression/111019 "2024-03-02T23:13:20Z")

</div>

Hi everyone, I am trying to reproduce this optimization below using JuMP. I’ve written a function below to solve this optimization. function LEDOA(V::Function, V\_dot::Function, N::Int) model = Model(Ipopt.Optim…

---

## [No method matching error](https://discourse.julialang.org/t/no-method-matching-error/111044)

<div class="topic-metadata">

**Author:** [@IgorESMelo](https://discourse.julialang.org/u/IgorESMelo)\
**Replies:** 2\
**Last updated:** [March 2, 2024, 8:30am UTC](https://discourse.julialang.org/t/no-method-matching-error/111044 "2024-03-02T08:30:55Z")

</div>

Hello everyone, I’m trying to build a mathematical model to minimize the variance of 4 variables. However, when I try to compute the variance julia have returned the follow error: ERROR: MethodError: no method matching…

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

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