# Optimization (Mathematical)

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

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

**Page:** 18

---

## [Nuclear norm minimization objective using JuMP](https://discourse.julialang.org/t/nuclear-norm-minimization-objective-using-jump/122869)

<div class="topic-metadata">

**Author:** [@MLL](https://discourse.julialang.org/u/MLL)\
**Replies:** 6\
**Last updated:** [November 21, 2024, 8:39am UTC](https://discourse.julialang.org/t/nuclear-norm-minimization-objective-using-jump/122869 "2024-11-21T08:39:45Z")

</div>

I am new to JuMP and trying to solve the nuclear norm minimization problem for low-rank matrix completion: \\text{min}\_\\mathbf{X} || \\mathbf{X} ||\_\* \\ \\text{ subject to }\\ x\_{ij} = m\_{ij},\\ \\ (i, j) \\in \\Omega Where…

---

## [JuMP operators for \> and mod2pi?](https://discourse.julialang.org/t/jump-operators-for-and-mod2pi/122871)

<div class="topic-metadata">

**Author:** [@lamont](https://discourse.julialang.org/u/lamont)\
**Replies:** 2\
**Last updated:** [November 21, 2024, 1:50am UTC](https://discourse.julialang.org/t/jump-operators-for-and-mod2pi/122871 "2024-11-21T01:50:56Z")

</div>

I’m trying to solve an NLP with JuMP and the problem that I’m trying to solve canonically converts orbital state vectors into keplerian elements in order to match terminal conditions. This is horrible and very nonlinear…

---

## [Best practices for passing JuMP decision variables and data to a function for adding constraints](https://discourse.julialang.org/t/best-practices-for-passing-jump-decision-variables-and-data-to-a-function-for-adding-constraints/122853)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 2\
**Last updated:** [November 20, 2024, 8:15pm UTC](https://discourse.julialang.org/t/best-practices-for-passing-jump-decision-variables-and-data-to-a-function-for-adding-constraints/122853 "2024-11-20T20:15:31Z")

</div>

I have an integer optimization problem of the form: {\\text{minimize}}\_{x\_{1},\\ldots,x\_{r}} \\quad c\_{1}^{\\top}x\_{1}+c\_{2}^{\\top}x\_{2}+\\ldots+c\_{r}^{\\top}x\_{r}\\\\​\\text{subject to} \\quad B\_{1}x\_{1}+B\_{2…

---

## [Most efficient way of retrieving dual solutions iteratively](https://discourse.julialang.org/t/most-efficient-way-of-retrieving-dual-solutions-iteratively/122790)

<div class="topic-metadata">

**Author:** [@BMI\_OR](https://discourse.julialang.org/u/BMI_OR)\
**Replies:** 1\
**Last updated:** [November 18, 2024, 9:38pm UTC](https://discourse.julialang.org/t/most-efficient-way-of-retrieving-dual-solutions-iteratively/122790 "2024-11-18T21:38:03Z")

</div>

I have implemented an algorithm where at each iteration I need to solve an optimization model and retrieve its dual solution. Currently, I am using dual.() to get the solution, and I am seeing that this function is also …

---

## [Unexpected behavior: containerized expression automatically redefined when included in interval constraint](https://discourse.julialang.org/t/unexpected-behavior-containerized-expression-automatically-redefined-when-included-in-interval-constraint/122648)

<div class="topic-metadata">

**Author:** [@Eli\_Brock](https://discourse.julialang.org/u/Eli_Brock)\
**Replies:** 2\
**Last updated:** [November 14, 2024, 8:32pm UTC](https://discourse.julialang.org/t/unexpected-behavior-containerized-expression-automatically-redefined-when-included-in-interval-constraint/122648 "2024-11-14T20:32:14Z")

</div>

When a containerized affine expression is included in an interval constraint, the expression seems to be automatically modified in-place to remove constants. MWE: using JuMP model = Model() @variable(model, x) @express…

---

## [Using JuMP to model a slider-crank mechanism](https://discourse.julialang.org/t/using-jump-to-model-a-slider-crank-mechanism/122560)

<div class="topic-metadata">

**Author:** [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Replies:** 3\
**Last updated:** [November 12, 2024, 9:58pm UTC](https://discourse.julialang.org/t/using-jump-to-model-a-slider-crank-mechanism/122560 "2024-11-12T21:58:22Z")

</div>

Hi! I was actually able to get this working wtih help from @araujoms on slack, but documenting here for future Googlers. I am trying to model a slider-crank mechanism like this: I want to minimize the height of the …

---

## [EXCEPTION\_ACCESS\_VIOLATION when executing ECOS in multi-threading](https://discourse.julialang.org/t/exception-access-violation-when-executing-ecos-in-multi-threading/122459)

<div class="topic-metadata">

**Author:** [@CaG21](https://discourse.julialang.org/u/CaG21)\
**Replies:** 6\
**Last updated:** [November 12, 2024, 9:10pm UTC](https://discourse.julialang.org/t/exception-access-violation-when-executing-ecos-in-multi-threading/122459 "2024-11-12T21:10:13Z")

</div>

I am conducting a Monte Carlo analysis on a convex optimization problem using the ECOS solver, accessed through the thin wrapper provided by ECOS.jl. When I run the Monte Carlo simulations sequentially, everything functi…

---

## [PDE Parameter Estimation](https://discourse.julialang.org/t/pde-parameter-estimation/120724)

<div class="topic-metadata">

**Author:** [@cartiery](https://discourse.julialang.org/u/cartiery)\
**Replies:** 5\
**Last updated:** [November 12, 2024, 2:37pm UTC](https://discourse.julialang.org/t/pde-parameter-estimation/120724 "2024-11-12T14:37:15Z")

</div>

Hello, I’m new a DifferentialEquations/ModelingToolkit user that would like to perform parameter estimation of source terms in advection-dispersion equation. I’ve defined the PDE using ModelingToolkit, based on this pos…

---

## [Ipopt produces wrong results in Windows](https://discourse.julialang.org/t/ipopt-produces-wrong-results-in-windows/122414)

<div class="topic-metadata">

**Author:** [@jbytecode](https://discourse.julialang.org/u/jbytecode)\
**Replies:** 7\
**Last updated:** [November 10, 2024, 6:49pm UTC](https://discourse.julialang.org/t/ipopt-produces-wrong-results-in-windows/122414 "2024-11-10T18:49:37Z")

</div>

Suppose the function optimizes a model for a given set of integer vectors function bestworst(pref\_to\_best::Vector{Int}, pref\_to\_worst::Vector{Int}) n = length(pref\_to\_best) best\_index = argmin(pref\_to\_best) …

---

## [Read Gurobi's .sol file format with JuMP](https://discourse.julialang.org/t/read-gurobis-sol-file-format-with-jump/122387)

<div class="topic-metadata">

**Author:** [@Jean\_F](https://discourse.julialang.org/u/Jean_F)\
**Replies:** 5\
**Last updated:** [November 8, 2024, 12:23pm UTC](https://discourse.julialang.org/t/read-gurobis-sol-file-format-with-jump/122387 "2024-11-08T12:23:58Z")

</div>

Is there a way to read with JuMP , a .sol file with as ones produced by Gurobi?

---

## [AC Optimal Power Flow in Various Nonlinear Optimization Frameworks](https://discourse.julialang.org/t/ac-optimal-power-flow-in-various-nonlinear-optimization-frameworks/78486)

<div class="topic-metadata">

**Author:** [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)\
**Replies:** 101\
**Last updated:** [November 7, 2024, 1:12pm UTC](https://discourse.julialang.org/t/ac-optimal-power-flow-in-various-nonlinear-optimization-frameworks/78486 "2024-11-07T13:12:00Z")

</div>

As a follow up to my NLP modeling survey post, I am please to announce the release of the Rosetta OPF project. The goal of this project is to highlight the basic technical requirements for solving the kinds of continuous…

---

## [Power flow balance, active and reactive power, losses in Julia](https://discourse.julialang.org/t/power-flow-balance-active-and-reactive-power-losses-in-julia/122266)

<div class="topic-metadata">

**Author:** [@saeedata7](https://discourse.julialang.org/u/saeedata7)\
**Replies:** 5\
**Last updated:** [November 6, 2024, 3:06am UTC](https://discourse.julialang.org/t/power-flow-balance-active-and-reactive-power-losses-in-julia/122266 "2024-11-06T03:06:53Z")

</div>

power flow balance, active and reactive power , losses in julia for this uploaded picture, are these codes right for calculating active and reactive power, losses in Python? If yes, how to check the power flow balan…

---

## [Issue with JuMP's Parameter making the problem recognized as nonlinear](https://discourse.julialang.org/t/issue-with-jumps-parameter-making-the-problem-recognized-as-nonlinear/122162)

<div class="topic-metadata">

**Author:** [@Yuricst](https://discourse.julialang.org/u/Yuricst)\
**Replies:** 4\
**Last updated:** [November 5, 2024, 10:01pm UTC](https://discourse.julialang.org/t/issue-with-jumps-parameter-making-the-problem-recognized-as-nonlinear/122162 "2024-11-05T22:01:27Z")

</div>

Hello! I am working on an algorithm where I would like to solve convex programs (CP) repeatedly; in the algorithm, the CP’s structure remains the same (same variables, same number of constraints, etc.), but coefficients…

---

## [Indexing sparse and dense axis arrays](https://discourse.julialang.org/t/indexing-sparse-and-dense-axis-arrays/122112)

<div class="topic-metadata">

**Author:** [@nealhughes](https://discourse.julialang.org/u/nealhughes)\
**Replies:** 7\
**Last updated:** [November 4, 2024, 4:16am UTC](https://discourse.julialang.org/t/indexing-sparse-and-dense-axis-arrays/122112 "2024-11-04T04:16:39Z")

</div>

I have a JuMP model with a mix of sparse and dense axis arrays. I find the behaviour of the indexes to be inconsistent in the sense that: eachindex(X) will give string-based indexes if X is a sparse axis array but cart…

---

## [Multivariable optimization of matrices with "no method matching zero(::Type{Matrix{Float64}})"](https://discourse.julialang.org/t/multivariable-optimization-of-matrices-with-no-method-matching-zero-type-matrix-float64/122207)

<div class="topic-metadata">

**Author:** [@ctucker](https://discourse.julialang.org/u/ctucker)\
**Replies:** 4\
**Last updated:** [November 4, 2024, 4:02am UTC](https://discourse.julialang.org/t/multivariable-optimization-of-matrices-with-no-method-matching-zero-type-matrix-float64/122207 "2024-11-04T04:02:38Z")

</div>

Hello, I am trying to maximize a message-passing Conditional Random Field using Optim.jl, and since I am optimizing for matrices I have to supply the gradient functions myself. Each of the individual functions work when…

---

## [Pyomo model not feasible for ACOPF](https://discourse.julialang.org/t/pyomo-model-not-feasible-for-acopf/122214)

<div class="topic-metadata">

**Author:** [@Glon](https://discourse.julialang.org/u/Glon)\
**Replies:** 1\
**Last updated:** [November 4, 2024, 2:30am UTC](https://discourse.julialang.org/t/pyomo-model-not-feasible-for-acopf/122214 "2024-11-04T02:30:17Z")

</div>

I implemented an ACOPF problem to maximise the PV exports of a LV network, to validate the answers and also to compare the time it takes to solve each I implemented the same problem in pyomo, while the powermodels.jl sol…

---

## [Impossible to perform autodiff on simple ODE](https://discourse.julialang.org/t/impossible-to-perform-autodiff-on-simple-ode/120861)

<div class="topic-metadata">

**Author:** [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Replies:** 22\
**Last updated:** [November 1, 2024, 10:47am UTC](https://discourse.julialang.org/t/impossible-to-perform-autodiff-on-simple-ode/120861 "2024-11-01T10:47:16Z")

</div>

Hello, I was trying to differentiate a simple ODE using Zygote.jl, but it returns the following error: ERROR: \`p\` is not a SciMLStructure. This is required for adjoint sensitivity analysis. For more information, see th…

---

## [Reusing a JuMP \`Model\` for several, different optimization problems](https://discourse.julialang.org/t/reusing-a-jump-model-for-several-different-optimization-problems/122031)

<div class="topic-metadata">

**Author:** [@tchr](https://discourse.julialang.org/u/tchr)\
**Replies:** 9\
**Last updated:** [November 1, 2024, 10:29am UTC](https://discourse.julialang.org/t/reusing-a-jump-model-for-several-different-optimization-problems/122031 "2024-11-01T10:29:53Z")

</div>

I am using JuMP to solve many (~tens to hundreds of thousands) small integer-feasibility problems (variants of a subset sum problem). Each individual problem is parameterized by different integers but the structure is qu…

---

## [Performance gains from using ParametricOptInterface.jl vs variables](https://discourse.julialang.org/t/performance-gains-from-using-parametricoptinterface-jl-vs-variables/121762)

<div class="topic-metadata">

**Author:** [@nealhughes](https://discourse.julialang.org/u/nealhughes)\
**Replies:** 7\
**Last updated:** [November 1, 2024, 6:27am UTC](https://discourse.julialang.org/t/performance-gains-from-using-parametricoptinterface-jl-vs-variables/121762 "2024-11-01T06:27:48Z")

</div>

I have a model coded in JuMP which needs to be solved multiple times in a loop. It is an inter-temporal / rolling horizon problem where the model is solved for one time period at a time, then various “parameters” need to…

---

## [Failed to precompile Gurobi](https://discourse.julialang.org/t/failed-to-precompile-gurobi/122069)

<div class="topic-metadata">

**Author:** [@Y\_Naruse](https://discourse.julialang.org/u/Y_Naruse)\
**Replies:** 4\
**Last updated:** [November 1, 2024, 2:29am UTC](https://discourse.julialang.org/t/failed-to-precompile-gurobi/122069 "2024-11-01T02:29:53Z")

</div>

I want to use Gurobi on Julia. When I try to add Gurobi like this, it fails. julia\> import Pkg julia\> Pkg.add("Gurobi") Resolving package versions... No Changes to \`C:\\Users\\N185062\\.julia\\environments\\v1.11\\Proje…

---

## [Slow JuMP model creation](https://discourse.julialang.org/t/slow-jump-model-creation/122005)

<div class="topic-metadata">

**Author:** [@jakubp](https://discourse.julialang.org/u/jakubp)\
**Replies:** 3\
**Last updated:** [October 31, 2024, 5:52pm UTC](https://discourse.julialang.org/t/slow-jump-model-creation/122005 "2024-10-31T17:52:30Z")

</div>

I am trying to solve a very large (N=100M variables) and very sparse (density ~ 1/N) QUBO problem, using CPLEX interfaced via JuMP. To this end, I’m using the following function function solve\_with\_CPLEX(Q) L = size(…

---

## [Large scale model using Gurobi causes machine crushed](https://discourse.julialang.org/t/large-scale-model-using-gurobi-causes-machine-crushed/121988)

<div class="topic-metadata">

**Author:** [@Betristor](https://discourse.julialang.org/u/Betristor)\
**Replies:** 11\
**Last updated:** [October 31, 2024, 2:40am UTC](https://discourse.julialang.org/t/large-scale-model-using-gurobi-causes-machine-crushed/121988 "2024-10-31T02:40:50Z")

</div>

For the record, I still have not found the reason why my server crushed solving some large models using JuMP+Gurobi. But I have experienced like dozens of times. Here is the situation. Each time I constructed a JuMP mod…

---

## [Reformulating Logarithmic Objective Function for Gurobi in Julia with JuMP](https://discourse.julialang.org/t/reformulating-logarithmic-objective-function-for-gurobi-in-julia-with-jump/121961)

<div class="topic-metadata">

**Author:** [@Beyza\_Aydin](https://discourse.julialang.org/u/Beyza_Aydin)\
**Replies:** 3\
**Last updated:** [October 30, 2024, 8:25pm UTC](https://discourse.julialang.org/t/reformulating-logarithmic-objective-function-for-gurobi-in-julia-with-jump/121961 "2024-10-30T20:25:20Z")

</div>

Hi, I’m working on an optimization problem in Julia where I need to maximize a logarithmic objective function (maximize sum of logs ): @objective(model, Max, sum(alp\[i\] \* log( p\[i\]) for i in 1:n)) where alp is vector…

---

## [Performing max-min optimization with optimization.jl](https://discourse.julialang.org/t/performing-max-min-optimization-with-optimization-jl/121991)

<div class="topic-metadata">

**Author:** [@KianH](https://discourse.julialang.org/u/KianH)\
**Replies:** 0\
**Last updated:** [October 30, 2024, 12:36pm UTC](https://discourse.julialang.org/t/performing-max-min-optimization-with-optimization-jl/121991 "2024-10-30T12:36:01Z")

</div>

Hello, I was wondering if it is possible to solve minimax optimization problems using Optimization.jl for neural networks? I am currently performing the optimization using Optimization.solve(...). I am specifically inte…

---

## [JuMP, moi wrapper, interface problem](https://discourse.julialang.org/t/jump-moi-wrapper-interface-problem/121776)

<div class="topic-metadata">

**Author:** [@zhenweilin](https://discourse.julialang.org/u/zhenweilin)\
**Replies:** 8\
**Last updated:** [October 30, 2024, 3:11am UTC](https://discourse.julialang.org/t/jump-moi-wrapper-interface-problem/121776 "2024-10-30T03:11:55Z")

</div>

JuMP, moi wrapper, interface problem. I am currently developing an SOCP solver designed to address the following optimization problem. min\_{x=(x\_1,x\_2),l \\leq x\_1 \\leq u, x\_2\\in\\mathcal{K}}c^\\top x \\text{ s.t.}Gx-h\\in …

---

## [Using a sparse Hessian in Optim.jl](https://discourse.julialang.org/t/using-a-sparse-hessian-in-optim-jl/121768)

<div class="topic-metadata">

**Author:** [@rsenne](https://discourse.julialang.org/u/rsenne)\
**Replies:** 21\
**Last updated:** [October 29, 2024, 1:05pm UTC](https://discourse.julialang.org/t/using-a-sparse-hessian-in-optim-jl/121768 "2024-10-29T13:05:02Z")

</div>

I’m currently trying to make code for a package I’m developing as performant as possible. One function I’m writing is to perform smoothing for a state-space model using a method advocated in this paper: where one uses…

---

## [Simple optimizer?](https://discourse.julialang.org/t/simple-optimizer/121744)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 11\
**Last updated:** [October 25, 2024, 9:54pm UTC](https://discourse.julialang.org/t/simple-optimizer/121744 "2024-10-25T21:54:48Z")

</div>

I have the following equation: res = c1 \* v\_app \* u\_s + c2/v\_app \* sin(psi) \* cos(beta) - psi\_dot and I want to determine the constants c1 and c2 based on measurements such that the the sum of res² over all measurement…

---

## [Small integer programming problem](https://discourse.julialang.org/t/small-integer-programming-problem/121647)

<div class="topic-metadata">

**Author:** [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Replies:** 27\
**Last updated:** [October 25, 2024, 5:49pm UTC](https://discourse.julialang.org/t/small-integer-programming-problem/121647 "2024-10-25T17:49:58Z")

</div>

I have a seemingly simple integer programming problem that I need a hard-coded algorithm for. Having this would help solve an issue in base Julia—interpreting floating point ranges fully correctly, if you can believe it.…

---

## [Calculating convex hulls through LP](https://discourse.julialang.org/t/calculating-convex-hulls-through-lp/121681)

<div class="topic-metadata">

**Author:** [@joaoqcouto](https://discourse.julialang.org/u/joaoqcouto)\
**Replies:** 1\
**Last updated:** [October 24, 2024, 9:39pm UTC](https://discourse.julialang.org/t/calculating-convex-hulls-through-lp/121681 "2024-10-24T21:39:54Z")

</div>

Hello, I am currently working on a problem in which I need to calculate multiple convex hulls for large datasets, as the following image shows: Two things to note: I don’t need adjacency information, simply knowing…

---

## [JuMP: which solver should I use for my problem?](https://discourse.julialang.org/t/jump-which-solver-should-i-use-for-my-problem/121421)

<div class="topic-metadata">

**Author:** [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Replies:** 13\
**Last updated:** [October 21, 2024, 8:50pm UTC](https://discourse.julialang.org/t/jump-which-solver-should-i-use-for-my-problem/121421 "2024-10-21T20:50:51Z")

</div>

Hello, I could use some guidance on this. I have the following model: COP(ΔT) = 20.3595 - 3.2061 \* log2(1 + ΔT) function baseline\_model( df::DataFrame; A\_d::Matrix{Float64}, B\_d::Matrix{Float64}, ) T\_a…

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

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