# Optimization (Mathematical)

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

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

**Page:** 13

---

## [Sometimes gc error?](https://discourse.julialang.org/t/sometimes-gc-error/127080)

<div class="topic-metadata">

**Author:** [@leonie25](https://discourse.julialang.org/u/leonie25)\
**Replies:** 9\
**Last updated:** [March 19, 2025, 8:34am UTC](https://discourse.julialang.org/t/sometimes-gc-error/127080 "2025-03-19T08:34:28Z")

</div>

Modeling with jump, same code, most of the time it works fine, sometimes it reports errors like below: gc\_setmark\_pool\_ at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honey…

---

## [Mosek.jl version 11 installation issue](https://discourse.julialang.org/t/mosek-jl-version-11-installation-issue/126982)

<div class="topic-metadata">

**Author:** [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Replies:** 5\
**Last updated:** [March 18, 2025, 7:41pm UTC](https://discourse.julialang.org/t/mosek-jl-version-11-installation-issue/126982 "2025-03-18T19:41:22Z")

</div>

Can someone please confirm whether Mosek.jl and MosekTools.jl support Mosek version 11? I get the following message: (@v1.11) pkg\> add Mosek Resolving package versions... Installed Mosek ─ v10.2.0 No Changes to…

---

## [The solution deteriorates if the domain of decisions is improperly set when using Ipopt](https://discourse.julialang.org/t/the-solution-deteriorates-if-the-domain-of-decisions-is-improperly-set-when-using-ipopt/126743)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 4\
**Last updated:** [March 15, 2025, 5:36am UTC](https://discourse.julialang.org/t/the-solution-deteriorates-if-the-domain-of-decisions-is-improperly-set-when-using-ipopt/126743 "2025-03-15T05:36:06Z")

</div>

We expound the title through the following Convex Minimization Problem. function convex\_f(x) return x \* log(x) end # ⚠️ This convex function is NOT defined at 0 function f\_gradient(x) return log(x) + 1 end import JuM…

---

## [Reformulation perspectification technique: a code example using JuMP](https://discourse.julialang.org/t/reformulation-perspectification-technique-a-code-example-using-jump/126729)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 2\
**Last updated:** [March 16, 2025, 2:11am UTC](https://discourse.julialang.org/t/reformulation-perspectification-technique-a-code-example-using-jump/126729 "2025-03-16T02:11:33Z")

</div>

In this tutorial we aim to solve the following nonconvex program (NC) via a convex relaxation (CR). @variable(NC, x\[1:2\]) @constraint(NC, Lin1, x\[1\] + x\[2\] \<= 1) E = 1 + exp(-1) @constraint(NC, Conv1, exp(-x\[1\]) + e…

---

## [Optimizing a function in optimal control problem](https://discourse.julialang.org/t/optimizing-a-function-in-optimal-control-problem/125483)

<div class="topic-metadata">

**Author:** [@yhchang](https://discourse.julialang.org/u/yhchang)\
**Replies:** 19\
**Last updated:** [March 15, 2025, 2:03am UTC](https://discourse.julialang.org/t/optimizing-a-function-in-optimal-control-problem/125483 "2025-03-15T02:03:34Z")

</div>

I’m trying to solve the following optimal control problem: minimize -\\int\_0^T v(t) dt, subject to \\frac{dv}{dt} = -\\frac{v}{\\tau} + f, v(0)=0 \\frac{de}{dt} = \\sigma - fv, e(0)=e\_0, e(t)\>=0 0\\leq f(t) \\leq f\_{max} is …

---

## [Reformulation perspectification technique: ideas embodied in a contrived example](https://discourse.julialang.org/t/reformulation-perspectification-technique-ideas-embodied-in-a-contrived-example/126804)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 1\
**Last updated:** [March 12, 2025, 1:36am UTC](https://discourse.julialang.org/t/reformulation-perspectification-technique-ideas-embodied-in-a-contrived-example/126804 "2025-03-12T01:36:59Z")

</div>

From Mosek’s cookbook we know: The feasibility system \\{ t \> 0, t(\\frac{x}{t})^2 \\le y \\} in \\mathbb{R}^3 can be coded as \[y + t, y - t, 2 \* x\] in JuMP.SecondOrderCone() In this tutorial we aim to solve the followin…

---

## [Ipopt and non linear maximisation problem](https://discourse.julialang.org/t/ipopt-and-non-linear-maximisation-problem/126909)

<div class="topic-metadata">

**Author:** [@Ana1](https://discourse.julialang.org/u/Ana1)\
**Replies:** 6\
**Last updated:** [March 14, 2025, 4:57pm UTC](https://discourse.julialang.org/t/ipopt-and-non-linear-maximisation-problem/126909 "2025-03-14T16:57:37Z")

</div>

Hello everyone, I am working on a non linear dynamic optimization problem with ipopt solver on natural resources. I have a few questions and I hope some of you could help me. First I am wondering if I am using the righ…

---

## [Reformulation Perspectification Technique: an example with a nonconvex feasible region](https://discourse.julialang.org/t/reformulation-perspectification-technique-an-example-with-a-nonconvex-feasible-region/126915)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 0\
**Last updated:** [March 13, 2025, 1:04pm UTC](https://discourse.julialang.org/t/reformulation-perspectification-technique-an-example-with-a-nonconvex-feasible-region/126915 "2025-03-13T13:04:53Z")

</div>

The nonconvex problem (NC) is \\min\_x \\{L\\,e^{x\_2} | L:= x\_1 + x\_2 + 1 \\ge 0, x\_1 x\_2 \\ge -1\\} It’s clear that the objective function is “linear times convex”, which is suitable for perspectification. And the feasible r…

---

## [Mosek interior point stopping criterion and basis identification](https://discourse.julialang.org/t/mosek-interior-point-stopping-criterion-and-basis-identification/126863)

<div class="topic-metadata">

**Author:** [@rpetit](https://discourse.julialang.org/u/rpetit)\
**Replies:** 4\
**Last updated:** [March 13, 2025, 9:22am UTC](https://discourse.julialang.org/t/mosek-interior-point-stopping-criterion-and-basis-identification/126863 "2025-03-13T09:22:18Z")

</div>

Hi! I have noticed a weird behaviour of Mosek: when solving a linear program with the interior-point optimizer, the primal and dual feasibility tolerances do not seem to be taken into account when basis identification i…

---

## [Forward Diff Trying to Cast Dual Type to Float64](https://discourse.julialang.org/t/forward-diff-trying-to-cast-dual-type-to-float64/126691)

<div class="topic-metadata">

**Author:** [@Bocconocini](https://discourse.julialang.org/u/Bocconocini)\
**Replies:** 6\
**Last updated:** [March 10, 2025, 5:59pm UTC](https://discourse.julialang.org/t/forward-diff-trying-to-cast-dual-type-to-float64/126691 "2025-03-10T17:59:25Z")

</div>

Hello, I’m new to JuMP and trying to implement a yaw-plane vehicle model. The inputs to the function are arrays of the steering and throttle inputs (for every discrete time step). The model runs fine on its own, but add…

---

## [JuMP memory allocation](https://discourse.julialang.org/t/jump-memory-allocation/126731)

<div class="topic-metadata">

**Author:** [@fdekerme](https://discourse.julialang.org/u/fdekerme)\
**Replies:** 2\
**Last updated:** [March 9, 2025, 11:15pm UTC](https://discourse.julialang.org/t/jump-memory-allocation/126731 "2025-03-09T23:15:51Z")

</div>

Hi! :grinning: I am starting to use JuMP.jl to implement an optimization process on an image (size 266 x 353 pixels). I implement the problem like that to find L₁, L₂ values on each pixel: model = Model(Ipopt.Optimizer…

---

## [MOF \`read\_from\_file\` fails when using MOI.Parameter and non-linear constraints](https://discourse.julialang.org/t/mof-read-from-file-fails-when-using-moi-parameter-and-non-linear-constraints/126688)

<div class="topic-metadata">

**Author:** [@andrewrosemberg](https://discourse.julialang.org/u/andrewrosemberg)\
**Replies:** 3\
**Last updated:** [March 7, 2025, 9:13pm UTC](https://discourse.julialang.org/t/mof-read-from-file-fails-when-using-moi-parameter-and-non-linear-constraints/126688 "2025-03-07T21:13:17Z")

</div>

I am trying read\_from\_file and solve a model with MOI.Parameter but failing when I have non-linear constraints: using JuMP using MathOptInterface using Ipopt model = JuMP.Model(Ipopt.Optimizer) set\_silent(model) # …

---

## [Determinant constraints in JuMP](https://discourse.julialang.org/t/determinant-constraints-in-jump/126664)

<div class="topic-metadata">

**Author:** [@Rick](https://discourse.julialang.org/u/Rick)\
**Replies:** 1\
**Last updated:** [March 7, 2025, 6:33pm UTC](https://discourse.julialang.org/t/determinant-constraints-in-jump/126664 "2025-03-07T18:33:10Z")

</div>

Hi! I have a question about using imposing determinant as a constraint in JuMP. Currently, I am trying to solve a problem that involve constraints of the form \\det(A) = c \\det(B), where c is a given scalar. A and B a…

---

## [Wagner model for total tardiness minimization](https://discourse.julialang.org/t/wagner-model-for-total-tardiness-minimization/126603)

<div class="topic-metadata">

**Author:** [@Victor\_Neto](https://discourse.julialang.org/u/Victor_Neto)\
**Replies:** 3\
**Last updated:** [March 6, 2025, 10:35am UTC](https://discourse.julialang.org/t/wagner-model-for-total-tardiness-minimization/126603 "2025-03-06T10:35:22Z")

</div>

Dear friends, I hope this message finds you all well. I am working on a Wagner family model with positional decision variables for the job shop scheduling problem, aiming to minimize total tardiness. For the toy model …

---

## [Error with maximum likelihood estimation using Optimization](https://discourse.julialang.org/t/error-with-maximum-likelihood-estimation-using-optimization/126370)

<div class="topic-metadata">

**Author:** [@Stephen](https://discourse.julialang.org/u/Stephen)\
**Replies:** 8\
**Last updated:** [March 4, 2025, 1:31am UTC](https://discourse.julialang.org/t/error-with-maximum-likelihood-estimation-using-optimization/126370 "2025-03-04T01:31:40Z")

</div>

using OptimizationOptimisers using Optimization loss(θ) = norm((predict(θ) - data\_train) .\* weights) optf = OptimizationFunction((x, p) -\> loss(x), AutoReverseDiff(true)) optprob = OptimizationProblem(optf, θ) opt = Ada…

---

## [Initialize variables in Bonmin](https://discourse.julialang.org/t/initialize-variables-in-bonmin/126500)

<div class="topic-metadata">

**Author:** [@BCC](https://discourse.julialang.org/u/BCC)\
**Replies:** 1\
**Last updated:** [March 3, 2025, 9:07pm UTC](https://discourse.julialang.org/t/initialize-variables-in-bonmin/126500 "2025-03-03T21:07:15Z")

</div>

I have an MINLP model implemented in BONMIN. The model functions correctly; however, since it is applied to distribution power systems, its complexity increases as the number of nodes grows. For this reason, I have attem…

---

## [Extracting the coefficient of a nonlinear term in a JuMP model](https://discourse.julialang.org/t/extracting-the-coefficient-of-a-nonlinear-term-in-a-jump-model/126438)

<div class="topic-metadata">

**Author:** [@handahye](https://discourse.julialang.org/u/handahye)\
**Replies:** 2\
**Last updated:** [March 3, 2025, 6:20pm UTC](https://discourse.julialang.org/t/extracting-the-coefficient-of-a-nonlinear-term-in-a-jump-model/126438 "2025-03-03T18:20:49Z")

</div>

For a generic nonlinear constraint, is there a way for me to extract the coefficient of a nonlinear term (e.g., multilinear terms)? e.g., model = Model() @variable(model, x\[1:3\]) @constraint(model, (x\[1\] - (((3\* ((x\[2\]…

---

## [\[MadNLPHSL\] Feature proposal: simplify installation with custom-compiled HSL library](https://discourse.julialang.org/t/madnlphsl-feature-proposal-simplify-installation-with-custom-compiled-hsl-library/126474)

<div class="topic-metadata">

**Author:** [@KSepetanc](https://discourse.julialang.org/u/KSepetanc)\
**Replies:** 3\
**Last updated:** [March 3, 2025, 12:56am UTC](https://discourse.julialang.org/t/madnlphsl-feature-proposal-simplify-installation-with-custom-compiled-hsl-library/126474 "2025-03-03T00:56:07Z")

</div>

HSL\_jll.jl obtained from https://licences.stfc.ac.uk/products/Software/HSL/LibHSL requires free academic or purchased license and contains extended set of HSL libraries. However there is free license for individuals for …

---

## [ExaModels CPU backend acceleration](https://discourse.julialang.org/t/examodels-cpu-backend-acceleration/126153)

<div class="topic-metadata">

**Author:** [@KSepetanc](https://discourse.julialang.org/u/KSepetanc)\
**Replies:** 4\
**Last updated:** [March 2, 2025, 11:26pm UTC](https://discourse.julialang.org/t/examodels-cpu-backend-acceleration/126153 "2025-03-02T23:26:07Z")

</div>

I am trying to setup CPU() backend acceleration as described in ExaModels documentation but it is not working. The optimization runs but on single thread (System monitor detects no multiple threads usage) and with the sa…

---

## [Question and error about optimization for Nueral ode](https://discourse.julialang.org/t/question-and-error-about-optimization-for-nueral-ode/125950)

<div class="topic-metadata">

**Author:** [@yyyyyyyy](https://discourse.julialang.org/u/yyyyyyyy)\
**Replies:** 1\
**Last updated:** [March 2, 2025, 10:02pm UTC](https://discourse.julialang.org/t/question-and-error-about-optimization-for-nueral-ode/125950 "2025-03-02T22:02:35Z")

</div>

Hi i am running the below code in 1.11.1 using ComponentArrays, Lux, DiffEqFlux, Optimization, Random, Plots, OptimizationOptimisers rng = Random.default\_rng() u0 = Float32\[2.0; 0.0\] datasize = 30 tspan = (0.0f0, 1.5f…

---

## [Getting unbounded ray in JuMP](https://discourse.julialang.org/t/getting-unbounded-ray-in-jump/126097)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 5\
**Last updated:** [February 28, 2025, 6:33pm UTC](https://discourse.julialang.org/t/getting-unbounded-ray-in-jump/126097 "2025-02-28T18:33:29Z")

</div>

I have an unbounded linear program that I am solving using Gurobi with the attribute: set\_attribute(model, "InfUnbdInfo", 1) set\_attribute(model, "DualReductions", 0) and the model is indeed unbounded. I want to get …

---

## [JuMP solve\_time not matching actual time](https://discourse.julialang.org/t/jump-solve-time-not-matching-actual-time/126397)

<div class="topic-metadata">

**Author:** [@BMI\_OR](https://discourse.julialang.org/u/BMI_OR)\
**Replies:** 3\
**Last updated:** [February 27, 2025, 9:33pm UTC](https://discourse.julialang.org/t/jump-solve-time-not-matching-actual-time/126397 "2025-02-27T21:33:40Z")

</div>

I am executing an algorithm that iteratively executes the following function to solve a problem: function solve\_subproblem(model, z, q, v) fix.(model\[:z\_copy\], z) fix.(model\[:q\_copy\], q) fix.(model\[:v\_copy\],…

---

## [Solver does not return solution with ALMOST\_OPTIMAL status](https://discourse.julialang.org/t/solver-does-not-return-solution-with-almost-optimal-status/126280)

<div class="topic-metadata">

**Author:** [@priantop](https://discourse.julialang.org/u/priantop)\
**Replies:** 3\
**Last updated:** [February 27, 2025, 9:53am UTC](https://discourse.julialang.org/t/solver-does-not-return-solution-with-almost-optimal-status/126280 "2025-02-27T09:53:13Z")

</div>

Hi, I am running a large LP model using COPT solver (COPT.jl) where the termination status is IMPRECISE, below is the log snippet Using Cardinal Optimizer v7.2.4 on Windows Hardware has 32 cores and 64 threads. Using …

---

## [PowerModels Timeseries Simulation](https://discourse.julialang.org/t/powermodels-timeseries-simulation/122615)

<div class="topic-metadata">

**Author:** [@PB-vines](https://discourse.julialang.org/u/PB-vines)\
**Replies:** 5\
**Last updated:** [February 27, 2025, 5:55am UTC](https://discourse.julialang.org/t/powermodels-timeseries-simulation/122615 "2025-02-27T05:55:20Z")

</div>

Hello, I am new to PowerModels and looking forward to learning more. I have a power network, along with generation data and renewable energy resource data. I want to run this grid for at least 1 day at hourly intervals…

---

## [JuMP / SCS tutorial example fails on simple(?) data](https://discourse.julialang.org/t/jump-scs-tutorial-example-fails-on-simple-data/125857)

<div class="topic-metadata">

**Author:** [@healyp](https://discourse.julialang.org/u/healyp)\
**Replies:** 5\
**Last updated:** [February 26, 2025, 8:40pm UTC](https://discourse.julialang.org/t/jump-scs-tutorial-example-fails-on-simple-data/125857 "2025-02-26T20:40:44Z")

</div>

Using the code verbatim as provided in the JuMP conic programming tutorial the SCS solver fails after 100,000 iterations on the matrix of five 2-D points below julia\> S 5×2 Matrix{Float64}: 39.1 18.7 39.5 17.4 40.…

---

## [Dual to PSD Constraint in JuMP](https://discourse.julialang.org/t/dual-to-psd-constraint-in-jump/126352)

<div class="topic-metadata">

**Author:** [@lopenguin](https://discourse.julialang.org/u/lopenguin)\
**Replies:** 1\
**Last updated:** [February 26, 2025, 7:42pm UTC](https://discourse.julialang.org/t/dual-to-psd-constraint-in-jump/126352 "2025-02-26T19:42:46Z")

</div>

Hi all, This is my first forum post so feedback is welcome. In summary, finding the dual to a PSD constraint in JuMP is not particularly intuitive and certainly not well-documented. I show the approach that worked for m…

---

## [Customised Objective Function using PMD.jl](https://discourse.julialang.org/t/customised-objective-function-using-pmd-jl/126253)

<div class="topic-metadata">

**Author:** [@alireza33zz](https://discourse.julialang.org/u/alireza33zz)\
**Replies:** 2\
**Last updated:** [February 26, 2025, 5:58pm UTC](https://discourse.julialang.org/t/customised-objective-function-using-pmd-jl/126253 "2025-02-26T17:58:28Z")

</div>

Hello I am using PowerModelsDistribution.jl to solve my 3-phase OPF, how can I only change the objective function? By default it is the minimization of fuel cost, I want to replace it with a non-linear function. Thanks…

---

## [CPU time vs Wallclock](https://discourse.julialang.org/t/cpu-time-vs-wallclock/114776)

<div class="topic-metadata">

**Author:** [@ShGE](https://discourse.julialang.org/u/ShGE)\
**Replies:** 11\
**Last updated:** [February 26, 2025, 5:41pm UTC](https://discourse.julialang.org/t/cpu-time-vs-wallclock/114776 "2025-02-26T17:41:07Z")

</div>

Hello there solve\_time does not return the CPU time even if I set set\_optimizer\_attribute(model, “CPXPARAM\_ClockType”, 1) # CPU clock time when using CPLEX. is there any way to get CPU time in Jump from whatever s…

---

## [A time-indexed MILP model for tje job shop with makespan minimization](https://discourse.julialang.org/t/a-time-indexed-milp-model-for-tje-job-shop-with-makespan-minimization/126297)

<div class="topic-metadata">

**Author:** [@baprata](https://discourse.julialang.org/u/baprata)\
**Replies:** 2\
**Last updated:** [February 26, 2025, 10:32am UTC](https://discourse.julialang.org/t/a-time-indexed-milp-model-for-tje-job-shop-with-makespan-minimization/126297 "2025-02-26T10:32:13Z")

</div>

Dear colleagues, I am coding the time-indexed model for the job shop scheduling problem as presented by Hu and Beck (Equations (10)-(15) in Redirecting), but the solution is not correct. I successfully implemented all t…

---

## [Juniper Boolean variable example with MTK](https://discourse.julialang.org/t/juniper-boolean-variable-example-with-mtk/126144)

<div class="topic-metadata">

**Author:** [@dmetivie](https://discourse.julialang.org/u/dmetivie)\
**Replies:** 3\
**Last updated:** [February 25, 2025, 7:31pm UTC](https://discourse.julialang.org/t/juniper-boolean-variable-example-with-mtk/126144 "2025-02-25T19:31:42Z")

</div>

I want to reproduce the Juniper README example (with Binary variable and nonlinear non-convex objective). It has been done with JuMP.jl, with Optimization.jl (here). But I cannot reproduce it using ModelingToolKit.jl I…

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

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