# \#optimization

**URL:** https://discourse.julialang.org/tag/optimization/187.md?page=6

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

**Page:** 7

---

## [User defined gradient in JuMP with Ipopt: gradient with user data](https://discourse.julialang.org/t/user-defined-gradient-in-jump-with-ipopt-gradient-with-user-data/116236)

<div class="topic-metadata">

**Author:** [@vict\_riag](https://discourse.julialang.org/u/vict_riag)\
**Replies:** 3\
**Last updated:** [June 26, 2024, 10:15pm UTC](https://discourse.julialang.org/t/user-defined-gradient-in-jump-with-ipopt-gradient-with-user-data/116236 "2024-06-26T22:15:56Z")

</div>

Hello, I have been trying to register a gradient in JuMP that includes user data. I think the issue is with how I have formulated the gradient and fed it into JuMP, but I am not sure how to use the @expression or @param…

---

## [Logical conditions](https://discourse.julialang.org/t/logical-conditions/115363)

<div class="topic-metadata">

**Author:** [@papar](https://discourse.julialang.org/u/papar)\
**Replies:** 14\
**Last updated:** [June 25, 2024, 12:40am UTC](https://discourse.julialang.org/t/logical-conditions/115363 "2024-06-25T00:40:18Z")

</div>

I’m working on an optimization problem in JuMP where I need to ensure that certain constraints are enforced based on a binary variable. Here are the variables and constraints I have defined in my model: Variable Definit…

---

## [Is there any way to emulate MATLAB's Isqlin in Julia?](https://discourse.julialang.org/t/is-there-any-way-to-emulate-matlabs-isqlin-in-julia/93394)

<div class="topic-metadata">

**Author:** [@Itzi](https://discourse.julialang.org/u/Itzi)\
**Replies:** 20\
**Last updated:** [June 24, 2024, 11:31am UTC](https://discourse.julialang.org/t/is-there-any-way-to-emulate-matlabs-isqlin-in-julia/93394 "2024-06-24T11:31:16Z")

</div>

Hi, I am trying to solve a box constrained least squares problem. I have the classic Ax = b problem where x are the parameters I want to find, and A and b are full of experimental data. I have tried: using Convex, SC…

---

## [GTPSA.jl: A Julia interface to the new GTPSA library for fast, high-order automatic differentiation](https://discourse.julialang.org/t/gtpsa-jl-a-julia-interface-to-the-new-gtpsa-library-for-fast-high-order-automatic-differentiation/115370)

<div class="topic-metadata">

**Author:** [@mattsignorelli](https://discourse.julialang.org/u/mattsignorelli)\
**Replies:** 13\
**Last updated:** [June 11, 2024, 3:06am UTC](https://discourse.julialang.org/t/gtpsa-jl-a-julia-interface-to-the-new-gtpsa-library-for-fast-high-order-automatic-differentiation/115370 "2024-06-11T03:06:04Z")

</div>

GTPSA.jl is a new Julia package that provides a full-featured interface to the Generalised Truncated Power Series Algebra library for computing Taylor expansions, or Truncated Power Series (TPSs) of real and complex mult…

---

## [Failing to precompile OptimizationBase](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926)

<div class="topic-metadata">

**Author:** [@PetrosStefanou](https://discourse.julialang.org/u/PetrosStefanou)\
**Replies:** 32\
**Last updated:** [June 7, 2024, 4:47pm UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926 "2024-06-07T16:47:07Z")

</div>

Hi everyone, I am getting a precompilation error when trying to using Optimization. I am not sure how to interpret the error message I am getting. The problem is that precompilation is triggered and fails every time, …

---

## [How to maximize a scalar function of a scalar argument?](https://discourse.julialang.org/t/how-to-maximize-a-scalar-function-of-a-scalar-argument/115318)

<div class="topic-metadata">

**Author:** [@homocomputeris](https://discourse.julialang.org/u/homocomputeris)\
**Replies:** 1\
**Last updated:** [June 7, 2024, 12:24pm UTC](https://discourse.julialang.org/t/how-to-maximize-a-scalar-function-of-a-scalar-argument/115318 "2024-06-07T12:24:53Z")

</div>

I want to maximize a scala function, say NMaximize\[{1/(x - 1), -10 \< x \< 0}, {x}\] I tried: module test using Optimization, OptimizationOptimJL, NonlinearSolve function f(x, p) return 1 / (x - 1) end u0 = -0.5 p …

---

## [Zygote.hessian of loss function when defining ODEs with modeling toolkit](https://discourse.julialang.org/t/zygote-hessian-of-loss-function-when-defining-odes-with-modeling-toolkit/115302)

<div class="topic-metadata">

**Author:** [@cefitzg](https://discourse.julialang.org/u/cefitzg)\
**Replies:** 1\
**Last updated:** [June 7, 2024, 2:02am UTC](https://discourse.julialang.org/t/zygote-hessian-of-loss-function-when-defining-odes-with-modeling-toolkit/115302 "2024-06-07T02:02:29Z")

</div>

I’m doing parameter estimation on an ODE system, which I define using modelingtoolkit. I need to generate hessian of cost function with respect to parameters to access fit. No issue with parameter estimation. Loss funct…

---

## [Trouble with CPU+GPU adjoints for UDEs](https://discourse.julialang.org/t/trouble-with-cpu-gpu-adjoints-for-udes/115290)

<div class="topic-metadata">

**Author:** [@19fitzna](https://discourse.julialang.org/u/19fitzna)\
**Replies:** 1\
**Last updated:** [June 6, 2024, 5:49pm UTC](https://discourse.julialang.org/t/trouble-with-cpu-gpu-adjoints-for-udes/115290 "2024-06-06T17:49:02Z")

</div>

Hi all! I am currently trying to create UDEs using a GPU backend for the neural network only. I have been following the examples here, but have not been able to get anything to work. I was wondering if anyone might know …

---

## [How to decipher SciMLBase OptimizationBase OptimizationForwardDiffExt warnings?](https://discourse.julialang.org/t/how-to-decipher-scimlbase-optimizationbase-optimizationforwarddiffext-warnings/115225)

<div class="topic-metadata">

**Author:** [@homocomputeris](https://discourse.julialang.org/u/homocomputeris)\
**Replies:** 1\
**Last updated:** [June 5, 2024, 12:45pm UTC](https://discourse.julialang.org/t/how-to-decipher-scimlbase-optimizationbase-optimizationforwarddiffext-warnings/115225 "2024-06-05T12:45:28Z")

</div>

When fitting a DE params to data, I get warnings like this one: ┌ Warning: dt(2.842170943040401e-14) \<= eps(t)(218.2272500679591) , and step error estimate = 2.359923922574841. Aborting. There is either an error in yo…

---

## [Trajectory Optimization using Pseudospectral collocation](https://discourse.julialang.org/t/trajectory-optimization-using-pseudospectral-collocation/114017)

<div class="topic-metadata">

**Author:** [@DTdev](https://discourse.julialang.org/u/DTdev)\
**Replies:** 10\
**Last updated:** [May 30, 2024, 3:46pm UTC](https://discourse.julialang.org/t/trajectory-optimization-using-pseudospectral-collocation/114017 "2024-05-30T15:46:13Z")

</div>

Hi everyone! I am currently trying to solve a simple trajectory optimization problem using pseudospectral collocation or orthogonal collocation. I have written a simple UAV simulation using JuMP.jl with a moving obstac…

---

## [NLopt Constraint](https://discourse.julialang.org/t/nlopt-constraint/114856)

<div class="topic-metadata">

**Author:** [@mary](https://discourse.julialang.org/u/mary)\
**Replies:** 4\
**Last updated:** [May 28, 2024, 10:27pm UTC](https://discourse.julialang.org/t/nlopt-constraint/114856 "2024-05-28T22:27:28Z")

</div>

Hi, I am using Nlopt for optimization. my objective function depends on three variables like x1,x2,x3 also I have a constraint which depends on all three variable. I want to do the optimization just for x3 variable. shou…

---

## [Initializing local variables on workers without using excessive memory](https://discourse.julialang.org/t/initializing-local-variables-on-workers-without-using-excessive-memory/114713)

<div class="topic-metadata">

**Author:** [@lgo](https://discourse.julialang.org/u/lgo)\
**Replies:** 1\
**Last updated:** [May 29, 2024, 10:55am UTC](https://discourse.julialang.org/t/initializing-local-variables-on-workers-without-using-excessive-memory/114713 "2024-05-29T10:55:48Z")

</div>

I’m using Julia and JuMP to solve a massive optimization problem with decomposition on a HPC. For this purpose, I want to initialize an independent optimization problem on each worker and then solve it repeatedly. So far…

---

## [Computing variance of variables is very slow in JuMP](https://discourse.julialang.org/t/computing-variance-of-variables-is-very-slow-in-jump/114660)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 3\
**Last updated:** [May 25, 2024, 12:19am UTC](https://discourse.julialang.org/t/computing-variance-of-variables-is-very-slow-in-jump/114660 "2024-05-25T00:19:28Z")

</div>

Consider the small code snippet below using JuMP using Statistics model = Model() n = 1000 @variable(model, x\[1:n\], Bin) @time @objective(model, Min, var(x .\* rand(n))) The timing is 162.785950 seconds (93.08 k alloc…

---

## [How to stop a long-running optimization process in JuMP?](https://discourse.julialang.org/t/how-to-stop-a-long-running-optimization-process-in-jump/114656)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 6\
**Last updated:** [May 24, 2024, 2:31pm UTC](https://discourse.julialang.org/t/how-to-stop-a-long-running-optimization-process-in-jump/114656 "2024-05-24T14:31:46Z")

</div>

Some optimization problem can be quite time-consuming. I used JuMP in Jupyter notebook (VS Code) and Julia REPL. After optimize! is called, the optimization starts, and sometimes I want to interrupt it. However The sto…

---

## [Failed optimization with function](https://discourse.julialang.org/t/failed-optimization-with-function/114290)

<div class="topic-metadata">

**Author:** [@nouha941](https://discourse.julialang.org/u/nouha941)\
**Replies:** 4\
**Last updated:** [May 15, 2024, 4:49pm UTC](https://discourse.julialang.org/t/failed-optimization-with-function/114290 "2024-05-15T16:49:53Z")

</div>

Hello everyone, I have a problem with optimizing my function. I keep getting an error. Could you please help me? function optimize\_Cs(Q\_e, PT501, PT401, P\_HP, R\_m, R\_p, Qp, Pe) #calcul initial de Cs Pe = (( ((Q\_…

---

## [How to get evaluation number in optimization using NLopt](https://discourse.julialang.org/t/how-to-get-evaluation-number-in-optimization-using-nlopt/114020)

<div class="topic-metadata">

**Author:** [@mary](https://discourse.julialang.org/u/mary)\
**Replies:** 7\
**Last updated:** [May 8, 2024, 10:40pm UTC](https://discourse.julialang.org/t/how-to-get-evaluation-number-in-optimization-using-nlopt/114020 "2024-05-08T22:40:05Z")

</div>

Hi, I am using Nlopt to do the optimization. in this case i have defined a function for optimization. inside this function the optimizer reads another functions to calculate the objective and gradients. I also want to ge…

---

## [Laplacian for a minimized function](https://discourse.julialang.org/t/laplacian-for-a-minimized-function/103836)

<div class="topic-metadata">

**Author:** [@yosuga](https://discourse.julialang.org/u/yosuga)\
**Replies:** 10\
**Last updated:** [May 9, 2024, 7:36am UTC](https://discourse.julialang.org/t/laplacian-for-a-minimized-function/103836 "2024-05-09T07:36:15Z")

</div>

I’m trying to evaluate the following laplacian(b). using Optim using ForwardDiff function f(a,b) sin(a\[1\])\*(cos(a\[2\]) + cos(b\[1\]+b\[2\])) end function g(b) h(a) = f(a,b) res = optimize(h,zeros(2)) return…

---

## [There was a problem with ForwardDiff-based Optimization when re-executing the code](https://discourse.julialang.org/t/there-was-a-problem-with-forwarddiff-based-optimization-when-re-executing-the-code/113682)

<div class="topic-metadata">

**Author:** [@chooron](https://discourse.julialang.org/u/chooron)\
**Replies:** 13\
**Last updated:** [May 5, 2024, 3:10pm UTC](https://discourse.julialang.org/t/there-was-a-problem-with-forwarddiff-based-optimization-when-re-executing-the-code/113682 "2024-05-05T15:10:49Z")

</div>

I’m using Optimization.jl to optimize some parameters of ODEProblem, where AutoForwardDiff is used for adtype, when the code is executed for the first time, the program does not show any errors, but when I execute the pr…

---

## [Some problem when optimizing the ODEProblem parameters](https://discourse.julialang.org/t/some-problem-when-optimizing-the-odeproblem-parameters/113746)

<div class="topic-metadata">

**Author:** [@chooron](https://discourse.julialang.org/u/chooron)\
**Replies:** 4\
**Last updated:** [May 3, 2024, 4:06am UTC](https://discourse.julialang.org/t/some-problem-when-optimizing-the-odeproblem-parameters/113746 "2024-05-03T04:06:03Z")

</div>

Use ModelingToolkit.jl to build ODEproblem and Optimization respectively to optimize the parameters of ODEproblem with the following code: using ModelingToolkit, Optimization, ComponentArrays using ModelingToolkit: t\_no…

---

## [JuMP constraint coefficients](https://discourse.julialang.org/t/jump-constraint-coefficients/113754)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 4\
**Last updated:** [May 2, 2024, 11:09pm UTC](https://discourse.julialang.org/t/jump-constraint-coefficients/113754 "2024-05-02T23:09:36Z")

</div>

What am I doing wrong here? model = JuMP.Model() JuMP.@variable(model, x\[1:length(s)\]) JuMP.@constraint(model, c, s .\* x ∈ JuMP.MOI.Nonnegatives(10)) JuMP.normalized\_coefficient(c, x\[1\]) ERROR: MethodError: no method ma…

---

## [Can someone help me interpret this error: Dimension mismatch with BFGS](https://discourse.julialang.org/t/can-someone-help-me-interpret-this-error-dimension-mismatch-with-bfgs/113749)

<div class="topic-metadata">

**Author:** [@keynescoefen](https://discourse.julialang.org/u/keynescoefen)\
**Replies:** 0\
**Last updated:** [May 2, 2024, 4:27pm UTC](https://discourse.julialang.org/t/can-someone-help-me-interpret-this-error-dimension-mismatch-with-bfgs/113749 "2024-05-02T16:27:30Z")

</div>

When running the example given here ML Estimation it works fine. When using my own log-likelihood, I can get it to work with LBFGS() and Newton() but plain BFGS() throws the following error pasted below. My code is nearl…

---

## [Convex Semi-definite Problem](https://discourse.julialang.org/t/convex-semi-definite-problem/113656)

<div class="topic-metadata">

**Author:** [@Julian\_Villaquira](https://discourse.julialang.org/u/Julian_Villaquira)\
**Replies:** 5\
**Last updated:** [May 2, 2024, 1:32am UTC](https://discourse.julialang.org/t/convex-semi-definite-problem/113656 "2024-05-02T01:32:12Z")

</div>

I am trying to solve a convex semi-definite optimization problem, and I don’t know what would be the right approach to implement it in Julia. The problem is the following: min c'x where c and x are vectors in R^n subje…

---

## [Gradient-based optimization when gradient is only a function of y = f(x)](https://discourse.julialang.org/t/gradient-based-optimization-when-gradient-is-only-a-function-of-y-f-x/113674)

<div class="topic-metadata">

**Author:** [@dieg0](https://discourse.julialang.org/u/dieg0)\
**Replies:** 3\
**Last updated:** [May 1, 2024, 8:47pm UTC](https://discourse.julialang.org/t/gradient-based-optimization-when-gradient-is-only-a-function-of-y-f-x/113674 "2024-05-01T20:47:01Z")

</div>

Hi all, I am new to Julia, coming from MATLAB. I am writing some optimization code that tries to find parameters by minimizing the difference between some already computed probabilities (s) and model estimated probabilit…

---

## [Adding external parameters to neural network](https://discourse.julialang.org/t/adding-external-parameters-to-neural-network/112968)

<div class="topic-metadata">

**Author:** [@KianH](https://discourse.julialang.org/u/KianH)\
**Replies:** 5\
**Last updated:** [April 24, 2024, 3:03pm UTC](https://discourse.julialang.org/t/adding-external-parameters-to-neural-network/112968 "2024-04-24T15:03:41Z")

</div>

Is there any way in Lux.jl or Flux.jl to create a function for a UDE and add some parameter, for instance the parameter c in the function rhs!(...) to a neural network so that the parameter c is also estimated through th…

---

## [UDE example missing physics MethodError](https://discourse.julialang.org/t/ude-example-missing-physics-methoderror/113334)

<div class="topic-metadata">

**Author:** [@SzAleks](https://discourse.julialang.org/u/SzAleks)\
**Replies:** 1\
**Last updated:** [April 23, 2024, 12:30pm UTC](https://discourse.julialang.org/t/ude-example-missing-physics-methoderror/113334 "2024-04-23T12:30:27Z")

</div>

Hello all, some time ago I reproduced the Automatically Discover Missing Physics by Embedding Machine Learning into Differential Equations · Overview of Julia's SciML example on my local machine for future projects. Some…

---

## [Solving the 4 quadrants of dynamic optimization problems in Julia. Help Wanted!](https://discourse.julialang.org/t/solving-the-4-quadrants-of-dynamic-optimization-problems-in-julia-help-wanted/73285)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 35\
**Last updated:** [April 22, 2024, 10:54pm UTC](https://discourse.julialang.org/t/solving-the-4-quadrants-of-dynamic-optimization-problems-in-julia-help-wanted/73285 "2024-04-22T22:54:24Z")

</div>

Solving dynamic optimization problems is at the heart of economics (and many other fields). The goal of this post is to explore various tools for solving dynamic optimization problems in the Julia Eco-system and to hope…

---

## [Performance issue: Axelrod model of dissemination of culture optimization](https://discourse.julialang.org/t/performance-issue-axelrod-model-of-dissemination-of-culture-optimization/113326)

<div class="topic-metadata">

**Author:** [@alex180500](https://discourse.julialang.org/u/alex180500)\
**Replies:** 6\
**Last updated:** [April 22, 2024, 1:30pm UTC](https://discourse.julialang.org/t/performance-issue-axelrod-model-of-dissemination-of-culture-optimization/113326 "2024-04-22T13:30:40Z")

</div>

Hello! I’m implementing an Agent Based Model (axelrod model of dissemination of culture). Every node has an associated vector of “opinions” (data) on different subjects (number of features is feat). Each step two nodes a…

---

## [JuMP.jl vs Optimization.jl](https://discourse.julialang.org/t/jump-jl-vs-optimization-jl/112736)

<div class="topic-metadata">

**Author:** [@aris](https://discourse.julialang.org/u/aris)\
**Replies:** 17\
**Last updated:** [April 22, 2024, 9:33am UTC](https://discourse.julialang.org/t/jump-jl-vs-optimization-jl/112736 "2024-04-22T09:33:23Z")

</div>

Hello everyone, Not sure whether anyone else has the same problem, but I find it a bit hard to understand what’s the actual difference between Optimization.jl and JuMP.jl. To my untrained eye, it seems like they both o…

---

## [How to configurate bound checks at statup?](https://discourse.julialang.org/t/how-to-configurate-bound-checks-at-statup/39248)

<div class="topic-metadata">

**Author:** [@JosephPollacco](https://discourse.julialang.org/u/JosephPollacco)\
**Replies:** 4\
**Last updated:** [April 18, 2024, 11:26pm UTC](https://discourse.julialang.org/t/how-to-configurate-bound-checks-at-statup/39248 "2024-04-18T23:26:58Z")

</div>

For well tested code it will be nice to have an option at the startup which disables the check bounds. According to the book JULIA HIGH PERFORMACE this is possible with the following option: -checks-bounds=no Neverthel…

---

## [How to get a feasible point of an arbitrary optimization model?](https://discourse.julialang.org/t/how-to-get-a-feasible-point-of-an-arbitrary-optimization-model/112513)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 8\
**Last updated:** [April 18, 2024, 7:44pm UTC](https://discourse.julialang.org/t/how-to-get-a-feasible-point-of-an-arbitrary-optimization-model/112513 "2024-04-18T19:44:10Z")

</div>

How to get a feasible point if the optimization model is not infeasible? If the model has no objective, I can do this by: using JuMP, HiGHS m = Model(HiGHS.Optimizer) @variable(m, x \<= 1) optimize!(m) value(x) But if …

[Previous page](https://discourse.julialang.org/tag/optimization/187.md?match_all_tags=true&page=5&tags%5B%5D=optimization)

[Next page](https://discourse.julialang.org/tag/optimization/187.md?match_all_tags=true&page=7&tags%5B%5D=optimization)
