# Optimization (Mathematical)

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

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

**Page:** 27

---

## [Efficient Dual Problems in JuMP? Or: Avoiding Symbolic Overheads with Complex Objectives?](https://discourse.julialang.org/t/efficient-dual-problems-in-jump-or-avoiding-symbolic-overheads-with-complex-objectives/113953)

<div class="topic-metadata">

**Author:** [@SebKrantz](https://discourse.julialang.org/u/SebKrantz)\
**Replies:** 12\
**Last updated:** [May 9, 2024, 5:34am UTC](https://discourse.julialang.org/t/efficient-dual-problems-in-jump-or-avoiding-symbolic-overheads-with-complex-objectives/113953 "2024-05-09T05:34:53Z")

</div>

I am developing OptimalTransportNetworks,jl, a Julia library to compute optimal transport networks in spatial equilibirium originally implemented in MATLAB. Having succesfully implemented all model cases in JuMP, I am n…

---

## [Changing order of variables and constraints in Highs](https://discourse.julialang.org/t/changing-order-of-variables-and-constraints-in-highs/113959)

<div class="topic-metadata">

**Author:** [@mohammad\_amini](https://discourse.julialang.org/u/mohammad_amini)\
**Replies:** 3\
**Last updated:** [May 8, 2024, 8:27pm UTC](https://discourse.julialang.org/t/changing-order-of-variables-and-constraints-in-highs/113959 "2024-05-08T20:27:20Z")

</div>

Hi. I’m working with JuMP to solve a mathematical optimization problem. I’ve realized that when I use functions like copy(model) or methods to relax models, such as the code snippet below, the order of constraints and v…

---

## [Guidance needed for ODE problem](https://discourse.julialang.org/t/guidance-needed-for-ode-problem/113956)

<div class="topic-metadata">

**Author:** [@BALWWE](https://discourse.julialang.org/u/BALWWE)\
**Replies:** 2\
**Last updated:** [May 8, 2024, 8:22pm UTC](https://discourse.julialang.org/t/guidance-needed-for-ode-problem/113956 "2024-05-08T20:22:48Z")

</div>

to find min time to steer x0=0 to xf=100 for the dynamics x’=y, y’=u-a y-by^2, u= 1, 0, -1, a=b=0.4

---

## [Problem about solution of Gurobi in Julia](https://discourse.julialang.org/t/problem-about-solution-of-gurobi-in-julia/113993)

<div class="topic-metadata">

**Author:** [@Z\_M](https://discourse.julialang.org/u/Z_M)\
**Replies:** 1\
**Last updated:** [May 8, 2024, 1:02pm UTC](https://discourse.julialang.org/t/problem-about-solution-of-gurobi-in-julia/113993 "2024-05-08T13:02:05Z")

</div>

Hi guys! I use Gurobi in Julia. However, the solution summary is as follows： If the solve status is OPTIMAL, why it has no solution?

---

## [Abs in JuMP - how (why?) does it work](https://discourse.julialang.org/t/abs-in-jump-how-why-does-it-work/113909)

<div class="topic-metadata">

**Author:** [@blob](https://discourse.julialang.org/u/blob)\
**Replies:** 7\
**Last updated:** [May 8, 2024, 9:25am UTC](https://discourse.julialang.org/t/abs-in-jump-how-why-does-it-work/113909 "2024-05-08T09:25:54Z")

</div>

I cannot get my head around what JuMP/Ipopt is doing if I have an absolute value in the constraints. This runs and I cannot find out why: using JuMP, Ipopt tf=10 model = Model(Ipopt.Optimizer) @variable(model, 0\<=v) …

---

## [LMI optimization problem](https://discourse.julialang.org/t/lmi-optimization-problem/112218)

<div class="topic-metadata">

**Author:** [@Sharara](https://discourse.julialang.org/u/Sharara)\
**Replies:** 9\
**Last updated:** [May 7, 2024, 9:55pm UTC](https://discourse.julialang.org/t/lmi-optimization-problem/112218 "2024-05-07T21:55:26Z")

</div>

Hi there I am regenerating an optimization algorithm from a paper and I am using exactly the example provided by the ref. this is the algorithm: It starts a long operation (continuously trying to obtain results - n…

---

## [SCS not properly installed](https://discourse.julialang.org/t/scs-not-properly-installed/113881)

<div class="topic-metadata">

**Author:** [@devanshu](https://discourse.julialang.org/u/devanshu)\
**Replies:** 8\
**Last updated:** [May 6, 2024, 6:36am UTC](https://discourse.julialang.org/t/scs-not-properly-installed/113881 "2024-05-06T06:36:56Z")

</div>

I am trying to add QuantumInformation.jl package in julia. But I am getting the following error: ERROR: The following 1 direct dependency failed to precompile: SCS \[c946c3f1-0d1f-5ce8-9dea-7daa1f7e2d13\] Failed to prec…

---

## [The Einstein Riddle](https://discourse.julialang.org/t/the-einstein-riddle/113750)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 11\
**Last updated:** [May 5, 2024, 8:14pm UTC](https://discourse.julialang.org/t/the-einstein-riddle/113750 "2024-05-05T20:14:56Z")

</div>

From the web: \<\<It’s famously known as the Einstein Riddle because it was supposedly created by Einstein as a young man for fun. But there are some claims online that it actually was invented by the author of Alice’s A…

---

## [Package in julia for solving optimization problems with cubic objective function](https://discourse.julialang.org/t/package-in-julia-for-solving-optimization-problems-with-cubic-objective-function/113055)

<div class="topic-metadata">

**Author:** [@heiwie](https://discourse.julialang.org/u/heiwie)\
**Replies:** 24\
**Last updated:** [May 4, 2024, 9:46pm UTC](https://discourse.julialang.org/t/package-in-julia-for-solving-optimization-problems-with-cubic-objective-function/113055 "2024-05-04T21:46:27Z")

</div>

Hello, I am trying to solve an optimization problem which looks like this: @objective(model, Max, sum(beta\_2\[n\] \* node\_info\[2\]\[1\]\[n\]\[1\] \* prod\_levels\[2\]\[1\]\[n\] \* uncon\_probs\[2\]\[1\]\[n\] for n in 1:num\_nodes) …

---

## [Non-linear optimization with Ipopt](https://discourse.julialang.org/t/non-linear-optimization-with-ipopt/113772)

<div class="topic-metadata">

**Author:** [@bada5150](https://discourse.julialang.org/u/bada5150)\
**Replies:** 1\
**Last updated:** [May 3, 2024, 2:44am UTC](https://discourse.julialang.org/t/non-linear-optimization-with-ipopt/113772 "2024-05-03T02:44:38Z")

</div>

Hi everyone I am new to Juila and working on non-linear optimization problem with Ipopt solver. Here are my code and my third constraint is 0.0653 \* (2 \* x\[2\])^-2 \<= 30. However, I am getting \[0, 0\] and it seems like I…

---

## [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…

---

## [Find out which state(s) cause convergence problems](https://discourse.julialang.org/t/find-out-which-state-s-cause-convergence-problems/113738)

<div class="topic-metadata">

**Author:** [@BdeKoning](https://discourse.julialang.org/u/BdeKoning)\
**Replies:** 3\
**Last updated:** [May 2, 2024, 3:55pm UTC](https://discourse.julialang.org/t/find-out-which-state-s-cause-convergence-problems/113738 "2024-05-02T15:55:19Z")

</div>

I am solving various non-linear graph flow problems with OrdinaryDiffEq, with the states representing storages on the nodes. As the number of states can be quite large, it would be nice to have tooling to find out which …

---

## [InfiniteOpt: Unable to put expressions with divide operation into objective](https://discourse.julialang.org/t/infiniteopt-unable-to-put-expressions-with-divide-operation-into-objective/113661)

<div class="topic-metadata">

**Author:** [@aruna-ram](https://discourse.julialang.org/u/aruna-ram)\
**Replies:** 7\
**Last updated:** [May 2, 2024, 9:31am UTC](https://discourse.julialang.org/t/infiniteopt-unable-to-put-expressions-with-divide-operation-into-objective/113661 "2024-05-02T09:31:25Z")

</div>

Hi there! I am quite new to Julia and JuMP/InfiniteOpt. I’m trying to solve a time optimal control problem. I have an issue when I incorporate an expression using the divide operator into the objective function. The fol…

---

## [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…

---

## [How to merge two \`JuMP\` models?](https://discourse.julialang.org/t/how-to-merge-two-jump-models/113646)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 7\
**Last updated:** [May 1, 2024, 3:14am UTC](https://discourse.julialang.org/t/how-to-merge-two-jump-models/113646 "2024-05-01T03:14:59Z")

</div>

For example, there are two JuMP models named M1 and M2: using JuMP M1 = Model() @variable(M1, x \<= 3) @variable(M1, y \<= 3) @objective(M1, Max, x + y) M2 = Model() @variable(M2, x \>= 1) @variable(M2, y \>= 1) @constrai…

---

## [Baron installation issue](https://discourse.julialang.org/t/baron-installation-issue/113603)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 3\
**Last updated:** [May 1, 2024, 2:09am UTC](https://discourse.julialang.org/t/baron-installation-issue/113603 "2024-05-01T02:09:41Z")

</div>

hi All, i am facing running the issue in BARON. m = Model(BARON.Optimizer) ub = \[2, 2, 1\] @variable(m, 0 ≤ x\[i = 1:3\] ≤ ub\[i\]) @variable(m, y\[1:3\], Bin) @NLconstraints( m, begin 0.8log(x\[2\] + 1) + 0.9…

---

## [Multi variables in lsqfit](https://discourse.julialang.org/t/multi-variables-in-lsqfit/112210)

<div class="topic-metadata">

**Author:** [@Stephen](https://discourse.julialang.org/u/Stephen)\
**Replies:** 6\
**Last updated:** [May 1, 2024, 2:08am UTC](https://discourse.julialang.org/t/multi-variables-in-lsqfit/112210 "2024-05-01T02:08:27Z")

</div>

using XLSX, DataFrames, LsqFit df = DataFrame(XLSX.readtable("SMB.xlsx","平衡吸附量", infer\_eltypes = true)) function Com\_Langmuir(p, x) Ha, bA, bC, Hc = p CA = @view x\[:, 1\] CC = @view x\[:, 2\] @. qA = Ha\*CA…

---

## [Efficient approach to modifying existing JuMP constraints](https://discourse.julialang.org/t/efficient-approach-to-modifying-existing-jump-constraints/113492)

<div class="topic-metadata">

**Author:** [@aartinian](https://discourse.julialang.org/u/aartinian)\
**Replies:** 8\
**Last updated:** [April 29, 2024, 7:21am UTC](https://discourse.julialang.org/t/efficient-approach-to-modifying-existing-jump-constraints/113492 "2024-04-29T07:21:49Z")

</div>

Hello everyone, Long time lurker, first time poster. :smiley: I’m trying to add a new expression to an existing JuMP constraint, but my approach seems pretty slow. Am I approaching this wrong? Thank you in advance. # @…

---

## [Is there a tutorial on \`JuMP\` extension development?](https://discourse.julialang.org/t/is-there-a-tutorial-on-jump-extension-development/113580)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 2\
**Last updated:** [April 28, 2024, 6:20am UTC](https://discourse.julialang.org/t/is-there-a-tutorial-on-jump-extension-development/113580 "2024-04-28T06:20:53Z")

</div>

Is there a tutorial on JuMP extension development? I’m curious about how to transform a naturally written model (similar to the JuMP modeling language) into a standardized format that is suitable for algorithmic solving. …

---

## [How to extract the indices of a certain variable from a \`Vector{VariableRef}\`?](https://discourse.julialang.org/t/how-to-extract-the-indices-of-a-certain-variable-from-a-vector-variableref/113555)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 2\
**Last updated:** [April 28, 2024, 3:21am UTC](https://discourse.julialang.org/t/how-to-extract-the-indices-of-a-certain-variable-from-a-vector-variableref/113555 "2024-04-28T03:21:30Z")

</div>

using JuMP m = Model() @variable(m, x\[1:3\]) @variable(m, y\[1:5\]) v = all\_variables(m) v is an 8-element Vector{VariableRef}. Now I want to extract all the indices with respect to variable y from the vector v (e.g., it c…

---

## [How to eliminate a variable from a JuMP model?](https://discourse.julialang.org/t/how-to-eliminate-a-variable-from-a-jump-model/113557)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 1\
**Last updated:** [April 27, 2024, 10:30pm UTC](https://discourse.julialang.org/t/how-to-eliminate-a-variable-from-a-jump-model/113557 "2024-04-27T22:30:01Z")

</div>

For example, with the help of Polyhedra.jl one can eliminate variable y from model m (or project m onto x space) and obtain a polyhedron P with respect to x: using JuMP, Polyhedra, CDDLib m = Model() @variable(m, x) @va…

---

## [Best free SDP, JuMP supported solvers?](https://discourse.julialang.org/t/best-free-sdp-jump-supported-solvers/102413)

<div class="topic-metadata">

**Author:** [@nlaws](https://discourse.julialang.org/u/nlaws)\
**Replies:** 8\
**Last updated:** [April 26, 2024, 3:01pm UTC](https://discourse.julialang.org/t/best-free-sdp-jump-supported-solvers/102413 "2024-04-26T15:01:41Z")

</div>

There are quite a few free SDP solvers listed in the supported JuMP solvers. I’m wondering (even if just anecdotally) what other’s experiences are like and what folks have found to work well? I have tried maybe half of t…

---

## [ERROR: LoadError: MethodError: no method matching \_init\_identity\_matrix(::ComponentVector{Float32, Vector{Float32}, Tuple{Axis{…}}}, ::Float64)](https://discourse.julialang.org/t/error-loaderror-methoderror-no-method-matching-init-identity-matrix-componentvector-float32-vector-float32-tuple-axis-float64/112211)

<div class="topic-metadata">

**Author:** [@KianH](https://discourse.julialang.org/u/KianH)\
**Replies:** 8\
**Last updated:** [April 25, 2024, 5:43am UTC](https://discourse.julialang.org/t/error-loaderror-methoderror-no-method-matching-init-identity-matrix-componentvector-float32-vector-float32-tuple-axis-float64/112211 "2024-04-25T05:43:04Z")

</div>

Hi, When using BFGS from Optim.jl I occasionally get the following error message: ERROR: LoadError: MethodError: no method matching \_init\_identity\_matrix(::ComponentVector{Float32, Vector{Float32}, Tuple{Axis{…}}}, ::F…

---

## [Weird empty sum behavior in JuMP](https://discourse.julialang.org/t/weird-empty-sum-behavior-in-jump/113386)

<div class="topic-metadata">

**Author:** [@KSepetanc](https://discourse.julialang.org/u/KSepetanc)\
**Replies:** 3\
**Last updated:** [April 24, 2024, 9:36pm UTC](https://discourse.julialang.org/t/weird-empty-sum-behavior-in-jump/113386 "2024-04-24T21:36:57Z")

</div>

I am coding basic AC OPF model. The following sum results in an error: -(Vd\[n\]^2+Vq\[n\]^2)\*sum(gs\[sh\] for sh in bus\_shunts\[n\]) LoadError: MethodError: no method matching zero(::Type{MutableArithmetics.Zero}) Closest ca…

---

## [Request help solving a Mathematical Programming with Equilibrium Constraints problem in JuMP?](https://discourse.julialang.org/t/request-help-solving-a-mathematical-programming-with-equilibrium-constraints-problem-in-jump/41802)

<div class="topic-metadata">

**Author:** [@jack\_rabbit](https://discourse.julialang.org/u/jack_rabbit)\
**Replies:** 10\
**Last updated:** [April 24, 2024, 7:58pm UTC](https://discourse.julialang.org/t/request-help-solving-a-mathematical-programming-with-equilibrium-constraints-problem-in-jump/41802 "2024-04-24T19:58:36Z")

</div>

Hi, I am pretty new to both Julia and JuMP. Please feel free to point out any aspects that I didn’t understand well. I am trying to solve a Mathematical Programming with Equilibrium Constraints (MPEC) problem using the…

---

## [How to add variables with the same name in JuMP?](https://discourse.julialang.org/t/how-to-add-variables-with-the-same-name-in-jump/113324)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 3\
**Last updated:** [April 23, 2024, 8:55pm UTC](https://discourse.julialang.org/t/how-to-add-variables-with-the-same-name-in-jump/113324 "2024-04-23T20:55:03Z")

</div>

Hello, I am trying to reproduce a model from a mosel file in JuMP. The mosel file uses a loop to iteratively define variables at specific indices. However, in JuMP, it seems I can’t find how to add variables with the sa…

---

## [Parameter bounds and confidence intervals in LsqFit.jl?](https://discourse.julialang.org/t/parameter-bounds-and-confidence-intervals-in-lsqfit-jl/113366)

<div class="topic-metadata">

**Author:** [@PeX](https://discourse.julialang.org/u/PeX)\
**Replies:** 1\
**Last updated:** [April 23, 2024, 7:40am UTC](https://discourse.julialang.org/t/parameter-bounds-and-confidence-intervals-in-lsqfit-jl/113366 "2024-04-23T07:40:03Z")

</div>

HI all, I’m trying to use LsqFit.jl to fit a model in the form of: model(t, p) = @. p\[1\] \* t^3 + p\[2\] \* t + p\[5\]\*sin(2\*π\*p\[3\]\*t + p\[4\]) However, I need p\[4\] to be strictly between 0 and pi. Is it possible to do it? I…

---

## [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…

---

## [SCIP.jl: how to add a new parameter?](https://discourse.julialang.org/t/scip-jl-how-to-add-a-new-parameter/113246)

<div class="topic-metadata">

**Author:** [@Maxime](https://discourse.julialang.org/u/Maxime)\
**Replies:** 2\
**Last updated:** [April 21, 2024, 1:16pm UTC](https://discourse.julialang.org/t/scip-jl-how-to-add-a-new-parameter/113246 "2024-04-21T13:16:48Z")

</div>

Hello, I am trying to use SCIP.jl with a custom branch of SCIP (exact-rational branch). I managed to compile this branch and to pass the install dir to SCIP.jl in my ENV\[“SCIPOPTDIR”\]. As indicated on the Readme of the …

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

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