# Optimization (Mathematical)

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

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

**Page:** 47

---

## [Help on model a problem/function to use with Optimization.jl](https://discourse.julialang.org/t/help-on-model-a-problem-function-to-use-with-optimization-jl/95942)

<div class="topic-metadata">

**Author:** [@rodolforbcoutinho](https://discourse.julialang.org/u/rodolforbcoutinho)\
**Replies:** 17\
**Last updated:** [March 27, 2023, 2:25am UTC](https://discourse.julialang.org/t/help-on-model-a-problem-function-to-use-with-optimization-jl/95942 "2023-03-27T02:25:55Z")

</div>

Hello to all. I’m trying to use Optimization.jl to solve a problem, but a I dont know how to define the problem in a way the package needs it. In my problem I have an Array of a Struct with several parameters and for ea…

---

## [All solutions of linear program](https://discourse.julialang.org/t/all-solutions-of-linear-program/96562)

<div class="topic-metadata">

**Author:** [@ahmad88](https://discourse.julialang.org/u/ahmad88)\
**Replies:** 6\
**Last updated:** [March 25, 2023, 4:54am UTC](https://discourse.julialang.org/t/all-solutions-of-linear-program/96562 "2023-03-25T04:54:53Z")

</div>

if I have the following model VC\_model2 = direct\_model(Gurobi.Optimizer()) @variable(VC\_model2, y\[i=initial:n\], binary=true) @variable(VC\_model2, x\[i=initial:n\], binary=true) ########################################…

---

## [Add a constraint to a model iteratively](https://discourse.julialang.org/t/add-a-constraint-to-a-model-iteratively/96558)

<div class="topic-metadata">

**Author:** [@ahmad88](https://discourse.julialang.org/u/ahmad88)\
**Replies:** 2\
**Last updated:** [March 24, 2023, 9:28pm UTC](https://discourse.julialang.org/t/add-a-constraint-to-a-model-iteratively/96558 "2023-03-24T21:28:32Z")

</div>

I have a model as follows VC\_model2 = direct\_model(Gurobi.Optimizer()) @variable(VC\_model2, y\[i=initial:n\], binary=true) @variable(VC\_model2, x\[i=initial:n\], binary=true) ###############################################…

---

## [Inconsistent solutions from JuMP vs InfiniteOpt for discretized optimal control](https://discourse.julialang.org/t/inconsistent-solutions-from-jump-vs-infiniteopt-for-discretized-optimal-control/96539)

<div class="topic-metadata">

**Author:** [@mbanchio](https://discourse.julialang.org/u/mbanchio)\
**Replies:** 4\
**Last updated:** [March 24, 2023, 5:53pm UTC](https://discourse.julialang.org/t/inconsistent-solutions-from-jump-vs-infiniteopt-for-discretized-optimal-control/96539 "2023-03-24T17:53:48Z")

</div>

Hello everyone, I have been playing around with JuMP recently to understand the structure of an optimal control problem. For clarity, the problem is the following. I want to find the function x(c,\\theta) such that \\fora…

---

## [How to loop over the variables of a JuMP model?](https://discourse.julialang.org/t/how-to-loop-over-the-variables-of-a-jump-model/96463)

<div class="topic-metadata">

**Author:** [@geo1093](https://discourse.julialang.org/u/geo1093)\
**Replies:** 4\
**Last updated:** [March 23, 2023, 7:22pm UTC](https://discourse.julialang.org/t/how-to-loop-over-the-variables-of-a-jump-model/96463 "2023-03-23T19:22:37Z")

</div>

Hi, I hope my question is not already answered somewhere else, I couldn’t find it. Here is the beginning of a MWE (I actually have many more variables and bigger sets): using JuMP, Gurobi model = Model(Gurobi.Optimize…

---

## [Which JuMP solvers support compute\_conflict!?](https://discourse.julialang.org/t/which-jump-solvers-support-compute-conflict/95733)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 9\
**Last updated:** [March 23, 2023, 7:12pm UTC](https://discourse.julialang.org/t/which-jump-solvers-support-compute-conflict/95733 "2023-03-23T19:12:45Z")

</div>

I am trying to show the constraints of an infeasible problem in a human-readable format and found compute\_conflict! in the docs: Solutions · JuMP! The COSMO.jl solver doesn’t support the function. Is there any other pu…

---

## [The solution of JuMP model cannot splice horizontally](https://discourse.julialang.org/t/the-solution-of-jump-model-cannot-splice-horizontally/96511)

<div class="topic-metadata">

**Author:** [@kevinqiao](https://discourse.julialang.org/u/kevinqiao)\
**Replies:** 1\
**Last updated:** [March 23, 2023, 7:07pm UTC](https://discourse.julialang.org/t/the-solution-of-jump-model-cannot-splice-horizontally/96511 "2023-03-23T19:07:07Z")

</div>

I encountered an interesting question, I defined a sub-function (it’s a model) with a variable vector of 9×1 dimension, and the variables are as follows @variable(model, varFlow\[1:9\], Bin) The problem can be solved, an…

---

## [Unable to use set\_attribute](https://discourse.julialang.org/t/unable-to-use-set-attribute/96529)

<div class="topic-metadata">

**Author:** [@lilychow233](https://discourse.julialang.org/u/lilychow233)\
**Replies:** 1\
**Last updated:** [March 23, 2023, 7:06pm UTC](https://discourse.julialang.org/t/unable-to-use-set-attribute/96529 "2023-03-23T19:06:02Z")

</div>

Hi. My julia version is 1.8.5. I tried to run the Benders Decomposition example from However, issues occured with the Callback Method. Specifically with this line: set\_attribute(lazy\_model, MOI.LazyConstraintCallbac…

---

## [Extracting data vectors in constraint from sum notation in JuMP](https://discourse.julialang.org/t/extracting-data-vectors-in-constraint-from-sum-notation-in-jump/96448)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 4\
**Last updated:** [March 22, 2023, 10:25pm UTC](https://discourse.julialang.org/t/extracting-data-vectors-in-constraint-from-sum-notation-in-jump/96448 "2023-03-22T22:25:27Z")

</div>

Dear All, I am working on an optimization problem where I have a variable y\_{i,j} where i,j \\in \[1:n\] = \\{1,2,\\ldots,n\\}. I have a constraint of the form \\sum\_{j \\in \[1:n\]} y\_{j,i} - \\sum\_{j \\in \[1:n\]} y\_{i,j} \\geq b\_…

---

## [ITERATION\_LIMIT with small changes in constraints](https://discourse.julialang.org/t/iteration-limit-with-small-changes-in-constraints/96403)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 3\
**Last updated:** [March 22, 2023, 7:07pm UTC](https://discourse.julialang.org/t/iteration-limit-with-small-changes-in-constraints/96403 "2023-03-22T19:07:40Z")

</div>

I have a linear problem with linear equality and inequality constraints (and interval constraints). It works perfectly with various lower and upper bounds, but specific values trigger this ITERATION\_LIMIT and there is no…

---

## [DiffEqJump/Catalyst, Turing possible?](https://discourse.julialang.org/t/diffeqjump-catalyst-turing-possible/83479)

<div class="topic-metadata">

**Author:** [@jae0](https://discourse.julialang.org/u/jae0)\
**Replies:** 4\
**Last updated:** [March 21, 2023, 5:52pm UTC](https://discourse.julialang.org/t/diffeqjump-catalyst-turing-possible/83479 "2023-03-21T17:52:09Z")

</div>

Hi, I am wondering if it is possible to do parameter inference using Turing for a DiffEqJump model? I understand that this type of problem might be better handled using an optimizer, but I am curious if it can be done …

---

## [Is it possible to store the JuMP output to an \*.xlsx?](https://discourse.julialang.org/t/is-it-possible-to-store-the-jump-output-to-an-xlsx/95887)

<div class="topic-metadata">

**Author:** [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Replies:** 15\
**Last updated:** [March 20, 2023, 3:30pm UTC](https://discourse.julialang.org/t/is-it-possible-to-store-the-jump-output-to-an-xlsx/95887 "2023-03-20T15:30:19Z")

</div>

Hi, I have a model that uses CPLEX to find optimal solution. When I call JuMP.value.(x) ir cannot show all elements in the terminal. So, I’ve tried write\_to\_file(model, "model.xlsx") to store it in excel file to see wh…

---

## [AssertionError when deleting and updating constraint in JuMP using Mosek solver](https://discourse.julialang.org/t/assertionerror-when-deleting-and-updating-constraint-in-jump-using-mosek-solver/96238)

<div class="topic-metadata">

**Author:** [@bobo](https://discourse.julialang.org/u/bobo)\
**Replies:** 2\
**Last updated:** [March 20, 2023, 12:53pm UTC](https://discourse.julialang.org/t/assertionerror-when-deleting-and-updating-constraint-in-jump-using-mosek-solver/96238 "2023-03-20T12:53:45Z")

</div>

Dear team, I would like to sequentially solve a problem by updating a constraint, the way I do it is to delete and restate the constraint inside a loop. Once the problem is solved and I try to delete the constraint I ge…

---

## [Can you use Gurobi's \`ObjNRelTol\` and \`ObjNAbsTol\`?](https://discourse.julialang.org/t/can-you-use-gurobis-objnreltol-and-objnabstol/96327)

<div class="topic-metadata">

**Author:** [@gleyland](https://discourse.julialang.org/u/gleyland)\
**Replies:** 3\
**Last updated:** [March 20, 2023, 7:38am UTC](https://discourse.julialang.org/t/can-you-use-gurobis-objnreltol-and-objnabstol/96327 "2023-03-20T07:38:59Z")

</div>

Hi, As for the subject. We’ve tried MOI.set(grb, Gurobi.MultiObjectiveAttribute("ObjNRelTol", 0.001)) But we got ERROR: LoadError: UndefVarError: MultiObjectiveAttribute not defined We’re on Gurobi 0.11.5, which se…

---

## [Defining variables in JuMP](https://discourse.julialang.org/t/defining-variables-in-jump/95843)

<div class="topic-metadata">

**Author:** [@kevinqiao](https://discourse.julialang.org/u/kevinqiao)\
**Replies:** 4\
**Last updated:** [March 20, 2023, 2:46am UTC](https://discourse.julialang.org/t/defining-variables-in-jump/95843 "2023-03-20T02:46:46Z")

</div>

Hello, I have a question about defining variables in JuMP, normally, the variables are defined as @variable(model, testContinusVar) @variable(model, testIntegerVar, Int) @variable(model, testBinaryVar, Bin) And what i…

---

## [Warm starting Xpress with a full basis using JuMP](https://discourse.julialang.org/t/warm-starting-xpress-with-a-full-basis-using-jump/96216)

<div class="topic-metadata">

**Author:** [@Diego](https://discourse.julialang.org/u/Diego)\
**Replies:** 6\
**Last updated:** [March 19, 2023, 8:40pm UTC](https://discourse.julialang.org/t/warm-starting-xpress-with-a-full-basis-using-jump/96216 "2023-03-19T20:40:53Z")

</div>

Dear all, I have tried setting initial values/duals of similar problems in JuMP/Xpress for LP problems but we have not been very successful for LP, for MIP we have been though. I was wondering whether Xpress.writebasis…

---

## [Does anyone know how to solve MI-SDP problem in Julia?](https://discourse.julialang.org/t/does-anyone-know-how-to-solve-mi-sdp-problem-in-julia/9725)

<div class="topic-metadata">

**Author:** [@Sharabh\_Shukla](https://discourse.julialang.org/u/Sharabh_Shukla)\
**Replies:** 13\
**Last updated:** [March 17, 2023, 9:59pm UTC](https://discourse.julialang.org/t/does-anyone-know-how-to-solve-mi-sdp-problem-in-julia/9725 "2023-03-17T21:59:04Z")

</div>

I am working on an MI-SDP model and I have no idea how to solve it using Julia. I tried solving the model in convex using MOSEK as a solver, it turns out it failed, throwing some nasty error. Any ideas on solving Mixed …

---

## [Ways to save and load JuMP models from/to disk or memory](https://discourse.julialang.org/t/ways-to-save-and-load-jump-models-from-to-disk-or-memory/33465)

<div class="topic-metadata">

**Author:** [@Diego](https://discourse.julialang.org/u/Diego)\
**Replies:** 31\
**Last updated:** [March 17, 2023, 9:58pm UTC](https://discourse.julialang.org/t/ways-to-save-and-load-jump-models-from-to-disk-or-memory/33465 "2023-03-17T21:58:32Z")

</div>

Dear team, Is there a way to save JuMP models to disk and then load them back and then just perform some modifications? Thank you!

---

## [Easy way to scale model in JuMP?](https://discourse.julialang.org/t/easy-way-to-scale-model-in-jump/96212)

<div class="topic-metadata">

**Author:** [@shakedregev](https://discourse.julialang.org/u/shakedregev)\
**Replies:** 2\
**Last updated:** [March 17, 2023, 5:34pm UTC](https://discourse.julialang.org/t/easy-way-to-scale-model-in-jump/96212 "2023-03-17T17:34:20Z")

</div>

I’m developing a linear solver for an optimization solver that requires a scaled constraint matrix. I am solving an LP, so the constraint matrix is constant. I would like to be able to scale the constraints within the op…

---

## [Mosek install broken on osx](https://discourse.julialang.org/t/mosek-install-broken-on-osx/96226)

<div class="topic-metadata">

**Author:** [@richardrl](https://discourse.julialang.org/u/richardrl)\
**Replies:** 2\
**Last updated:** [March 17, 2023, 7:03am UTC](https://discourse.julialang.org/t/mosek-install-broken-on-osx/96226 "2023-03-17T07:03:09Z")

</div>

\*\*(@v1.8) pkg\>\*\* add MosekTools, Mosek, Convex, Images, DelimitedFiles, Gadfly \*\*Updating\*\* registry at \`~/.julia/registries/General.toml\` \*\*Resolving\*\* package versions... \*\*Installed\*\* MosekTools ─ v0.13.2 \*\*Instal…

---

## [Reading JuMP model "lower bound already set"](https://discourse.julialang.org/t/reading-jump-model-lower-bound-already-set/96156)

<div class="topic-metadata">

**Author:** [@shakedregev](https://discourse.julialang.org/u/shakedregev)\
**Replies:** 7\
**Last updated:** [March 16, 2023, 9:49pm UTC](https://discourse.julialang.org/t/reading-jump-model-lower-bound-already-set/96156 "2023-03-16T21:49:20Z")

</div>

Writing the model like this works model = JuMP.Model(Clarabel.Optimizer) \*set variables and contraints\* write\_to\_file(model, "my\_model.lp") The model is also solved correctly by Clarabel. However, problems occur when I…

---

## [How to create a variable that is Hermitian but not PSD?](https://discourse.julialang.org/t/how-to-create-a-variable-that-is-hermitian-but-not-psd/96170)

<div class="topic-metadata">

**Author:** [@araujoms](https://discourse.julialang.org/u/araujoms)\
**Replies:** 1\
**Last updated:** [March 16, 2023, 7:43pm UTC](https://discourse.julialang.org/t/how-to-create-a-variable-that-is-hermitian-but-not-psd/96170 "2023-03-16T19:43:00Z")

</div>

I need to create a Hermitian matrix that is not PSD for solving a specific problem. How do I do that? The obvious syntax @variable(model, x\[1:d,1:d\], Hermitian) gives an error, unlike @variable(model, x\[1:d,1:d\], Symmetr…

---

## [MethodError: Cannot \`convert\` an object of type Missing to an object of type Float64](https://discourse.julialang.org/t/methoderror-cannot-convert-an-object-of-type-missing-to-an-object-of-type-float64/96160)

<div class="topic-metadata">

**Author:** [@Saba\_ghasemi](https://discourse.julialang.org/u/Saba_ghasemi)\
**Replies:** 4\
**Last updated:** [March 16, 2023, 7:42pm UTC](https://discourse.julialang.org/t/methoderror-cannot-convert-an-object-of-type-missing-to-an-object-of-type-float64/96160 "2023-03-16T19:42:15Z")

</div>

I tried to solve a very big optimization problem (MIQCP), and the error MethodError: Cannot convert an object of type Missing to an object of type Float64 Closest candidates are: convert(::Type{T}, ::T) where T\<:Numbe…

---

## [MultiObjectiveAlgorithms.EpsilonConstraint runs infinitely](https://discourse.julialang.org/t/multiobjectivealgorithms-epsilonconstraint-runs-infinitely/96178)

<div class="topic-metadata">

**Author:** [@mdogan](https://discourse.julialang.org/u/mdogan)\
**Replies:** 3\
**Last updated:** [March 16, 2023, 7:41pm UTC](https://discourse.julialang.org/t/multiobjectivealgorithms-epsilonconstraint-runs-infinitely/96178 "2023-03-16T19:41:32Z")

</div>

I am trying to solve an optimization problem (obtain the efficient frontier of optimal portfolios by maximizing expected return per given level of sharpe ratio). However, the solution runs infinitely (though not always, …

---

## [Sequential AC power flow using PowerModels.jl](https://discourse.julialang.org/t/sequential-ac-power-flow-using-powermodels-jl/96183)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 1\
**Last updated:** [March 16, 2023, 6:22pm UTC](https://discourse.julialang.org/t/sequential-ac-power-flow-using-powermodels-jl/96183 "2023-03-16T18:22:43Z")

</div>

I am trying to run repeated AC power flow calculations for a large grid using PowerModels.jl. Digging through the code revealed that there is some way to efficiently run successive power flow solves, but I couldn’t reall…

---

## [Is it possible to see a solution related to upper bound?](https://discourse.julialang.org/t/is-it-possible-to-see-a-solution-related-to-upper-bound/95735)

<div class="topic-metadata">

**Author:** [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Replies:** 5\
**Last updated:** [March 16, 2023, 9:12am UTC](https://discourse.julialang.org/t/is-it-possible-to-see-a-solution-related-to-upper-bound/95735 "2023-03-16T09:12:53Z")

</div>

Hi guys, I use CPLEX as an optimizer and JuMP apackage. I have a big IP that needs at least 2hours to generate a soultion. I wonder is there a way to stop it early? when running a model that takes a long time to give y…

---

## [Estimating parameters of ODEs leads to instability](https://discourse.julialang.org/t/estimating-parameters-of-odes-leads-to-instability/96149)

<div class="topic-metadata">

**Author:** [@stepanoslejsek](https://discourse.julialang.org/u/stepanoslejsek)\
**Replies:** 1\
**Last updated:** [March 15, 2023, 11:34pm UTC](https://discourse.julialang.org/t/estimating-parameters-of-odes-leads-to-instability/96149 "2023-03-15T23:34:31Z")

</div>

I have a system of ODEs in a form of: Dt(θ) ~ θ̇ Dt(θ̇) ~ a₁ \* θ̇ + a₂ \* sin(ψ) + a₃ \* ψ̇ + a₄ \* u(t) Dt(ψ) ~ ψ̇ Dt(ψ̇) ~ a₅ \* θ̇ + a₆ \* sin(ψ) + a₇ \* ψ̇ + a₈ \* u(t) where a₁,…,a₈ are parameters to be estimated…

---

## [Trying to use FileFormats with JuMP](https://discourse.julialang.org/t/trying-to-use-fileformats-with-jump/96144)

<div class="topic-metadata">

**Author:** [@shakedregev](https://discourse.julialang.org/u/shakedregev)\
**Replies:** 1\
**Last updated:** [March 15, 2023, 7:35pm UTC](https://discourse.julialang.org/t/trying-to-use-fileformats-with-jump/96144 "2023-03-15T19:35:17Z")

</div>

Following the example here, I’m trying to use JuMP to write a model to a file. src = JuMP.Model(Clarabel.Optimizer) filename = "my\_model.lp" dest = FileFormats.Model(filename = filename) MOI.copy\_to(dest, src) MOI.write…

---

## [Installing Mosek Error for JuMP](https://discourse.julialang.org/t/installing-mosek-error-for-jump/96083)

<div class="topic-metadata">

**Author:** [@A\_M](https://discourse.julialang.org/u/A_M)\
**Replies:** 15\
**Last updated:** [March 15, 2023, 6:35pm UTC](https://discourse.julialang.org/t/installing-mosek-error-for-jump/96083 "2023-03-15T18:35:51Z")

</div>

I used to use something like this to build a docker, but suddenly I started getting this error FROM ubuntu:18.04 as base RUN apt-get -y update; apt-get -y install curl ENV JULIA\_PATH /julia ENV PATH "$JULIA\_PATH/bin:$PA…

---

## [Slow model construction in JuMP](https://discourse.julialang.org/t/slow-model-construction-in-jump/95455)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 14\
**Last updated:** [March 14, 2023, 10:28pm UTC](https://discourse.julialang.org/t/slow-model-construction-in-jump/95455 "2023-03-14T22:28:03Z")

</div>

I find that when I am modeling a problem in JuMP, the model construction takes a long time. My first thought was that maybe I am writing inefficient code, and I was wondering: if there might be any quick fixes to my Ju…

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

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