# Optimization (Mathematical)

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

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

**Page:** 4

---

## [Lagrange multipliers of a \`VectorNonlinearOracle\` after solve](https://discourse.julialang.org/t/lagrange-multipliers-of-a-vectornonlinearoracle-after-solve/134236)

<div class="topic-metadata">

**Author:** [@franckgaga](https://discourse.julialang.org/u/franckgaga)\
**Replies:** 1\
**Last updated:** [November 30, 2025, 7:39pm UTC](https://discourse.julialang.org/t/lagrange-multipliers-of-a-vectornonlinearoracle-after-solve/134236 "2025-11-30T19:39:32Z")

</div>

I have a nonlinear optimization problem that relies on MOI.VectorNonlinearOracle for the constraints. I would like to compute the Hessian of the Langrangian at the optimum after solving, or, in other words, fetching the r…

---

## [Best way to model a piecewise linearization for \`f(x) = x^0.8\` on \`\[0, 1e5\]\` with PiecewiseLinearOpt.jl?](https://discourse.julialang.org/t/best-way-to-model-a-piecewise-linearization-for-f-x-x-0-8-on-0-1e5-with-piecewiselinearopt-jl/131963)

<div class="topic-metadata">

**Author:** [@karei](https://discourse.julialang.org/u/karei)\
**Replies:** 3\
**Last updated:** [November 28, 2025, 10:39am UTC](https://discourse.julialang.org/t/best-way-to-model-a-piecewise-linearization-for-f-x-x-0-8-on-0-1e5-with-piecewiselinearopt-jl/131963 "2025-11-28T10:39:13Z")

</div>

Hi all, I have an optimization model where I need to replace a concave cost term f(x) = x^{0.8} for x \\in \[0, 10^5\] with a piecewise linear (PWL) form in JuMP. The model is a minimization, and I’m considering using Pie…

---

## [DiffOpt / JuMP: zero gradient for variable fixed by equality constraint](https://discourse.julialang.org/t/diffopt-jump-zero-gradient-for-variable-fixed-by-equality-constraint/134041)

<div class="topic-metadata">

**Author:** [@yeomoon](https://discourse.julialang.org/u/yeomoon)\
**Replies:** 12\
**Last updated:** [November 28, 2025, 5:36am UTC](https://discourse.julialang.org/t/diffopt-jump-zero-gradient-for-variable-fixed-by-equality-constraint/134041 "2025-11-28T05:36:03Z")

</div>

Hi all, I’m trying to train a neural network that is followed by a differentiable optimization layer in Julia. Conceptually it’s: Flux NN → Economic Dispatch layer (ED layer) → Loss The ED layer is implemented as a …

---

## [MadNLPGPU.jl not working for simple economic dispatch](https://discourse.julialang.org/t/madnlpgpu-jl-not-working-for-simple-economic-dispatch/134084)

<div class="topic-metadata">

**Author:** [@shakedregev](https://discourse.julialang.org/u/shakedregev)\
**Replies:** 4\
**Last updated:** [November 26, 2025, 3:14pm UTC](https://discourse.julialang.org/t/madnlpgpu-jl-not-working-for-simple-economic-dispatch/134084 "2025-11-26T15:14:01Z")

</div>

I’m having issues using MadNLPGPU.jl, while a similar code works for MadNLP.jl. I initially tried a direct conversion, then I read that Examodels is better for GPUs. I am not attached to the particular method to solve on…

---

## [HiGHS instance and model when used in a shared library](https://discourse.julialang.org/t/highs-instance-and-model-when-used-in-a-shared-library/133823)

<div class="topic-metadata">

**Author:** [@asprionj](https://discourse.julialang.org/u/asprionj)\
**Replies:** 7\
**Last updated:** [November 24, 2025, 9:29am UTC](https://discourse.julialang.org/t/highs-instance-and-model-when-used-in-a-shared-library/133823 "2025-11-24T09:29:26Z")

</div>

I use JuMP.jl with HiGHS.jl to solve an optimisation problem, then generate a shared library for this using JuliaC.jl. The shared library is used within a larger software. It is loaded once (at startup), and then always …

---

## [Don't understand the results of cuOpt](https://discourse.julialang.org/t/dont-understand-the-results-of-cuopt/133707)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 4\
**Last updated:** [November 24, 2025, 7:02am UTC](https://discourse.julialang.org/t/dont-understand-the-results-of-cuopt/133707 "2025-11-24T07:02:12Z")

</div>

julia\> import JuMP, cuOpt julia\> model = JuMP.Model(); julia\> JuMP.@variable(model, x \>= 0, Int); julia\> JuMP.@variable(model, 0 \<= y \<= 3); julia\> JuMP.@objective(model, Min, 12x + 20y); julia\> JuMP.@constraint(mod…

---

## [Efficient way to implement multi-index nonlinear constraints in ExaModels? (PCE-expanded AC power flow)](https://discourse.julialang.org/t/efficient-way-to-implement-multi-index-nonlinear-constraints-in-examodels-pce-expanded-ac-power-flow/133934)

<div class="topic-metadata">

**Author:** [@yanlingogo](https://discourse.julialang.org/u/yanlingogo)\
**Replies:** 4\
**Last updated:** [November 24, 2025, 4:24am UTC](https://discourse.julialang.org/t/efficient-way-to-implement-multi-index-nonlinear-constraints-in-examodels-pce-expanded-ac-power-flow/133934 "2025-11-24T04:24:44Z")

</div>

Hi all, I’m implementing a PCE-expanded AC power flow model. In JuMP, one of my nonlinear constraints looks like: @constraint(opf, pfP\[i=1:n\_bus, k=1:K\], p\[i,k\] \* T2\_diag\[k\] == sum( (G\[i,j\]\*(E\[i…

---

## [Getting an infeasibility certificate from Gurobi when solving hard LPs](https://discourse.julialang.org/t/getting-an-infeasibility-certificate-from-gurobi-when-solving-hard-lps/133639)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 8\
**Last updated:** [November 24, 2025, 1:52am UTC](https://discourse.julialang.org/t/getting-an-infeasibility-certificate-from-gurobi-when-solving-hard-lps/133639 "2025-11-24T01:52:23Z")

</div>

I guess something is wrong with the barrier algorithm, but I have no expertise to read its logging. I log it here, don’t know if someone can have some explanations. (The whole logging has no Warning.) julia\> JuMP.opti…

---

## [AssertionError in Gurobi.jl with OptimalityTarget = 1 on simple nonlinear model (Gurobi 13)](https://discourse.julialang.org/t/assertionerror-in-gurobi-jl-with-optimalitytarget-1-on-simple-nonlinear-model-gurobi-13/133948)

<div class="topic-metadata">

**Author:** [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Replies:** 4\
**Last updated:** [November 23, 2025, 7:47pm UTC](https://discourse.julialang.org/t/assertionerror-in-gurobi-jl-with-optimalitytarget-1-on-simple-nonlinear-model-gurobi-13/133948 "2025-11-23T19:47:40Z")

</div>

Hi all, I’m getting an AssertionError when using Gurobi 13 through JuMP with a very small nonlinear model, but only when I set OptimalityTarget = 1. Minimal working example: using JuMP, Gurobi m = Model(Gurobi.Optimi…

---

## [CasADiNLPModels.jl: an interface for CasADi via loading code generated functions](https://discourse.julialang.org/t/casadinlpmodels-jl-an-interface-for-casadi-via-loading-code-generated-functions/133925)

<div class="topic-metadata">

**Author:** [@apozharski](https://discourse.julialang.org/u/apozharski)\
**Replies:** 1\
**Last updated:** [November 19, 2025, 11:35am UTC](https://discourse.julialang.org/t/casadinlpmodels-jl-an-interface-for-casadi-via-loading-code-generated-functions/133925 "2025-11-19T11:35:02Z")

</div>

We (@frapac, @apozharski, and Armin Nurkanović) have released a small new package for easily interfacing NLPs modeled in CasADi with the NLPModels.jl ecosystem. The package implements loading of CasÄDi code generated fun…

---

## [\`Initial guess is not an interior point\` in optimization methods](https://discourse.julialang.org/t/initial-guess-is-not-an-interior-point-in-optimization-methods/133727)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 10\
**Last updated:** [November 12, 2025, 4:37am UTC](https://discourse.julialang.org/t/initial-guess-is-not-an-interior-point-in-optimization-methods/133727 "2025-11-12T04:37:47Z")

</div>

I’m using Optim.jl via Optimization.jl and hitting Initial guess is not an interior point. I get that I could/should change my initial condition, but I’d like a general solution that works in general whenever a solution …

---

## [The output of Gurobi's solution isn't qualified as its own input in terms of feasibility](https://discourse.julialang.org/t/the-output-of-gurobis-solution-isnt-qualified-as-its-own-input-in-terms-of-feasibility/133785)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 8\
**Last updated:** [November 11, 2025, 7:20am UTC](https://discourse.julialang.org/t/the-output-of-gurobis-solution-isnt-qualified-as-its-own-input-in-terms-of-feasibility/133785 "2025-11-11T07:20:52Z")

</div>

I write decomposition algorithms with the Gurobi solver, so occasionally I need to use Gurobi’s solution as data input to another model, which is also solved by Gurobi. But I find it annoying that the “$THE\_TITLE”. juli…

---

## [Mixed integer problem](https://discourse.julialang.org/t/mixed-integer-problem/133624)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 17\
**Last updated:** [November 10, 2025, 10:37am UTC](https://discourse.julialang.org/t/mixed-integer-problem/133624 "2025-11-10T10:37:47Z")

</div>

I attempt to define a mixed-integer optimization problem. To simplify the problem: I have 10 wind turbines. I have 10 boolean variables that indicate whether the turbine is operating at full or partial power. If it is o…

---

## [Banded Jacobian of the constraints](https://discourse.julialang.org/t/banded-jacobian-of-the-constraints/133766)

<div class="topic-metadata">

**Author:** [@Ceserik](https://discourse.julialang.org/u/Ceserik)\
**Replies:** 4\
**Last updated:** [November 10, 2025, 6:22am UTC](https://discourse.julialang.org/t/banded-jacobian-of-the-constraints/133766 "2025-11-10T06:22:04Z")

</div>

Hello, I am using JuMP for solving optimal control of a car on a track. I am trying to reformulate my problem, to improve the sparsity pattern of jacobian of constraints and Hessian of Lagrangian. I have managed to get …

---

## [Help refining an MINLP and selecting an optimiser to make solving faster / possible](https://discourse.julialang.org/t/help-refining-an-minlp-and-selecting-an-optimiser-to-make-solving-faster-possible/133758)

<div class="topic-metadata">

**Author:** [@HarrisonWilde](https://discourse.julialang.org/u/HarrisonWilde)\
**Replies:** 4\
**Last updated:** [November 10, 2025, 12:00am UTC](https://discourse.julialang.org/t/help-refining-an-minlp-and-selecting-an-optimiser-to-make-solving-faster-possible/133758 "2025-11-10T00:00:06Z")

</div>

I am building a problem that involves making choices on which of two levers (or both) to intervene on products in a portfolio to alter their characteristics in order to attain a target average “score” value derived from …

---

## [How to reinit NonlinearSolve.jl problem/integrator?](https://discourse.julialang.org/t/how-to-reinit-nonlinearsolve-jl-problem-integrator/109536)

<div class="topic-metadata">

**Author:** [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Replies:** 5\
**Last updated:** [November 5, 2025, 11:47pm UTC](https://discourse.julialang.org/t/how-to-reinit-nonlinearsolve-jl-problem-integrator/109536 "2025-11-05T23:47:14Z")

</div>

Consider f(u, p) = u .\* u .- p u0 = @SVector\[1.0, 1.0\] prob = NonlinearProblem(f, u0, \[1\]) solver = solve(prob) How do I reinitialize the problem or the underlying integrator/cache with new u0 and p?

---

## [Trouble using ParametricOptInterface when a parameter appears inside a min() expression in JuMP](https://discourse.julialang.org/t/trouble-using-parametricoptinterface-when-a-parameter-appears-inside-a-min-expression-in-jump/133661)

<div class="topic-metadata">

**Author:** [@leo.ch.97](https://discourse.julialang.org/u/leo.ch.97)\
**Replies:** 2\
**Last updated:** [November 4, 2025, 7:03pm UTC](https://discourse.julialang.org/t/trouble-using-parametricoptinterface-when-a-parameter-appears-inside-a-min-expression-in-jump/133661 "2025-11-04T19:03:27Z")

</div>

Hi everyone! I’m trying to extend a large (mixed-integer) linear model to handle Parameters, using the ParametricOptInterface.jl package. However, I’m running into an issue when a parameter is used inside a min() funct…

---

## [Computing Hessian of the Langrangian efficiently with DI.jl](https://discourse.julialang.org/t/computing-hessian-of-the-langrangian-efficiently-with-di-jl/133462)

<div class="topic-metadata">

**Author:** [@franckgaga](https://discourse.julialang.org/u/franckgaga)\
**Replies:** 15\
**Last updated:** [November 4, 2025, 5:16pm UTC](https://discourse.julialang.org/t/computing-hessian-of-the-langrangian-efficiently-with-di-jl/133462 "2025-11-04T17:16:42Z")

</div>

Hello, The new MOI.VectorNonlinearOracle support providing the Hessian of the Langrangian function, defined as, according to MOI.jl doc: \\sum\_i \\mu\_i \\nabla^2 f\_i(\\mathbf{x}) but the Langrangian typically also includ…

---

## [Minimization of degenerate eigenvalue of sparse matrix](https://discourse.julialang.org/t/minimization-of-degenerate-eigenvalue-of-sparse-matrix/133615)

<div class="topic-metadata">

**Author:** [@mxhbl](https://discourse.julialang.org/u/mxhbl)\
**Replies:** 12\
**Last updated:** [November 4, 2025, 4:30pm UTC](https://discourse.julialang.org/t/minimization-of-degenerate-eigenvalue-of-sparse-matrix/133615 "2025-11-04T16:30:17Z")

</div>

Hi, I have a tricky optimization problem where I need to minimize a specific eigenvalue of a matrix M(\\theta) that depends continuously on a set of parameters \\theta. The problem is that the eigenvalue is usually degene…

---

## [Can't get the example dualization to work](https://discourse.julialang.org/t/cant-get-the-example-dualization-to-work/129478)

<div class="topic-metadata">

**Author:** [@brandon-lee-17](https://discourse.julialang.org/u/brandon-lee-17)\
**Replies:** 5\
**Last updated:** [November 4, 2025, 7:07am UTC](https://discourse.julialang.org/t/cant-get-the-example-dualization-to-work/129478 "2025-11-04T07:07:27Z")

</div>

I can’t seem to get the first motivating example in Dualization.jl to work (at https://jump.dev/Dualization.jl/dev/examples/) using JuMP, Dualization model = Model() @variable(model, x) @variable(model, y) @variable(mod…

---

## [Solving Projection onto Linear Equality for Multiple Input Vectors](https://discourse.julialang.org/t/solving-projection-onto-linear-equality-for-multiple-input-vectors/133428)

<div class="topic-metadata">

**Author:** [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Replies:** 11\
**Last updated:** [October 31, 2025, 8:52pm UTC](https://discourse.julialang.org/t/solving-projection-onto-linear-equality-for-multiple-input-vectors/133428 "2025-10-31T20:52:18Z")

</div>

I am after solving the projection onto a Linear Equation problem: \\arg \\min\_{\\boldsymbol{x}} \\frac{1}{2} {\\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|}\_{2}^{2} \\; \\text{ subject to } \\boldsymbol{A} \\boldsymbol{x} =…

---

## [Optimization with AD of complex struct-based architecture](https://discourse.julialang.org/t/optimization-with-ad-of-complex-struct-based-architecture/133436)

<div class="topic-metadata">

**Author:** [@stevenhughes](https://discourse.julialang.org/u/stevenhughes)\
**Replies:** 3\
**Last updated:** [October 27, 2025, 7:44am UTC](https://discourse.julialang.org/t/optimization-with-ad-of-complex-struct-based-architecture/133436 "2025-10-27T07:44:15Z")

</div>

Hi everyone, I’m working on adding automatic differentiation to an optimization framework and running into some fundamental architectural issues. The framework uses a Directed Acyclic Graph modeled after Fig. 7 in this …

---

## [Julia crashes without reporting anything when I optimize a vector of models in parallel](https://discourse.julialang.org/t/julia-crashes-without-reporting-anything-when-i-optimize-a-vector-of-models-in-parallel/131801)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 22\
**Last updated:** [October 25, 2025, 1:55am UTC](https://discourse.julialang.org/t/julia-crashes-without-reporting-anything-when-i-optimize-a-vector-of-models-in-parallel/131801 "2025-10-25T01:55:47Z")

</div>

My setting is julia\> Threads.nthreads() 4 I can’t figure out what is happening here. The behavior is julia\> parallel\_CG!(B, θ, β, μ, ν) ┌ Info: before entering @threads │ sub\_j\_vec = │ 4-element Vector{Int64}: │ …

---

## [Efficiently Retrieving Variable Values after Gurobi optimization with JuMP](https://discourse.julialang.org/t/efficiently-retrieving-variable-values-after-gurobi-optimization-with-jump/127049)

<div class="topic-metadata">

**Author:** [@Mathis\_3](https://discourse.julialang.org/u/Mathis_3)\
**Replies:** 29\
**Last updated:** [October 23, 2025, 4:45am UTC](https://discourse.julialang.org/t/efficiently-retrieving-variable-values-after-gurobi-optimization-with-jump/127049 "2025-10-23T04:45:19Z")

</div>

Hello, I’m solving a large number of LPs using Gurobi with JuMP, and I noticed that most of the computation time is spent retrieving variable values rather than optimizing the model. Is there a more efficient way to ext…

---

## [Help reformulating nonlinear problem](https://discourse.julialang.org/t/help-reformulating-nonlinear-problem/133292)

<div class="topic-metadata">

**Author:** [@chensunn](https://discourse.julialang.org/u/chensunn)\
**Replies:** 2\
**Last updated:** [October 22, 2025, 8:57pm UTC](https://discourse.julialang.org/t/help-reformulating-nonlinear-problem/133292 "2025-10-22T20:57:29Z")

</div>

I have a nonlinear problem that I wish to solve with Ipopt and derive gradients with DiffOpt.jl. Unfortunately, I’m running into problems with the gradients from DiffOpt. I suspect that I might be able to resolve those i…

---

## [HiGHS solver \>100x slower than Gurobi with bilinear big-m relaxation](https://discourse.julialang.org/t/highs-solver-100x-slower-than-gurobi-with-bilinear-big-m-relaxation/114905)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 3\
**Last updated:** [October 22, 2025, 6:24pm UTC](https://discourse.julialang.org/t/highs-solver-100x-slower-than-gurobi-with-bilinear-big-m-relaxation/114905 "2025-10-22T18:24:08Z")

</div>

I’m not sure where to put this as it’s not specifically an issue, and I’m not sure who would improve it. For my research I need to solve a bilinear model and I’d like to use an open-source solver ideally. ▶ Rough exampl…

---

## [Negative loss when doing parameter estimation of ODEs](https://discourse.julialang.org/t/negative-loss-when-doing-parameter-estimation-of-odes/133299)

<div class="topic-metadata">

**Author:** [@macquarrielucas](https://discourse.julialang.org/u/macquarrielucas)\
**Replies:** 7\
**Last updated:** [October 22, 2025, 9:10am UTC](https://discourse.julialang.org/t/negative-loss-when-doing-parameter-estimation-of-odes/133299 "2025-10-22T09:10:41Z")

</div>

When doing parameter estimation of ODEs using the optim package I’m seeing negative losses returned by the optimizer. I set up a simple example which reproduces it, and I can’t see anything strange I’m doing that might …

---

## [JuMP reports an error when attempting to sum the empty DenseAxisArray as the objective function](https://discourse.julialang.org/t/jump-reports-an-error-when-attempting-to-sum-the-empty-denseaxisarray-as-the-objective-function/133332)

<div class="topic-metadata">

**Author:** [@karei](https://discourse.julialang.org/u/karei)\
**Replies:** 7\
**Last updated:** [October 22, 2025, 1:15am UTC](https://discourse.julialang.org/t/jump-reports-an-error-when-attempting-to-sum-the-empty-denseaxisarray-as-the-objective-function/133332 "2025-10-22T01:15:57Z")

</div>

Minimal Reproducible Example using JuMP set = Symbol\[\] m = Model() @variable(m, x\[i in set\]) @objective(m, Min, sum(x; init=0)) In this case, optimization is not impossible; rather, an unexpected error occurs when the …

---

## [How can I stop a Gurobi solve in JuMP in real time (like Ctrl+C) and still keep the solution?](https://discourse.julialang.org/t/how-can-i-stop-a-gurobi-solve-in-jump-in-real-time-like-ctrl-c-and-still-keep-the-solution/132841)

<div class="topic-metadata">

**Author:** [@amit\_97](https://discourse.julialang.org/u/amit_97)\
**Replies:** 11\
**Last updated:** [October 20, 2025, 1:47am UTC](https://discourse.julialang.org/t/how-can-i-stop-a-gurobi-solve-in-jump-in-real-time-like-ctrl-c-and-still-keep-the-solution/132841 "2025-10-20T01:47:50Z")

</div>

I am using JuMP with Gurobi.jl to solve a MIP. In Julia, pressing Ctrl+C usually kills the entire Julia process instead of just stopping Gurobi. My goal is: Stop the optimization at any arbitrary time (not using MIPG…

---

## [Constraints in the Genetic Algorithm implemented in \`Metaheuristics.jl\`](https://discourse.julialang.org/t/constraints-in-the-genetic-algorithm-implemented-in-metaheuristics-jl/123628)

<div class="topic-metadata">

**Author:** [@AkchurinDA](https://discourse.julialang.org/u/AkchurinDA)\
**Replies:** 7\
**Last updated:** [October 19, 2025, 12:48pm UTC](https://discourse.julialang.org/t/constraints-in-the-genetic-algorithm-implemented-in-metaheuristics-jl/123628 "2025-10-19T12:48:51Z")

</div>

Opening a fresh thread based on the recommendation from @pierre-haessig. My original question was: How does the Genetic Algorithm implemented in Metaheuristics.jl “penalize” the objective function for not satisfying th…

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

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