# Optimization (Mathematical)

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

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

**Page:** 15

---

## [Performant L-Shaped/PH Implementations in Julia?](https://discourse.julialang.org/t/performant-l-shaped-ph-implementations-in-julia/125276)

<div class="topic-metadata">

**Author:** [@Sunash\_Sharma](https://discourse.julialang.org/u/Sunash_Sharma)\
**Replies:** 5\
**Last updated:** [January 27, 2025, 10:40pm UTC](https://discourse.julialang.org/t/performant-l-shaped-ph-implementations-in-julia/125276 "2025-01-27T22:40:44Z")

</div>

Hi everyone, I want to solve a large two-stage stochastic optimization problem with a large number of scenarios (think around ~500 second stage scenarios and ~50-100 binary first stage decisions). As such, I need to use…

---

## [Licensing Issues with Gurobi.jl on Cluster](https://discourse.julialang.org/t/licensing-issues-with-gurobi-jl-on-cluster/125270)

<div class="topic-metadata">

**Author:** [@Sunash\_Sharma](https://discourse.julialang.org/u/Sunash_Sharma)\
**Replies:** 3\
**Last updated:** [January 27, 2025, 9:37pm UTC](https://discourse.julialang.org/t/licensing-issues-with-gurobi-jl-on-cluster/125270 "2025-01-27T21:37:45Z")

</div>

TL;DR: Is there a way to use Gurobi.jl and distributed algorithms from StochasticPrograms.jl in a way that works on a cluster, given that StochasticPrograms.jl requires JuMP.jl version 1.2.1? Hi everyone, I’m planning …

---

## [Gurobi.jl numerical trouble in optimal power flow](https://discourse.julialang.org/t/gurobi-jl-numerical-trouble-in-optimal-power-flow/125267)

<div class="topic-metadata">

**Author:** [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Replies:** 5\
**Last updated:** [January 27, 2025, 9:29pm UTC](https://discourse.julialang.org/t/gurobi-jl-numerical-trouble-in-optimal-power-flow/125267 "2025-01-27T21:29:06Z")

</div>

Hi. I am trying to model one of the ‘classic’ conic relaxations of the optimal powerflow model (see Branch Flow Model: Relaxations and Convexification—Part I) The problem I am running into is that depending on the loads…

---

## [Problems with accessing ODE parameters after optimisation when modelling with ModelingToolkit](https://discourse.julialang.org/t/problems-with-accessing-ode-parameters-after-optimisation-when-modelling-with-modelingtoolkit/112323)

<div class="topic-metadata">

**Author:** [@giro](https://discourse.julialang.org/u/giro)\
**Replies:** 8\
**Last updated:** [January 26, 2025, 5:54pm UTC](https://discourse.julialang.org/t/problems-with-accessing-ode-parameters-after-optimisation-when-modelling-with-modelingtoolkit/112323 "2025-01-26T17:54:02Z")

</div>

Hello, I am working with a small non-linear ODE problem to model some protein dynamics data. I am fitting my model to the data and estimating the parameters using Optimization.jl. So far everything worked fine, my probl…

---

## [JuMP.jl optimization which solver](https://discourse.julialang.org/t/jump-jl-optimization-which-solver/125182)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 5\
**Last updated:** [January 25, 2025, 9:48pm UTC](https://discourse.julialang.org/t/jump-jl-optimization-which-solver/125182 "2025-01-25T21:48:10Z")

</div>

I have an optimization problem, but I am unsure which solver to use. I think JuMP.jl might work for this (the problem looks linear to me). Either @objective(....) gives me an error or optimize!(model) errors. The prob…

---

## [Is it possible to do topology optimization with JuMP.jl?](https://discourse.julialang.org/t/is-it-possible-to-do-topology-optimization-with-jump-jl/125075)

<div class="topic-metadata">

**Author:** [@maphdze](https://discourse.julialang.org/u/maphdze)\
**Replies:** 4\
**Last updated:** [January 24, 2025, 10:49pm UTC](https://discourse.julialang.org/t/is-it-possible-to-do-topology-optimization-with-jump-jl/125075 "2025-01-24T22:49:30Z")

</div>

Hello everyone! I would like to know if it is possible to do topology optimization with JuMP.jl? For topology optimization problems the stiffness matrix changes in each step, could this be formulated in JuMP.jl? In the t…

---

## [Help making ForwardDiff.derivative work](https://discourse.julialang.org/t/help-making-forwarddiff-derivative-work/125167)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 2\
**Last updated:** [January 24, 2025, 1:42pm UTC](https://discourse.julialang.org/t/help-making-forwarddiff-derivative-work/125167 "2025-01-24T13:42:45Z")

</div>

Hi there, I define my custom parametric types as follows: struct Parameters{T} """ inmutable type to pack the parameters estimated. """ ϕ::T λ::T γ₁::T end struct MarketPostEstimation{T} …

---

## [Non-Differentiable Constraints](https://discourse.julialang.org/t/non-differentiable-constraints/125113)

<div class="topic-metadata">

**Author:** [@Alessio\_Bellisomi](https://discourse.julialang.org/u/Alessio_Bellisomi)\
**Replies:** 3\
**Last updated:** [January 24, 2025, 10:18am UTC](https://discourse.julialang.org/t/non-differentiable-constraints/125113 "2025-01-24T10:18:03Z")

</div>

I am trying to write an optimization routine for insurance book. The target is to be able to increase the return without affecting the tail value at risk by modifying the shares for each contract. This is an example of …

---

## [Feature proposal: Saving symbolic derivatives](https://discourse.julialang.org/t/feature-proposal-saving-symbolic-derivatives/124956)

<div class="topic-metadata">

**Author:** [@KSepetanc](https://discourse.julialang.org/u/KSepetanc)\
**Replies:** 2\
**Last updated:** [January 24, 2025, 9:55am UTC](https://discourse.julialang.org/t/feature-proposal-saving-symbolic-derivatives/124956 "2025-01-24T09:55:14Z")

</div>

@odow I am starting discussion about new feature for MathOptSymbolicAD.jl . I think adding option to save symbolic derivative expressions to file would be useful. Many of us develop applications where we do not care ab…

---

## [How to refer to a JuMP variable using a string when the model is defined in a module?](https://discourse.julialang.org/t/how-to-refer-to-a-jump-variable-using-a-string-when-the-model-is-defined-in-a-module/125122)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 3\
**Last updated:** [January 24, 2025, 8:23am UTC](https://discourse.julialang.org/t/how-to-refer-to-a-jump-variable-using-a-string-when-the-model-is-defined-in-a-module/125122 "2025-01-24T08:23:26Z")

</div>

Hello, in a JuMP model I need to fix some variables, and these variables to fix are defined in a dictionary. This works: using JuMP, Ipopt fvars = Dict{String,Float64}("c" =\> 5) m = Model(Ipopt.Optimizer) # \[...\] @va…

---

## [JuMP register function](https://discourse.julialang.org/t/jump-register-function/125099)

<div class="topic-metadata">

**Author:** [@Sushrut\_Deshpande](https://discourse.julialang.org/u/Sushrut_Deshpande)\
**Replies:** 4\
**Last updated:** [January 23, 2025, 6:33am UTC](https://discourse.julialang.org/t/jump-register-function/125099 "2025-01-23T06:33:44Z")

</div>

Hello, This is my first time using JuMP hence my question is basic. The following fails using JuMP, Ipopt f(x) = x\[1\]^2 + x\[2\]^2 ∇f(x) = \[2\*x\[1\], 2\*x\[2\]\] ∇²f(x) = \[2 0; 0 2\] model = Model(Ipopt.Optimizer) register(mo…

---

## [Updates to JuMP dependencies (MathOptInterface) affecting results](https://discourse.julialang.org/t/updates-to-jump-dependencies-mathoptinterface-affecting-results/125058)

<div class="topic-metadata">

**Author:** [@nealhughes](https://discourse.julialang.org/u/nealhughes)\
**Replies:** 3\
**Last updated:** [January 22, 2025, 7:22pm UTC](https://discourse.julialang.org/t/updates-to-jump-dependencies-mathoptinterface-affecting-results/125058 "2025-01-22T19:22:56Z")

</div>

I have a large JuMP project developed on older versions of Julia (1.7.0) and JuMP (1.22.1) (because I was stuck on a corporate IT system and it was hard to update). I’ve since moved my project to a new IT system, and us…

---

## [Unsatisfying results from the calibration of a model](https://discourse.julialang.org/t/unsatisfying-results-from-the-calibration-of-a-model/124912)

<div class="topic-metadata">

**Author:** [@Iforire](https://discourse.julialang.org/u/Iforire)\
**Replies:** 3\
**Last updated:** [January 22, 2025, 9:17am UTC](https://discourse.julialang.org/t/unsatisfying-results-from-the-calibration-of-a-model/124912 "2025-01-22T09:17:54Z")

</div>

Hi everyone, First of all, I am quite new to Julia and not at all an expert in either coding or optimization/modelling! I want to calibate the following model with 2 parameters to calibrate (K\[1\] and K\[2\]) and 2 variab…

---

## [Bilevel JuMP](https://discourse.julialang.org/t/bilevel-jump/44068)

<div class="topic-metadata">

**Author:** [@dty](https://discourse.julialang.org/u/dty)\
**Replies:** 50\
**Last updated:** [January 22, 2025, 3:59am UTC](https://discourse.julialang.org/t/bilevel-jump/44068 "2025-01-22T03:59:34Z")

</div>

How to define the right objective function in jump？Is there a problem with my definition? In addition, if the objective function is composed of multiple sub functions and cannot be represented by a single formula, the su…

---

## [Solver and AD advice for nonlinear LS problem](https://discourse.julialang.org/t/solver-and-ad-advice-for-nonlinear-ls-problem/125014)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [January 21, 2025, 5:26pm UTC](https://discourse.julialang.org/t/solver-and-ad-advice-for-nonlinear-ls-problem/125014 "2025-01-21T17:26:51Z")

</div>

(This is a vague open-ended question for which I cannot provide an MWE.) I have a nonlinear least squares problem \\min\_x \\| f(x) \\|\_2^2 where x \\in \\mathbb{R}^N, N \\approx 20...40, and f(x) has about 100–200 elements…

---

## [Changing the relstep of AutoFiniteDiff() in an OptimizationFunction](https://discourse.julialang.org/t/changing-the-relstep-of-autofinitediff-in-an-optimizationfunction/125004)

<div class="topic-metadata">

**Author:** [@Bart\_van\_de\_Lint](https://discourse.julialang.org/u/Bart_van_de_Lint)\
**Replies:** 5\
**Last updated:** [January 21, 2025, 11:19am UTC](https://discourse.julialang.org/t/changing-the-relstep-of-autofinitediff-in-an-optimizationfunction/125004 "2025-01-21T11:19:58Z")

</div>

I want to define an OptimizationProblem using Optimization.jl and FiniteDiff: optf = OptimizationFunction(f\_zero, AutoFiniteDiff()) prob = OptimizationProblem(optf, \[stretched\_tether\_length - 0.05, 0.0, 0.0, 0.0…

---

## [Creating Constraints Quickly](https://discourse.julialang.org/t/creating-constraints-quickly/124947)

<div class="topic-metadata">

**Author:** [@cs1231](https://discourse.julialang.org/u/cs1231)\
**Replies:** 1\
**Last updated:** [January 21, 2025, 7:03am UTC](https://discourse.julialang.org/t/creating-constraints-quickly/124947 "2025-01-21T07:03:34Z")

</div>

I have been using Mathematica with my optimisation problem and am now keen to try the optimisation tools in Julia (SDDP in particular). Am new Julia so plz bear with me. In my optimisation problem, my constraints are ac…

---

## [Why is IPOPT executed repeatedly for OPF on MultiNetworks from PowerModels.jl?](https://discourse.julialang.org/t/why-is-ipopt-executed-repeatedly-for-opf-on-multinetworks-from-powermodels-jl/124936)

<div class="topic-metadata">

**Author:** [@beccy\_julia](https://discourse.julialang.org/u/beccy_julia)\
**Replies:** 5\
**Last updated:** [January 20, 2025, 2:09am UTC](https://discourse.julialang.org/t/why-is-ipopt-executed-repeatedly-for-opf-on-multinetworks-from-powermodels-jl/124936 "2025-01-20T02:09:13Z")

</div>

Dear community, I am using Multi Networks from PowerModels.jl on which I would like to run Optimal Power Flow (OPF). I use the MINLP solver Juniper with IPOPT as the nlp-solver. As a test grid I take the IEEE case14 and …

---

## [JuMP - Finding feasible discrete solutions](https://discourse.julialang.org/t/jump-finding-feasible-discrete-solutions/124865)

<div class="topic-metadata">

**Author:** [@samram](https://discourse.julialang.org/u/samram)\
**Replies:** 6\
**Last updated:** [January 19, 2025, 11:21am UTC](https://discourse.julialang.org/t/jump-finding-feasible-discrete-solutions/124865 "2025-01-19T11:21:43Z")

</div>

Hi - I’ve been enjoying experimenting with JuMP recently and I’m very grateful to the devs for open-sourcing this project. In general, I need to solve constrained non-linear mixed-integer optimisation problems. I’ve had …

---

## [Is it possible to fetch results from solved model asynchronously](https://discourse.julialang.org/t/is-it-possible-to-fetch-results-from-solved-model-asynchronously/124888)

<div class="topic-metadata">

**Author:** [@Betristor](https://discourse.julialang.org/u/Betristor)\
**Replies:** 1\
**Last updated:** [January 18, 2025, 6:46am UTC](https://discourse.julialang.org/t/is-it-possible-to-fetch-results-from-solved-model-asynchronously/124888 "2025-01-18T06:46:11Z")

</div>

Suppose I have a model as follows: using CSV using JuMP using HiGHS using Random using DataFrames Random.seed!(2025) Z = 3 T = 8760 coef = rand(Float64, (Z,T)) m = Model(HiGHS.Optimizer) @variable(m, x1\[z in 1:Z, t in…

---

## [JuMP - Update constraint with matrix coefficient](https://discourse.julialang.org/t/jump-update-constraint-with-matrix-coefficient/124844)

<div class="topic-metadata">

**Author:** [@luccafaro](https://discourse.julialang.org/u/luccafaro)\
**Replies:** 2\
**Last updated:** [January 17, 2025, 12:43pm UTC](https://discourse.julialang.org/t/jump-update-constraint-with-matrix-coefficient/124844 "2025-01-17T12:43:33Z")

</div>

Hi everyone :grinning: I’m trying to iteratively solve an optimisation problem in which most of the elements (e.g. objective function and constraints) remain the same over the iterations, but the constraint below needs …

---

## [KNITRO.jl and Complementarity Constraints](https://discourse.julialang.org/t/knitro-jl-and-complementarity-constraints/124090)

<div class="topic-metadata">

**Author:** [@daro.slai](https://discourse.julialang.org/u/daro.slai)\
**Replies:** 3\
**Last updated:** [January 15, 2025, 11:39am UTC](https://discourse.julialang.org/t/knitro-jl-and-complementarity-constraints/124090 "2025-01-15T11:39:50Z")

</div>

Hi, I’m modeling a system with complementarity constraints.Namely, a flow S has a negative S^- and positive S^+ component: S=S^+ - S^- 0 \\leq S^+ 0 \\leq S^- and of course complementary to each other: S^+ \\perp S^…

---

## [How to train a biobjective problem with SDDP.jl?](https://discourse.julialang.org/t/how-to-train-a-biobjective-problem-with-sddp-jl/123590)

<div class="topic-metadata">

**Author:** [@z\_yt\_Yt](https://discourse.julialang.org/u/z_yt_Yt)\
**Replies:** 10\
**Last updated:** [January 14, 2025, 11:49pm UTC](https://discourse.julialang.org/t/how-to-train-a-biobjective-problem-with-sddp-jl/123590 "2025-01-14T23:49:08Z")

</div>

Hello, I am trying to run this SDDP.jl/papers/biobjective\_sddp/BiObjectiveSDDP.jl at master · odow/SDDP.jl · GitHub and also other files in this folder SDDP.jl/papers/biobjective\_sddp at master · odow/SDDP.jl · GitHub. …

---

## [Minimizing a nonlinear user function](https://discourse.julialang.org/t/minimizing-a-nonlinear-user-function/124772)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 1\
**Last updated:** [January 14, 2025, 7:32pm UTC](https://discourse.julialang.org/t/minimizing-a-nonlinear-user-function/124772 "2025-01-14T19:32:25Z")

</div>

I would like to know if and how the problem discussed Here can be solved using JuMP’s “powerfull means” This is the problem of day 24 of the advent of code 2024. You are asked to “fix” a 45-bit full-adder that has 4 p…

---

## [Need a working example to use Gurobi for multi objective](https://discourse.julialang.org/t/need-a-working-example-to-use-gurobi-for-multi-objective/124760)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 2\
**Last updated:** [January 14, 2025, 7:29pm UTC](https://discourse.julialang.org/t/need-a-working-example-to-use-gurobi-for-multi-objective/124760 "2025-01-14T19:29:26Z")

</div>

Hi Everyone, can some one provide working example for Gurobi Multi objective. Thanks in advance

---

## [Lux, optimization on gpu](https://discourse.julialang.org/t/lux-optimization-on-gpu/124678)

<div class="topic-metadata">

**Author:** [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Replies:** 8\
**Last updated:** [January 13, 2025, 4:16pm UTC](https://discourse.julialang.org/t/lux-optimization-on-gpu/124678 "2025-01-13T16:16:57Z")

</div>

Hello I try to perform the example from Train NN with Sophia \[1\] on GPU I tried to get sample working on gpu by using CUDA, LuxCUDA x = rand(10,10) y = sin.(x) data = MLUtils.DataLoader((x, y), batchsize = 1) # Defin…

---

## [Reducing number of allocations](https://discourse.julialang.org/t/reducing-number-of-allocations/124646)

<div class="topic-metadata">

**Author:** [@arnauqb](https://discourse.julialang.org/u/arnauqb)\
**Replies:** 4\
**Last updated:** [January 13, 2025, 8:19am UTC](https://discourse.julialang.org/t/reducing-number-of-allocations/124646 "2025-01-13T08:19:52Z")

</div>

I am playing around with JuMP to compare its performance to pyomo. This is the model I am using: using JuMP using GLPK using LinearAlgebra using BenchmarkTools function run\_market\_opt(max\_production::AbstractVector{T},…

---

## [BlackBoxOptim - beginner's questions](https://discourse.julialang.org/t/blackboxoptim-beginners-questions/37013)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 16\
**Last updated:** [January 12, 2025, 9:07pm UTC](https://discourse.julialang.org/t/blackboxoptim-beginners-questions/37013 "2025-01-12T21:07:18Z")

</div>

I am new to solving optimization problems. So please excuse any ignorance in my questions. I am using BlackBoxOptim.jl, and I have a few questions: Initial guess and search range. I see that there is an optional arg…

---

## [MadNLPGPU with cuDSS and other linear solvers](https://discourse.julialang.org/t/madnlpgpu-with-cudss-and-other-linear-solvers/124558)

<div class="topic-metadata">

**Author:** [@gangway](https://discourse.julialang.org/u/gangway)\
**Replies:** 4\
**Last updated:** [January 9, 2025, 11:55pm UTC](https://discourse.julialang.org/t/madnlpgpu-with-cudss-and-other-linear-solvers/124558 "2025-01-09T23:55:12Z")

</div>

Trying to solve nonlinear JuMP models with MadNLP.Optimizer(linear\_solver=CUDSSSolver). I have added MadNLP, MadNLPGPU, CUDSS, and CUDSS\_jll. While activating project, I keep getting warning for circular dependencies. …

---

## [Variable start values from Dict](https://discourse.julialang.org/t/variable-start-values-from-dict/124650)

<div class="topic-metadata">

**Author:** [@maxminn](https://discourse.julialang.org/u/maxminn)\
**Replies:** 2\
**Last updated:** [January 10, 2025, 7:31pm UTC](https://discourse.julialang.org/t/variable-start-values-from-dict/124650 "2025-01-10T19:31:07Z")

</div>

I want to initialize a variable that is indexed by sets of strings to a dictionary with keys that are tuples of those same sets A = \["cat","dog"\] R = \["E" , "W"\] X0 = Dict( ("cat","E") =\> 1.1, ("cat","W") =\> 1.2…

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

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