# Optimization (Mathematical)

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

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

**Page:** 37

---

## [Wram start of HermitianPSDCone in JuMP](https://discourse.julialang.org/t/wram-start-of-hermitianpsdcone-in-jump/105491)

<div class="topic-metadata">

**Author:** [@akirakyle](https://discourse.julialang.org/u/akirakyle)\
**Replies:** 11\
**Last updated:** [November 2, 2023, 10:14pm UTC](https://discourse.julialang.org/t/wram-start-of-hermitianpsdcone-in-jump/105491 "2023-11-02T22:14:43Z")

</div>

I’m having trouble figuring out how to use set\_start\_value with HermitianPSDCone. Here’s a minimal script based on the the quantum discrimination example in the docs: using JuMP using LinearAlgebra import COSMO ρs = \[…

---

## [Using a JuMP \`Bin\` vector to index an array (checkbounds fails with type VariableRef)](https://discourse.julialang.org/t/using-a-jump-bin-vector-to-index-an-array-checkbounds-fails-with-type-variableref/102674)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 15\
**Last updated:** [November 1, 2023, 3:15pm UTC](https://discourse.julialang.org/t/using-a-jump-bin-vector-to-index-an-array-checkbounds-fails-with-type-variableref/102674 "2023-11-01T15:15:28Z")

</div>

Hi there, I am following up from an earlier post \[ How to "prioritize" choosing some parameters over others in Hyperopt.jl or similar packages \] where I was instructed to use JuMP with decision variables. I have a simpl…

---

## [How to Handle Multiple Edges in a Routing Problem Using JuMP?](https://discourse.julialang.org/t/how-to-handle-multiple-edges-in-a-routing-problem-using-jump/104226)

<div class="topic-metadata">

**Author:** [@F\_A](https://discourse.julialang.org/u/F_A)\
**Replies:** 8\
**Last updated:** [October 30, 2023, 9:44pm UTC](https://discourse.julialang.org/t/how-to-handle-multiple-edges-in-a-routing-problem-using-jump/104226 "2023-10-30T21:44:33Z")

</div>

Hi all, I have a multiple edge graph and I want to solve a routing problem on that. I was wondering how to define a binary variables that accounts for all possible edges that exist between let’s say node i to node j. I…

---

## [MethodError: no method matching zero(::Type{Vector{AffExpr}})](https://discourse.julialang.org/t/methoderror-no-method-matching-zero-type-vector-affexpr/105639)

<div class="topic-metadata">

**Author:** [@Kaiming\_Zhang](https://discourse.julialang.org/u/Kaiming_Zhang)\
**Replies:** 5\
**Last updated:** [November 1, 2023, 7:47am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-zero-type-vector-affexpr/105639 "2023-11-01T07:47:19Z")

</div>

I met a method error when running code in Julia 1.9. The code was written in Julia 1.1. How should I modify the code so that it can work? { "name": "MethodError", "message": "MethodError: no method matching zero(::Typ…

---

## [Nonlinear constraints in SDDP](https://discourse.julialang.org/t/nonlinear-constraints-in-sddp/105626)

<div class="topic-metadata">

**Author:** [@Sorooshsa](https://discourse.julialang.org/u/Sorooshsa)\
**Replies:** 3\
**Last updated:** [October 31, 2023, 8:14pm UTC](https://discourse.julialang.org/t/nonlinear-constraints-in-sddp/105626 "2023-10-31T20:14:53Z")

</div>

Hi, I have read the similar topics here: But my case is a bit different. I have a constraint with this formula: gen \<= efficiency\*water\_discharged gen is a continuous control variable, efficiency is a continuous s…

---

## [Status of constraint programming in JuMP](https://discourse.julialang.org/t/status-of-constraint-programming-in-jump/105580)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 3\
**Last updated:** [October 30, 2023, 7:45pm UTC](https://discourse.julialang.org/t/status-of-constraint-programming-in-jump/105580 "2023-10-30T19:45:03Z")

</div>

Now that MathOptInterface v1 supports constraint programming, what is the status of this modeling paradigm in the JuMP ecosystem? I found this checklist issue but it is a bit hard to parse for outsiders, so I wanted to m…

---

## [How to set a Non-linear function with double summatory](https://discourse.julialang.org/t/how-to-set-a-non-linear-function-with-double-summatory/105542)

<div class="topic-metadata">

**Author:** [@PatrickeTownsend](https://discourse.julialang.org/u/PatrickeTownsend)\
**Replies:** 4\
**Last updated:** [October 29, 2023, 9:18pm UTC](https://discourse.julialang.org/t/how-to-set-a-non-linear-function-with-double-summatory/105542 "2023-10-29T21:18:54Z")

</div>

Hello Again! I’m trying to solve this optimization problem: But i’m not really sure about how to write down that objective function, I tried doing this: using JuMP using Ipopt model = Model(Ipopt.Optimizer) set\_att…

---

## [Solving F(X)=0 using nlsolve](https://discourse.julialang.org/t/solving-f-x-0-using-nlsolve/105516)

<div class="topic-metadata">

**Author:** [@havana](https://discourse.julialang.org/u/havana)\
**Replies:** 6\
**Last updated:** [October 28, 2023, 9:29pm UTC](https://discourse.julialang.org/t/solving-f-x-0-using-nlsolve/105516 "2023-10-28T21:29:38Z")

</div>

I wanna solve a root finding problem of the form F(X)=0 using NLsolve. However, I do not know the regularity of the function F, for example if it is not differentiable, so the Jacobian does not exists, how do the functi…

---

## [Variant of an "elseif" loop with binary values](https://discourse.julialang.org/t/variant-of-an-elseif-loop-with-binary-values/105348)

<div class="topic-metadata">

**Author:** [@Fabian1](https://discourse.julialang.org/u/Fabian1)\
**Replies:** 3\
**Last updated:** [October 25, 2023, 6:53am UTC](https://discourse.julialang.org/t/variant-of-an-elseif-loop-with-binary-values/105348 "2023-10-25T06:53:19Z")

</div>

Hi ! I’m looking for another possibility to implement my elseif loop for my linear program. The goal is to implement the following: if q\_out \>= 9 eff == 0.75 elseif 7 \<= q\_out \< 9 eff == 1 else eff == 0.5 …

---

## [User defined function inside JuMP Objective resulting in MethodError](https://discourse.julialang.org/t/user-defined-function-inside-jump-objective-resulting-in-methoderror/105332)

<div class="topic-metadata">

**Author:** [@philds](https://discourse.julialang.org/u/philds)\
**Replies:** 6\
**Last updated:** [October 25, 2023, 1:32am UTC](https://discourse.julialang.org/t/user-defined-function-inside-jump-objective-resulting-in-methoderror/105332 "2023-10-25T01:32:25Z")

</div>

Hi there, I’m trying to formulate an optimization model that maximizes profit while dealing with the transportation of raw supplies and production of goods. The profit calculation is lengthy and depends upon both decisi…

---

## [JuMP whit PATHSolver](https://discourse.julialang.org/t/jump-whit-pathsolver/105347)

<div class="topic-metadata">

**Author:** [@sjhon](https://discourse.julialang.org/u/sjhon)\
**Replies:** 1\
**Last updated:** [October 24, 2023, 8:59pm UTC](https://discourse.julialang.org/t/jump-whit-pathsolver/105347 "2023-10-24T20:59:01Z")

</div>

I am trying to define this variable T: using JuMP import PATHSolver @variable(modelo, 0 \<= T\[ω = 1:5\] \<= (ω-1)\*0.25, start = 1) Defined with this restriction: @constraint(modelo, \[ω = 1:5\], (c\[ω\]\*(1-α)-s)Y\[ω\] -(BQ\[ω…

---

## [Solving a nonlinear equation with NonlinearSolve.jl 2.X](https://discourse.julialang.org/t/solving-a-nonlinear-equation-with-nonlinearsolve-jl-2-x/105303)

<div class="topic-metadata">

**Author:** [@marast](https://discourse.julialang.org/u/marast)\
**Replies:** 12\
**Last updated:** [October 23, 2023, 4:08pm UTC](https://discourse.julialang.org/t/solving-a-nonlinear-equation-with-nonlinearsolve-jl-2-x/105303 "2023-10-23T16:08:40Z")

</div>

Hello, starting from NonlinearSolve.jl version 2.0 my code stopped working. I reduced it to the following MWE: using NonlinearSolve function exec\_mwe() f(u, p) = \[(u\[1\] - p\[1\])^2 + (u\[2\] - p\[2\])^2\] u0 = rand(2…

---

## [Writing legible JuMP models](https://discourse.julialang.org/t/writing-legible-jump-models/105280)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 8\
**Last updated:** [October 23, 2023, 10:44am UTC](https://discourse.julialang.org/t/writing-legible-jump-models/105280 "2023-10-23T10:44:44Z")

</div>

I maintain a few large integer programming routines using the Python OR-Tools package. I have grown quite attached to the following code style, which breaks the compilation of the larger optimization problem into self-co…

---

## [Modeling with a spline a signal peak's shape from multiple datasets that captured the same event](https://discourse.julialang.org/t/modeling-with-a-spline-a-signal-peaks-shape-from-multiple-datasets-that-captured-the-same-event/104795)

<div class="topic-metadata">

**Author:** [@oniehuis](https://discourse.julialang.org/u/oniehuis)\
**Replies:** 7\
**Last updated:** [October 23, 2023, 9:00am UTC](https://discourse.julialang.org/t/modeling-with-a-spline-a-signal-peaks-shape-from-multiple-datasets-that-captured-the-same-event/104795 "2023-10-23T09:00:46Z")

</div>

I have time series data in which the recorded values capture a signal (i.e., peak) that emerges from an elevated noise floor (i.e., baseline; can be modeled as a straight line). The shape of the peak in the various time …

---

## [NLOPT While loop problem](https://discourse.julialang.org/t/nlopt-while-loop-problem/104882)

<div class="topic-metadata">

**Author:** [@mary](https://discourse.julialang.org/u/mary)\
**Replies:** 14\
**Last updated:** [October 22, 2023, 1:41am UTC](https://discourse.julialang.org/t/nlopt-while-loop-problem/104882 "2023-10-22T01:41:23Z")

</div>

Hi All, I am using gridap for topology optimization. I have defined function of optimization using MMA as below using NLopt function gf\_p\_optimize(p\_init; r, β, η, TOL = 1e-4, fem\_params) ##################### Opti…

---

## [Optim.jl + adding constraints](https://discourse.julialang.org/t/optim-jl-adding-constraints/51861)

<div class="topic-metadata">

**Author:** [@jovansam](https://discourse.julialang.org/u/jovansam)\
**Replies:** 7\
**Last updated:** [October 21, 2023, 6:54pm UTC](https://discourse.julialang.org/t/optim-jl-adding-constraints/51861 "2023-10-21T18:54:28Z")

</div>

I want to add equality constraints to Optim.jl (not just a box-constrained optimization). My understanding is that there were plans to add this feature. Does anybody know if this stalled? This package I see was intende…

---

## [Derived keys for indexing into JuMP containers](https://discourse.julialang.org/t/derived-keys-for-indexing-into-jump-containers/105205)

<div class="topic-metadata">

**Author:** [@thevolatilebit](https://discourse.julialang.org/u/thevolatilebit)\
**Replies:** 5\
**Last updated:** [October 21, 2023, 1:38am UTC](https://discourse.julialang.org/t/derived-keys-for-indexing-into-jump-containers/105205 "2023-10-21T01:38:19Z")

</div>

I am seeking to better understand JuMP’s indexing functionality. As I understand it, when a set of decision variables or constraints in a container is created, JuMP automatically uses the elements of the set as the index…

---

## [Declaring large number of variables in JuMP](https://discourse.julialang.org/t/declaring-large-number-of-variables-in-jump/105214)

<div class="topic-metadata">

**Author:** [@Josa9321](https://discourse.julialang.org/u/Josa9321)\
**Replies:** 1\
**Last updated:** [October 20, 2023, 5:41am UTC](https://discourse.julialang.org/t/declaring-large-number-of-variables-in-jump/105214 "2023-10-20T05:41:48Z")

</div>

Hi people, Is it expected for this code to utilize such a significant amount of memory, given the following Julia code that defines variables within a JuMP optimization model? using JuMP, CPLEX m = Model(CPLEX.Optimize…

---

## [There are some doubts about the results of the experiments in the Powermodels documentation](https://discourse.julialang.org/t/there-are-some-doubts-about-the-results-of-the-experiments-in-the-powermodels-documentation/105210)

<div class="topic-metadata">

**Author:** [@lzq-zbc](https://discourse.julialang.org/u/lzq-zbc)\
**Replies:** 1\
**Last updated:** [October 20, 2023, 2:16am UTC](https://discourse.julialang.org/t/there-are-some-doubts-about-the-results-of-the-experiments-in-the-powermodels-documentation/105210 "2023-10-20T02:16:20Z")

</div>

I would like to consult the following documents about the experimental results, for example, the calculation time of the SoC model of case1354\_pegase is 3 seconds, but I calculate the time on my personal computer is 17 s…

---

## [PRIMA: a package for solving general nonlinear optimization problems without using derivatives](https://discourse.julialang.org/t/prima-a-package-for-solving-general-nonlinear-optimization-problems-without-using-derivatives/105134)

<div class="topic-metadata">

**Author:** [@Zaikun](https://discourse.julialang.org/u/Zaikun)\
**Replies:** 4\
**Last updated:** [October 19, 2023, 2:05am UTC](https://discourse.julialang.org/t/prima-a-package-for-solving-general-nonlinear-optimization-problems-without-using-derivatives/105134 "2023-10-19T02:05:19Z")

</div>

Hi everyone, I am very glad to announce PRIMA, a package for solving general nonlinear optimization problems without using derivatives. PRIMA provides the reference implementation for M.J.D. Powell’s renowned derivativ…

---

## [Finding some undocumented JuMP optimizers](https://discourse.julialang.org/t/finding-some-undocumented-jump-optimizers/105102)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 1\
**Last updated:** [October 18, 2023, 11:04am UTC](https://discourse.julialang.org/t/finding-some-undocumented-jump-optimizers/105102 "2023-10-18T11:04:38Z")

</div>

Sometimes, the developers did not add the solver to the documentation. However, if JuMP is a hub for optimization solvers, we might consider adding them. Searching for Ising optimization, I found one. https://github.co…

---

## [Scip optimizer presolver components takes too long to optimize matrix](https://discourse.julialang.org/t/scip-optimizer-presolver-components-takes-too-long-to-optimize-matrix/105066)

<div class="topic-metadata">

**Author:** [@mrFox](https://discourse.julialang.org/u/mrFox)\
**Replies:** 1\
**Last updated:** [October 17, 2023, 11:57pm UTC](https://discourse.julialang.org/t/scip-optimizer-presolver-components-takes-too-long-to-optimize-matrix/105066 "2023-10-17T23:57:32Z")

</div>

there are two milp problems. When I use gurobi optimizer they are calculated quite quickly: 263s for matrix 1 and 139s for matrix 2. If I use scip optimizer with parallel extension fiberscip the solution cannot be found.…

---

## [Primal/dual optimization scaling for numerical stability](https://discourse.julialang.org/t/primal-dual-optimization-scaling-for-numerical-stability/105083)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 1\
**Last updated:** [October 17, 2023, 11:51pm UTC](https://discourse.julialang.org/t/primal-dual-optimization-scaling-for-numerical-stability/105083 "2023-10-17T23:51:36Z")

</div>

I am solving a convex QP via ALM and am using Gurobi.jl for benchmarking. I noticed that Gurobi implements some problem scaling techniques (slightly more detail here: https://support.gurobi.com/hc/en-us/community/posts/1…

---

## [3D expression in JuMP](https://discourse.julialang.org/t/3d-expression-in-jump/105014)

<div class="topic-metadata">

**Author:** [@papar](https://discourse.julialang.org/u/papar)\
**Replies:** 3\
**Last updated:** [October 17, 2023, 9:37pm UTC](https://discourse.julialang.org/t/3d-expression-in-jump/105014 "2023-10-17T21:37:48Z")

</div>

I want to build the following expression in the optimisation problem defined below. A\_{i0s} = x\_i A\_{its} = A\_{i,t-1,s} + y\_{its} - z\_{its} \\quad \\forall s, \\forall i, \\forall t \> 0 I have given the code that I tr…

---

## [What is the difference between nonlinear "functions with vector outputs" and nonlinear "operators with vector outputs"?](https://discourse.julialang.org/t/what-is-the-difference-between-nonlinear-functions-with-vector-outputs-and-nonlinear-operators-with-vector-outputs/105012)

<div class="topic-metadata">

**Author:** [@justinberi](https://discourse.julialang.org/u/justinberi)\
**Replies:** 2\
**Last updated:** [October 16, 2023, 3:13pm UTC](https://discourse.julialang.org/t/what-is-the-difference-between-nonlinear-functions-with-vector-outputs-and-nonlinear-operators-with-vector-outputs/105012 "2023-10-16T15:13:57Z")

</div>

The JuMP documentation and this answer suggests that nonlinear user-defined functions with vector outputs need to be defined using many @operators. The documentation actually says “User-defined operators …”. This post …

---

## [@constraint with ForwardDiff.gradient](https://discourse.julialang.org/t/constraint-with-forwarddiff-gradient/104949)

<div class="topic-metadata">

**Author:** [@justinberi](https://discourse.julialang.org/u/justinberi)\
**Replies:** 3\
**Last updated:** [October 16, 2023, 1:05pm UTC](https://discourse.julialang.org/t/constraint-with-forwarddiff-gradient/104949 "2023-10-16T13:05:56Z")

</div>

Hi All, Thanks in advance for any help and suggestions. I’m new to Julia (and JuMP) so go easy. Is there a way to use ForwardDiff.gradient within a nonlinear constraint in JuMP? An example is # Solve using JuMP inter…

---

## [Accessing cost data in UnitCommitment.jl](https://discourse.julialang.org/t/accessing-cost-data-in-unitcommitment-jl/103510)

<div class="topic-metadata">

**Author:** [@skelly5](https://discourse.julialang.org/u/skelly5)\
**Replies:** 3\
**Last updated:** [October 15, 2023, 11:35pm UTC](https://discourse.julialang.org/t/accessing-cost-data-in-unitcommitment-jl/103510 "2023-10-15T23:35:11Z")

</div>

I’m trying to access data for generator cost in the UnitCommitment.jl. I was wondering, in matpower/case2383wp/2017-02-01, why do some of the generators (such as generators 12 and 39) have an empty cost\_segments, while o…

---

## [Solving a neoclassical growth model via PATHSolver (but solution is wrong)](https://discourse.julialang.org/t/solving-a-neoclassical-growth-model-via-pathsolver-but-solution-is-wrong/104979)

<div class="topic-metadata">

**Author:** [@jovansam](https://discourse.julialang.org/u/jovansam)\
**Replies:** 2\
**Last updated:** [October 15, 2023, 9:51pm UTC](https://discourse.julialang.org/t/solving-a-neoclassical-growth-model-via-pathsolver-but-solution-is-wrong/104979 "2023-10-15T21:51:23Z")

</div>

Hi. I am solving the following neoclassical growth model via the PATHSolver (i.e. MCP formulation). I know the solution is wrong as consumption is unusually high and not inline with what I get from GAMS. I suspect this s…

---

## [Filtering variables on model copy](https://discourse.julialang.org/t/filtering-variables-on-model-copy/104843)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 5\
**Last updated:** [October 12, 2023, 7:44am UTC](https://discourse.julialang.org/t/filtering-variables-on-model-copy/104843 "2023-10-12T07:44:57Z")

</div>

I am looking to take a model model\_1 and “duplicate” it into model\_2 (using copy\_model) while only keeping a specific part of the original model. I know that I can use filter\_constraints to mask out constraints that I …

---

## [Error in NL Optimization involving integral of Incomplete Beta Function](https://discourse.julialang.org/t/error-in-nl-optimization-involving-integral-of-incomplete-beta-function/104627)

<div class="topic-metadata">

**Author:** [@thvo1304](https://discourse.julialang.org/u/thvo1304)\
**Replies:** 2\
**Last updated:** [October 11, 2023, 6:25pm UTC](https://discourse.julialang.org/t/error-in-nl-optimization-involving-integral-of-incomplete-beta-function/104627 "2023-10-11T18:25:20Z")

</div>

Hello everyone, I’m trying to build an optimization problem using Julia but keep getting error. My objective function is: Max ∫01 Bx(n - λn, λn + 1) ⁄ Bx(n - &lambda - 1;n…

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

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