# Optimization (Mathematical)

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

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

**Page:** 9

---

## [Passing a Cache to optimization function](https://discourse.julialang.org/t/passing-a-cache-to-optimization-function/129321)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 21\
**Last updated:** [May 29, 2025, 6:24pm UTC](https://discourse.julialang.org/t/passing-a-cache-to-optimization-function/129321 "2025-05-29T18:24:57Z")

</div>

Hi! In my original problem the computation of the objective value function is expensive and during the computation I can collaterally compute the constraints of my problem. To make my problem more efficient I tried to i…

---

## [Metaheuristics.jl ECA() requires redefinition between solves, making it incompatible with Optimization.jl Ensemble Problems](https://discourse.julialang.org/t/metaheuristics-jl-eca-requires-redefinition-between-solves-making-it-incompatible-with-optimization-jl-ensemble-problems/129286)

<div class="topic-metadata">

**Author:** [@johnb](https://discourse.julialang.org/u/johnb)\
**Replies:** 1\
**Last updated:** [May 29, 2025, 2:55pm UTC](https://discourse.julialang.org/t/metaheuristics-jl-eca-requires-redefinition-between-solves-making-it-incompatible-with-optimization-jl-ensemble-problems/129286 "2025-05-29T14:55:54Z")

</div>

I’m performing an optimization where the number of parameters used is varied across the ensemble. (e.g. prob 1 uses 1 parameter, prob 2 uses 2 parameters) Unfortunately, the algorithm that seems to work best with my spec…

---

## [Read from file a (Convex.jl) problem](https://discourse.julialang.org/t/read-from-file-a-convex-jl-problem/129402)

<div class="topic-metadata">

**Author:** [@CaG21](https://discourse.julialang.org/u/CaG21)\
**Replies:** 4\
**Last updated:** [May 29, 2025, 6:20am UTC](https://discourse.julialang.org/t/read-from-file-a-convex-jl-problem/129402 "2025-05-29T06:20:38Z")

</div>

I saved a convex problem, not solved yet, created by using Convex.jl, in a MOF/JSON file, with the write\_to\_file function. Now, I want to read that problem and start the opimization using the function Convex.solve!. How…

---

## [SciMLOperators "\*" function for TransposedOperator](https://discourse.julialang.org/t/scimloperators-function-for-transposedoperator/129422)

<div class="topic-metadata">

**Author:** [@fdekerme](https://discourse.julialang.org/u/fdekerme)\
**Replies:** 2\
**Last updated:** [May 29, 2025, 1:55am UTC](https://discourse.julialang.org/t/scimloperators-function-for-transposedoperator/129422 "2025-05-29T01:55:57Z")

</div>

Hello :grinning:, I want to use SciMLOperators.jl with LinearSolve.jl to solve a linear system like \\left( A^T V^{-1} A + \\lambda (W - I)^T (W - I) \\right) x = A^T V^{-1} \\mu I created a FunctionOperator for A, V\_in…

---

## [Re-sizing DenseAxisArray Containers in JuMP](https://discourse.julialang.org/t/re-sizing-denseaxisarray-containers-in-jump/129367)

<div class="topic-metadata">

**Author:** [@suwuken](https://discourse.julialang.org/u/suwuken)\
**Replies:** 6\
**Last updated:** [May 28, 2025, 8:33pm UTC](https://discourse.julialang.org/t/re-sizing-denseaxisarray-containers-in-jump/129367 "2025-05-28T20:33:22Z")

</div>

I have a model with named variables as DenseAxisArray, e.g., using JuMP model = direct\_model(Gurobi.Optimizer()) model\[:x\] = @variable(model, 1 \>= x\[1:10, 1:5, 1:2\] \>= 0) This creates a DenseAxisArray which I can acces…

---

## [Gurobi compute IIS in Julia](https://discourse.julialang.org/t/gurobi-compute-iis-in-julia/129391)

<div class="topic-metadata">

**Author:** [@cby](https://discourse.julialang.org/u/cby)\
**Replies:** 1\
**Last updated:** [May 27, 2025, 8:37pm UTC](https://discourse.julialang.org/t/gurobi-compute-iis-in-julia/129391 "2025-05-27T20:37:31Z")

</div>

What is the equivalent of the following in Julia? https://support.gurobi.com/hc/en-us/articles/15656630439441-How-do-I-use-compute-IIS-to-find-a-subset-of-constraints-that-are-causing-model-infeasibility I understand I…

---

## [Basic Data Utilities in PowerModels.jl---some more methods?](https://discourse.julialang.org/t/basic-data-utilities-in-powermodels-jl-some-more-methods/129291)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 9\
**Last updated:** [May 27, 2025, 2:28pm UTC](https://discourse.julialang.org/t/basic-data-utilities-in-powermodels-jl-some-more-methods/129291 "2025-05-27T14:28:38Z")

</div>

This post is a feature request related to Basic Data Utilities · PowerModels. Although this sparse incidence matrix (denoted A) is useful, sometimes we may need another more succinct matrix—I call it bft, branch\_from\_to…

---

## [NLOPT constraint violation](https://discourse.julialang.org/t/nlopt-constraint-violation/128851)

<div class="topic-metadata">

**Author:** [@mary](https://discourse.julialang.org/u/mary)\
**Replies:** 6\
**Last updated:** [May 24, 2025, 9:11pm UTC](https://discourse.julialang.org/t/nlopt-constraint-violation/128851 "2025-05-24T21:11:49Z")

</div>

Hi I am using NLOP for topology optimization. First I did the deterministic topology optimization with constraint on volume, Now I am adding another constraint. As I checked the values for constraint it seems that the d…

---

## [How to turn off the warn from PowerModels.jl](https://discourse.julialang.org/t/how-to-turn-off-the-warn-from-powermodels-jl/129289)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 2\
**Last updated:** [May 24, 2025, 8:44am UTC](https://discourse.julialang.org/t/how-to-turn-off-the-warn-from-powermodels-jl/129289 "2025-05-24T08:44:33Z")

</div>

julia\> import PowerModels julia\> PowerModels.make\_basic\_network(PowerModels.parse\_file("data/case118.m")); \[warn | PowerModels\]: this code only supports angmin values in -90 deg. to 90 deg., tightening the value on bran…

---

## [Enzyme reverse mode not working](https://discourse.julialang.org/t/enzyme-reverse-mode-not-working/129281)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 4\
**Last updated:** [May 23, 2025, 7:08pm UTC](https://discourse.julialang.org/t/enzyme-reverse-mode-not-working/129281 "2025-05-23T19:08:52Z")

</div>

Hi there, I am struggling to get Enzyme working on a simplified version of my simulation. Here I give the code I’m running along with the error. My data is stored in an array of Student structs: using Enzyme using Sp…

---

## [JuMP and SparseArrays](https://discourse.julialang.org/t/jump-and-sparsearrays/129264)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 5\
**Last updated:** [May 23, 2025, 8:32am UTC](https://discourse.julialang.org/t/jump-and-sparsearrays/129264 "2025-05-23T08:32:57Z")

</div>

The background is using SparseArrays, JuMP m = Model(); @variable(m, x\[1:2\]); My question is, can I create a sparse 2-by-2 object (whatever it is) denoted A, such that A\[1, 1\] returns me x\[1\], A\[2, 1\] returns me x\[2\].…

---

## [Retrieve the simplex tableau from Gurobi.jl using JuMP](https://discourse.julialang.org/t/retrieve-the-simplex-tableau-from-gurobi-jl-using-jump/129237)

<div class="topic-metadata">

**Author:** [@YANG-Hanbin](https://discourse.julialang.org/u/YANG-Hanbin)\
**Replies:** 3\
**Last updated:** [May 22, 2025, 11:42pm UTC](https://discourse.julialang.org/t/retrieve-the-simplex-tableau-from-gurobi-jl-using-jump/129237 "2025-05-22T23:42:36Z")

</div>

Hello everyone! I’m trying to retrieve the optimal simplex tableau after solving a linear program using Gurobi. Thanks to Oscar’s help, I learned how to use the GRBBinvRowi function to access individual rows of the inve…

---

## [How to get the dual of a non convex MIQCP Gurobi](https://discourse.julialang.org/t/how-to-get-the-dual-of-a-non-convex-miqcp-gurobi/129257)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 1\
**Last updated:** [May 22, 2025, 11:37pm UTC](https://discourse.julialang.org/t/how-to-get-the-dual-of-a-non-convex-miqcp-gurobi/129257 "2025-05-22T23:37:07Z")

</div>

hi All, I need to get the duals of a nonconvex MIQCP i tried below code from model = Model(Gurobi.Optimizer) set\_optimizer\_attribute(model, "NonConvex", 2) @variable(model, x, Bin) @variable(model, y \>= 0) @constraint…

---

## [What does the network constraint look like in the capacity expansion problem](https://discourse.julialang.org/t/what-does-the-network-constraint-look-like-in-the-capacity-expansion-problem/129214)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 1\
**Last updated:** [May 21, 2025, 9:31pm UTC](https://discourse.julialang.org/t/what-does-the-network-constraint-look-like-in-the-capacity-expansion-problem/129214 "2025-05-21T21:31:31Z")

</div>

I’m looking for help on the modeling issue of a power system capacity expansion problem. Here is a related tutorial Power Balance · GenX.jl. The z there is a “node” (electrical bus) quantity, and t there is an index of…

---

## [Does Coluna supports sos2 with gurobi, is there a way to implement its](https://discourse.julialang.org/t/does-coluna-supports-sos2-with-gurobi-is-there-a-way-to-implement-its/129153)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 3\
**Last updated:** [May 20, 2025, 9:30pm UTC](https://discourse.julialang.org/t/does-coluna-supports-sos2-with-gurobi-is-there-a-way-to-implement-its/129153 "2025-05-20T21:30:51Z")

</div>

coluna = optimizer\_with\_attributes( Coluna.Optimizer, "params" =\> Coluna.Params( solver = Co…

---

## [Matrix inverse as objective](https://discourse.julialang.org/t/matrix-inverse-as-objective/129162)

<div class="topic-metadata">

**Author:** [@Rick](https://discourse.julialang.org/u/Rick)\
**Replies:** 2\
**Last updated:** [May 20, 2025, 5:51am UTC](https://discourse.julialang.org/t/matrix-inverse-as-objective/129162 "2025-05-20T05:51:58Z")

</div>

Hi everyone, I am trying to solve a semi-definite program with an objective that contains a matrix inverse. More precisely, let a \\geq 0, and A be a positive definite matrix of size d \\times d. \\mathbf{1} below is a ve…

---

## [IPOPT Watchdog Iterations Tracking](https://discourse.julialang.org/t/ipopt-watchdog-iterations-tracking/129159)

<div class="topic-metadata">

**Author:** [@leespen1](https://discourse.julialang.org/u/leespen1)\
**Replies:** 2\
**Last updated:** [May 19, 2025, 10:17pm UTC](https://discourse.julialang.org/t/ipopt-watchdog-iterations-tracking/129159 "2025-05-19T22:17:28Z")

</div>

In IPOPT.jl, is there any way to obtain the diagnostic information or alpha\_pr? The callback function example given in repo is: function my\_callback( alg\_mod::Cint, iter\_count::Cint, obj\_value::Float64, inf…

---

## [Simplicial decomposition equals dual cutting plane---a toy example](https://discourse.julialang.org/t/simplicial-decomposition-equals-dual-cutting-plane-a-toy-example/129128)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 1\
**Last updated:** [May 19, 2025, 7:36pm UTC](https://discourse.julialang.org/t/simplicial-decomposition-equals-dual-cutting-plane-a-toy-example/129128 "2025-05-19T19:36:28Z")

</div>

Continuing the discussion from Seeking help on Branch and Price: I here furnish a toy example to help us fathoming that doing simplicial decomposition (or, column generation) in the primal space is equivalent to adding …

---

## [Seeking help on Branch and Price](https://discourse.julialang.org/t/seeking-help-on-branch-and-price/112020)

<div class="topic-metadata">

**Author:** [@wahadhasan](https://discourse.julialang.org/u/wahadhasan)\
**Replies:** 2\
**Last updated:** [May 19, 2025, 1:39am UTC](https://discourse.julialang.org/t/seeking-help-on-branch-and-price/112020 "2025-05-19T01:39:32Z")

</div>

Note that this may not be the global minimum because we are not adding new columns during the solution of the mixed-integer problem model (an algorithm known as branch and price). Could someone please help me how to f…

---

## [Do degeneracies and numerical instabilities more likely during the execution of solvers in case of formulations with greater number of constraints and decision variables?](https://discourse.julialang.org/t/do-degeneracies-and-numerical-instabilities-more-likely-during-the-execution-of-solvers-in-case-of-formulations-with-greater-number-of-constraints-and-decision-variables/129108)

<div class="topic-metadata">

**Author:** [@Engr\_Moiz\_Ahmad](https://discourse.julialang.org/u/Engr_Moiz_Ahmad)\
**Replies:** 2\
**Last updated:** [May 18, 2025, 2:23am UTC](https://discourse.julialang.org/t/do-degeneracies-and-numerical-instabilities-more-likely-during-the-execution-of-solvers-in-case-of-formulations-with-greater-number-of-constraints-and-decision-variables/129108 "2025-05-18T02:23:58Z")

</div>

I am dealing with a multi-stage mixed-integer stochastic global supply chain optimization problem and want to solve it using the SDDiP algorithm in the SDDP.jl package in Julia. In this regard, I am conducting prelimina…

---

## [Gurobi Error 10005 is seen on submitting lazy constraint also when cb\_where == GRB\_CB\_MIPNODE](https://discourse.julialang.org/t/gurobi-error-10005-is-seen-on-submitting-lazy-constraint-also-when-cb-where-grb-cb-mipnode/129094)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 2\
**Last updated:** [May 18, 2025, 12:09am UTC](https://discourse.julialang.org/t/gurobi-error-10005-is-seen-on-submitting-lazy-constraint-also-when-cb-where-grb-cb-mipnode/129094 "2025-05-18T00:09:12Z")

</div>

My code (full and runnable) is import LinearAlgebra.dot as dot import LinearAlgebra.norm as norm import JuMP, Gurobi, Random function my\_callback\_function(cb\_data, cb\_where::Cint) if cb\_where == Gurobi.GRB\_CB\_MIPSOL…

---

## [Unable to solve the problem using Lagrangian duality handler](https://discourse.julialang.org/t/unable-to-solve-the-problem-using-lagrangian-duality-handler/129079)

<div class="topic-metadata">

**Author:** [@Engr\_Moiz\_Ahmad](https://discourse.julialang.org/u/Engr_Moiz_Ahmad)\
**Replies:** 2\
**Last updated:** [May 17, 2025, 9:40pm UTC](https://discourse.julialang.org/t/unable-to-solve-the-problem-using-lagrangian-duality-handler/129079 "2025-05-17T21:40:17Z")

</div>

I am dealing with a multi-stage mixed-integer stochastic global supply chain optimization problem and want to solve it using the SDDiP algorithm in the SDDP.jl package in Julia. In this regard, I tried solving the mixed…

---

## [Write the lagrangian relaxation with JuMP concisely](https://discourse.julialang.org/t/write-the-lagrangian-relaxation-with-jump-concisely/129082)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 2\
**Last updated:** [May 17, 2025, 6:52am UTC](https://discourse.julialang.org/t/write-the-lagrangian-relaxation-with-jump-concisely/129082 "2025-05-17T06:52:33Z")

</div>

I discover a new syntax to do the lagrangian relaxation, it looks elegant, but will it be efficiency also? # The following 2 constraints are to be relaxed (and penalized on the obj) # via Lagrangian multipliers \`a\` and…

---

## [Gurobi12 reports obj\_value \< obj\_bound in a Min-Program?](https://discourse.julialang.org/t/gurobi12-reports-obj-value-obj-bound-in-a-min-program/126849)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 17\
**Last updated:** [May 11, 2025, 3:00pm UTC](https://discourse.julialang.org/t/gurobi12-reports-obj-value-obj-bound-in-a-min-program/126849 "2025-05-11T15:00:58Z")

</div>

See the comments at the bottom of this code. import JuMP, Gurobi CR = JuMP.Model(() -\> Gurobi.Optimizer()) JuMP.@variable(CR, x\[1:3\]) JuMP.set\_lower\_bound(x\[1\], exp(1)); JuMP.set\_upper\_bound(x\[1\], exp(2)) JuMP.set\_lower…

---

## [Issue with Optimization.LBFGS](https://discourse.julialang.org/t/issue-with-optimization-lbfgs/129076)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 1\
**Last updated:** [May 16, 2025, 8:14pm UTC](https://discourse.julialang.org/t/issue-with-optimization-lbfgs/129076 "2025-05-16T20:14:50Z")

</div>

Hi there, Disclaimer: I can not share the actual data or objective function so this might be a long shot but maybe the error itself has enough information. I am trying to optimize a function g with non-linear constrain…

---

## [How to Minimize Operator/Spectral Norm of a Density Matrix with JuMP + Hypatia](https://discourse.julialang.org/t/how-to-minimize-operator-spectral-norm-of-a-density-matrix-with-jump-hypatia/129006)

<div class="topic-metadata">

**Author:** [@Menixm](https://discourse.julialang.org/u/Menixm)\
**Replies:** 7\
**Last updated:** [May 16, 2025, 11:57am UTC](https://discourse.julialang.org/t/how-to-minimize-operator-spectral-norm-of-a-density-matrix-with-jump-hypatia/129006 "2025-05-16T11:57:05Z")

</div>

I am coming from MATLAB/Python but Julia is becoming more attractive, especially for higher precision. Currently I am just trying out some toy problems to familiarize myself with Julia, JuMP, and associated solvers. I a…

---

## [Why convergence behavior of SDDiP algorithm is different with different mixed-integer programming solvers?](https://discourse.julialang.org/t/why-convergence-behavior-of-sddip-algorithm-is-different-with-different-mixed-integer-programming-solvers/128913)

<div class="topic-metadata">

**Author:** [@Engr\_Moiz\_Ahmad](https://discourse.julialang.org/u/Engr_Moiz_Ahmad)\
**Replies:** 11\
**Last updated:** [May 15, 2025, 1:45am UTC](https://discourse.julialang.org/t/why-convergence-behavior-of-sddip-algorithm-is-different-with-different-mixed-integer-programming-solvers/128913 "2025-05-15T01:45:49Z")

</div>

I am dealing with a multi-stage mixed-integer stochastic global supply chain optimization problem and want to solve it using the SDDiP algorithm using the SDDP.jl package in Julia. In this regard, I tried various mixed-…

---

## [Gurobi12 reports OPTIMAL to an NLP which is actually UNbounded](https://discourse.julialang.org/t/gurobi12-reports-optimal-to-an-nlp-which-is-actually-unbounded/127293)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 9\
**Last updated:** [May 14, 2025, 1:07am UTC](https://discourse.julialang.org/t/gurobi12-reports-optimal-to-an-nlp-which-is-actually-unbounded/127293 "2025-05-14T01:07:05Z")

</div>

Continuing the discussion from Gurobi12 Reports unbounded to a nonconvex QP which is actually bounded: import JuMP, Gurobi NLP = JuMP.Model(Gurobi.Optimizer); JuMP.@variable(NLP, x); JuMP.@objective(NLP, Min, (x + 1) \* …

---

## [Gurobi12 Reports unbounded to a nonconvex QP which is actually bounded](https://discourse.julialang.org/t/gurobi12-reports-unbounded-to-a-nonconvex-qp-which-is-actually-bounded/126657)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 15\
**Last updated:** [May 14, 2025, 1:03am UTC](https://discourse.julialang.org/t/gurobi12-reports-unbounded-to-a-nonconvex-qp-which-is-actually-bounded/126657 "2025-05-14T01:03:45Z")

</div>

import JuMP import Gurobi function objf(x, y) return (y - 2)^2/4 - x \* y end B = JuMP.Model(() -\> Gurobi.Optimizer()); # A bilinear program JuMP.@variable(B, 0 \<= x \<= 1); JuMP.@variable(B, y); # this variable is free Ju…

---

## [Fail to re-add new constraints as a new upper bound of an expression in JuMP model](https://discourse.julialang.org/t/fail-to-re-add-new-constraints-as-a-new-upper-bound-of-an-expression-in-jump-model/128850)

<div class="topic-metadata">

**Author:** [@Wendy\_Weng](https://discourse.julialang.org/u/Wendy_Weng)\
**Replies:** 2\
**Last updated:** [May 12, 2025, 8:39pm UTC](https://discourse.julialang.org/t/fail-to-re-add-new-constraints-as-a-new-upper-bound-of-an-expression-in-jump-model/128850 "2025-05-12T20:39:52Z")

</div>

I have a JuMP model called EP. I am trying to delete and re-add constraints called cMaxCap as an upper bound for an expression eTotalCap. This upper bound has values max\_cap\_mw. However, after deleting and re-adding, my…

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

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