# Optimization (Mathematical)

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

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

**Page:** 65

---

## [Writing a QP to MPS?](https://discourse.julialang.org/t/writing-a-qp-to-mps/79764)

<div class="topic-metadata">

**Author:** [@gleyland](https://discourse.julialang.org/u/gleyland)\
**Replies:** 1\
**Last updated:** [April 21, 2022, 5:40am UTC](https://discourse.julialang.org/t/writing-a-qp-to-mps/79764 "2022-04-21T05:40:15Z")

</div>

Hi, As far as I can tell, you can’t write a QP to an MPS file with write\_to\_file, but I’ve told that MPS does support QPs. Are either of those correct? (ie, should I be able to write QP to MPS, but I’m doing it wrong, …

---

## [Warmstart in \`COSMO.jl\` with \`JuMP\`](https://discourse.julialang.org/t/warmstart-in-cosmo-jl-with-jump/79727)

<div class="topic-metadata">

**Author:** [@wujinq](https://discourse.julialang.org/u/wujinq)\
**Replies:** 1\
**Last updated:** [April 20, 2022, 9:58am UTC](https://discourse.julialang.org/t/warmstart-in-cosmo-jl-with-jump/79727 "2022-04-20T09:58:37Z")

</div>

I’m currently using COSMO.jl to do a large scale SDP with JuMP as the interface. Is it possible to store the status of model for example every 100000 iterations, and if max\_iter is reached, to start from the starting sta…

---

## [Solving SDP problem is 100x slower than Matlab CVX](https://discourse.julialang.org/t/solving-sdp-problem-is-100x-slower-than-matlab-cvx/79704)

<div class="topic-metadata">

**Author:** [@biona001](https://discourse.julialang.org/u/biona001)\
**Replies:** 5\
**Last updated:** [April 19, 2022, 9:28pm UTC](https://discourse.julialang.org/t/solving-sdp-problem-is-100x-slower-than-matlab-cvx/79704 "2022-04-19T21:28:35Z")

</div>

I’m trying to solve the following SDP problem \\begin{align\*} maximize \\ & \\sum\_j s\_j\\\\ \\text{subject to } \\ & 2\\Sigma - diag(s) \\succeq 0,\\\\ & 0 \\le s\_j \\le 1 \\end{align\*} Julia’s SCS solver with Convex.jl is 100x sl…

---

## [Querying optimizer to set for another JuMP model](https://discourse.julialang.org/t/querying-optimizer-to-set-for-another-jump-model/79672)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 15\
**Last updated:** [April 19, 2022, 5:07am UTC](https://discourse.julialang.org/t/querying-optimizer-to-set-for-another-jump-model/79672 "2022-04-19T05:07:09Z")

</div>

I have a question (probably very naive though) on how to query an optimizer used for a particular model, so that I can use it in another JuMP model. For example, suppose user decides to use GLPK for the first model as sh…

---

## [Dummy variable change optimization result](https://discourse.julialang.org/t/dummy-variable-change-optimization-result/79646)

<div class="topic-metadata">

**Author:** [@dscheirman](https://discourse.julialang.org/u/dscheirman)\
**Replies:** 2\
**Last updated:** [April 18, 2022, 10:10pm UTC](https://discourse.julialang.org/t/dummy-variable-change-optimization-result/79646 "2022-04-18T22:10:20Z")

</div>

Hi, I have established a JuMP model (gurobi optimizer) and one constraint seems to be not respected: @constraint(obj,OP\_t == sum(sum(sum(((opex\_trans\[i,1,k,1\]\*Nsh\[i,1,k,t\]) + (opex\_trans\[i,1,k,2\]\*Np\[i,1,k,t\])) for i in…

---

## [Help speeding up mixed integer SDP solve](https://discourse.julialang.org/t/help-speeding-up-mixed-integer-sdp-solve/23889)

<div class="topic-metadata">

**Author:** [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Replies:** 3\
**Last updated:** [April 16, 2022, 5:26am UTC](https://discourse.julialang.org/t/help-speeding-up-mixed-integer-sdp-solve/23889 "2022-04-16T05:26:30Z")

</div>

I have a big mixed-integer SDP that I’d like to solve. Essentially my difficulty is it takes too long to solve-- using Pajarito, it doesn’t even finish the first MILP solve in 12 hours with access to 216 cores and 6 TB o…

---

## [Early Stopping Using Float Cutoff on Dual](https://discourse.julialang.org/t/early-stopping-using-float-cutoff-on-dual/79516)

<div class="topic-metadata">

**Author:** [@chelseas](https://discourse.julialang.org/u/chelseas)\
**Replies:** 2\
**Last updated:** [April 15, 2022, 11:27pm UTC](https://discourse.julialang.org/t/early-stopping-using-float-cutoff-on-dual/79516 "2022-04-15T23:27:31Z")

</div>

I cannot figure out how to do the following. I would like for JuMP to stop once the dual bound (lower bound for minimization) is above some value. OR similarly, once the dual bound (upper bound for maximization) is belo…

---

## [How to pass 'ADNLPModels.ReverseDiffAD() as the adbackend keyword argument to the ADNLPModel or ADNLSModel constructor.'](https://discourse.julialang.org/t/how-to-pass-adnlpmodels-reversediffad-as-the-adbackend-keyword-argument-to-the-adnlpmodel-or-adnlsmodel-constructor/79442)

<div class="topic-metadata">

**Author:** [@Gummala\_Navneeth](https://discourse.julialang.org/u/Gummala_Navneeth)\
**Replies:** 10\
**Last updated:** [April 14, 2022, 8:49pm UTC](https://discourse.julialang.org/t/how-to-pass-adnlpmodels-reversediffad-as-the-adbackend-keyword-argument-to-the-adnlpmodel-or-adnlsmodel-constructor/79442 "2022-04-14T20:49:42Z")

</div>

Hi all, I’m trying to minimize a function which has constraint as nonlinear vector function. input of constraint function is vector and output of constraint function is a vector of large size ( more than 500 elements ) …

---

## [A problem with JuMP variable defined](https://discourse.julialang.org/t/a-problem-with-jump-variable-defined/79365)

<div class="topic-metadata">

**Author:** [@mahon](https://discourse.julialang.org/u/mahon)\
**Replies:** 2\
**Last updated:** [April 13, 2022, 6:06pm UTC](https://discourse.julialang.org/t/a-problem-with-jump-variable-defined/79365 "2022-04-13T18:06:46Z")

</div>

i want constraint my variable Pg , how can i do?

---

## [Defining Non Linear Vector Constraints in JuMP](https://discourse.julialang.org/t/defining-non-linear-vector-constraints-in-jump/4742)

<div class="topic-metadata">

**Author:** [@acauligi](https://discourse.julialang.org/u/acauligi)\
**Replies:** 5\
**Last updated:** [April 13, 2022, 3:49pm UTC](https://discourse.julialang.org/t/defining-non-linear-vector-constraints-in-jump/4742 "2022-04-13T15:49:54Z")

</div>

I’m trying to implement pseudospectral methods using JuMP & Ipopt. The state is n-dimensional and control m-dimensional and the values are evaluated at N+1 collocation points; in this particular problem, n=3, m=3, and N …

---

## [JuMP problem get conflicting constraints when using small values](https://discourse.julialang.org/t/jump-problem-get-conflicting-constraints-when-using-small-values/79425)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 4\
**Last updated:** [April 13, 2022, 2:04pm UTC](https://discourse.julialang.org/t/jump-problem-get-conflicting-constraints-when-using-small-values/79425 "2022-04-13T14:04:04Z")

</div>

In JuMP I’m having problems getting conflicting equality constraints when using small values using JuMP using Gurobi model = Model(Gurobi.Optimizer) @variable(model, x) a = 5e-5 b = 3e-3 @constraint(model, c1, x == 0)…

---

## [A problem with SOCP constraint](https://discourse.julialang.org/t/a-problem-with-socp-constraint/79414)

<div class="topic-metadata">

**Author:** [@mahon](https://discourse.julialang.org/u/mahon)\
**Replies:** 4\
**Last updated:** [April 13, 2022, 5:03am UTC](https://discourse.julialang.org/t/a-problem-with-socp-constraint/79414 "2022-04-13T05:03:41Z")

</div>

I want to formulate a SOCP constraint like this using Mosek and my code here all variables are 32 × 24 matrix，but it pulls a error and if i give the concrete row and columns ，it works

---

## [Error Handling in Quote Block using JuMP](https://discourse.julialang.org/t/error-handling-in-quote-block-using-jump/79362)

<div class="topic-metadata">

**Author:** [@hdavid16](https://discourse.julialang.org/u/hdavid16)\
**Replies:** 10\
**Last updated:** [April 13, 2022, 4:44am UTC](https://discourse.julialang.org/t/error-handling-in-quote-block-using-jump/79362 "2022-04-13T04:44:03Z")

</div>

I am puzzled by the following: using JuMP m = Model() @variable(m,x) code = quote try 1 catch e @NLconstraint($m, 0 .\<= exp($x)) end end eval(code) ERROR: At REPL\[240\]:5: \`@NLconstraint(Fe…

---

## [Indexing on Vectorized Constraints in JuMP](https://discourse.julialang.org/t/indexing-on-vectorized-constraints-in-jump/79382)

<div class="topic-metadata">

**Author:** [@hdavid16](https://discourse.julialang.org/u/hdavid16)\
**Replies:** 4\
**Last updated:** [April 12, 2022, 11:46pm UTC](https://discourse.julialang.org/t/indexing-on-vectorized-constraints-in-jump/79382 "2022-04-12T23:46:21Z")

</div>

I was looking at the example for vectorized constraints in the docs (Constraints · JuMP), which creates the constraint: @constraint(model, con, A \* x .== b) 2-element Vector{ConstraintRef{Model, MathOptInterface.Constr…

---

## [Getting constraint matrix from gurobi](https://discourse.julialang.org/t/getting-constraint-matrix-from-gurobi/79107)

<div class="topic-metadata">

**Author:** [@shsh](https://discourse.julialang.org/u/shsh)\
**Replies:** 5\
**Last updated:** [April 12, 2022, 7:58pm UTC](https://discourse.julialang.org/t/getting-constraint-matrix-from-gurobi/79107 "2022-04-12T19:58:41Z")

</div>

Is there an easy way to obtain the current constraint matrix from gurobi (or the original constraint matrix and inverse of the basis matrix) using MathOptInterface. I have been searching google and only found how to do …

---

## [How to use string in @nlexpression](https://discourse.julialang.org/t/how-to-use-string-in-nlexpression/79374)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 1\
**Last updated:** [April 12, 2022, 6:47pm UTC](https://discourse.julialang.org/t/how-to-use-string-in-nlexpression/79374 "2022-04-12T18:47:59Z")

</div>

Hi All, i want to create @NL expreesion on fly in JuMP. I am getting the below error. model = Model() @variable(model, x\[1:3\]) @constraint(model, c2, x\[1\] + 2 \* x\[3\] \>= 2) @constraint(model, c4, 4 \<= 2 \* x\[2\] \<= 5) …

---

## [Struggling to get scipy.newton performance using NonlinearSolve.jl](https://discourse.julialang.org/t/struggling-to-get-scipy-newton-performance-using-nonlinearsolve-jl/79369)

<div class="topic-metadata">

**Author:** [@deserted\_eagle](https://discourse.julialang.org/u/deserted_eagle)\
**Replies:** 4\
**Last updated:** [April 12, 2022, 3:06pm UTC](https://discourse.julialang.org/t/struggling-to-get-scipy-newton-performance-using-nonlinearsolve-jl/79369 "2022-04-12T15:06:38Z")

</div>

Hi everyone! I’m relatively new to Julia (1.7.2), coming from a Matlab and Python background. I really enjoy the language, but I also struggle sometimes in cases where in Matlab / numpy I would simply use vectorization a…

---

## [Using juniper with ipopt and cbc in julia.1.6](https://discourse.julialang.org/t/using-juniper-with-ipopt-and-cbc-in-julia-1-6/78394)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 2\
**Last updated:** [April 12, 2022, 1:20pm UTC](https://discourse.julialang.org/t/using-juniper-with-ipopt-and-cbc-in-julia-1-6/78394 "2022-04-12T13:20:43Z")

</div>

Subject to maximumqty == 111371.4 x\[1,1,1,1,1\] + x\[2,1,1,1,1\] + x\[3,1,1,1,1\] + x\[4,1,1,1,1\] + x\[5,1,1,1,1\] + x\[1,1,1,1,2\] + x\[2,1,1,1,2\] + x\[3,1,1,1,2\] + x\[4,1,1,1,2\] + x\[5,1,1,1,2\] - MaxWt == 0.0 x\[1,1,1,1,1\] - 56014…

---

## [Suggestions on model and solvers](https://discourse.julialang.org/t/suggestions-on-model-and-solvers/79345)

<div class="topic-metadata">

**Author:** [@Patrik\_Waldmann](https://discourse.julialang.org/u/Patrik_Waldmann)\
**Replies:** 3\
**Last updated:** [April 12, 2022, 4:47am UTC](https://discourse.julialang.org/t/suggestions-on-model-and-solvers/79345 "2022-04-12T04:47:36Z")

</div>

I would be happy for suggestions on how and where to implement the model for the data below (the plan is to extend to a much larger data set later so speed is of interest): #Toy data A = \[1.0000 0 0.5000 0.5000 0.4714 0…

---

## [Setting nonlinear objectives with JuMP](https://discourse.julialang.org/t/setting-nonlinear-objectives-with-jump/79343)

<div class="topic-metadata">

**Author:** [@Hans\_W\_Borchers](https://discourse.julialang.org/u/Hans_W_Borchers)\
**Replies:** 4\
**Last updated:** [April 11, 2022, 7:59pm UTC](https://discourse.julialang.org/t/setting-nonlinear-objectives-with-jump/79343 "2022-04-11T19:59:18Z")

</div>

Dear All, one year ago I have written a small note on how to use Julia from R through the ‘JuliaCall’ package. I wanted to update this page and encountered some problems with Julia’s JuMP package. See Notes on JuliaCall…

---

## [JuMP docs on SDP replace \`logdet\` with \`tr\`—is this correct?](https://discourse.julialang.org/t/jump-docs-on-sdp-replace-logdet-with-tr-is-this-correct/79324)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 4\
**Last updated:** [April 11, 2022, 6:28am UTC](https://discourse.julialang.org/t/jump-docs-on-sdp-replace-logdet-with-tr-is-this-correct/79324 "2022-04-11T06:28:49Z")

</div>

The JuMP documentation gives, as an example of a semidefinite program, the problem of finding the minimum-volume ellipse that contains a given list of ellipses centered at the origin: minimize trace(WX) subject to X…

---

## [StochasticPrograms.jl - DIfficulties with vector @uncertain inputs](https://discourse.julialang.org/t/stochasticprograms-jl-difficulties-with-vector-uncertain-inputs/45957)

<div class="topic-metadata">

**Author:** [@elalaouifaris](https://discourse.julialang.org/u/elalaouifaris)\
**Replies:** 10\
**Last updated:** [April 10, 2022, 4:43pm UTC](https://discourse.julialang.org/t/stochasticprograms-jl-difficulties-with-vector-uncertain-inputs/45957 "2022-04-10T16:43:36Z")

</div>

Hi, I’m testing the StochasticPrograms.jl package (Awesome work by the way!) on a simple renewables energy sizing use case. I have difficulty figuring out how to use uncertain parameters in the 2nd stage with array inpu…

---

## [Using spectral methods and optimization to find period of a set of nonlinear autonomous differential equations](https://discourse.julialang.org/t/using-spectral-methods-and-optimization-to-find-period-of-a-set-of-nonlinear-autonomous-differential-equations/79293)

<div class="topic-metadata">

**Author:** [@Gummala\_Navneeth](https://discourse.julialang.org/u/Gummala_Navneeth)\
**Replies:** 0\
**Last updated:** [April 10, 2022, 10:48am UTC](https://discourse.julialang.org/t/using-spectral-methods-and-optimization-to-find-period-of-a-set-of-nonlinear-autonomous-differential-equations/79293 "2022-04-10T10:48:07Z")

</div>

hi all, I’m very new to Julia. I’m following these lectures to solve optimization problem. I will be providing a toy problem (2 DoF) which mimics my actual problem (12 DoF). I have a set of nonlinear non-autonomous dif…

---

## [Callback jump MOI interface lazy constraints are not cutting the solution properly](https://discourse.julialang.org/t/callback-jump-moi-interface-lazy-constraints-are-not-cutting-the-solution-properly/79227)

<div class="topic-metadata">

**Author:** [@afazevedo](https://discourse.julialang.org/u/afazevedo)\
**Replies:** 1\
**Last updated:** [April 8, 2022, 10:50pm UTC](https://discourse.julialang.org/t/callback-jump-moi-interface-lazy-constraints-are-not-cutting-the-solution-properly/79227 "2022-04-08T22:50:50Z")

</div>

Hey there, can anyone please help me? I am trying to solve a combinatorial optimization problem through lazy constraints using Gurobi as Solver. Bellow a code of my presets and variables: model = Model(Gurobi.Optimizer…

---

## [How do I write @variable(z=x\[1\]+x\[2\])?](https://discourse.julialang.org/t/how-do-i-write-variable-z-x-1-x-2/79149)

<div class="topic-metadata">

**Author:** [@castlemas](https://discourse.julialang.org/u/castlemas)\
**Replies:** 5\
**Last updated:** [April 7, 2022, 9:32pm UTC](https://discourse.julialang.org/t/how-do-i-write-variable-z-x-1-x-2/79149 "2022-04-07T21:32:38Z")

</div>

Hi, I am trying to solve a min-max optimisation problem that requires me to add in a constraint How do I assign a constraint such that a variable equals to another variable?

---

## [Gurobi 9.5 MemLimit usage](https://discourse.julialang.org/t/gurobi-9-5-memlimit-usage/79045)

<div class="topic-metadata">

**Author:** [@max](https://discourse.julialang.org/u/max)\
**Replies:** 6\
**Last updated:** [April 7, 2022, 8:31pm UTC](https://discourse.julialang.org/t/gurobi-9-5-memlimit-usage/79045 "2022-04-07T20:31:03Z")

</div>

Hello everyone, i am struggeling with the usage of the MemLimit (https://www.gurobi.com/documentation/9.5/refman/memlimit.html) option which was newly introduced in Gurobi 9.5. Gurobi should throw an error when exceedi…

---

## [Optimization Technique in JuMP model](https://discourse.julialang.org/t/optimization-technique-in-jump-model/79108)

<div class="topic-metadata">

**Author:** [@iAnkiit](https://discourse.julialang.org/u/iAnkiit)\
**Replies:** 1\
**Last updated:** [April 6, 2022, 4:57pm UTC](https://discourse.julialang.org/t/optimization-technique-in-jump-model/79108 "2022-04-06T16:57:55Z")

</div>

Could someone please tell , which optimization technique /algorithm JuMP model uses ? like, when we perform : “optimize! (model)” ? Or, is it completely solver dependent ?

---

## [JuMP/MOI performance overhead vs XPress api](https://discourse.julialang.org/t/jump-moi-performance-overhead-vs-xpress-api/78994)

<div class="topic-metadata">

**Author:** [@Marie](https://discourse.julialang.org/u/Marie)\
**Replies:** 12\
**Last updated:** [April 6, 2022, 9:17am UTC](https://discourse.julialang.org/t/jump-moi-performance-overhead-vs-xpress-api/78994 "2022-04-06T09:17:47Z")

</div>

Solving exactly same lp problem using XPress api is way faster than using JuMP/MOI: 2 ses vs 9 secs for a simple case; then 452 secs vs 1796 for more complex case. Is this overhead a known issue? Is there a way to optimi…

---

## [A piece-wise defined objective function can be solved by Gurobi?](https://discourse.julialang.org/t/a-piece-wise-defined-objective-function-can-be-solved-by-gurobi/78959)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 7\
**Last updated:** [April 4, 2022, 7:44am UTC](https://discourse.julialang.org/t/a-piece-wise-defined-objective-function-can-be-solved-by-gurobi/78959 "2022-04-04T07:44:04Z")

</div>

Hi, I have an optimization with a piece-wise defined objective as follows: using JuMP, Ipopt using Gurobi T\_fc = \[0, 185, 348, 515, 658, 830\] R\_fc = \[0.1803, 0.1978, 0.2033, 0.2092, 0.2157, 0.2254\] const R0 = R\_fc\[1\] …

---

## [JuMP--how to take the gradient of quadratic constraints?](https://discourse.julialang.org/t/jump-how-to-take-the-gradient-of-quadratic-constraints/78893)

<div class="topic-metadata">

**Author:** [@rjuly](https://discourse.julialang.org/u/rjuly)\
**Replies:** 2\
**Last updated:** [April 2, 2022, 2:45pm UTC](https://discourse.julialang.org/t/jump-how-to-take-the-gradient-of-quadratic-constraints/78893 "2022-04-02T14:45:37Z")

</div>

I need to get the constraint Jacobian for a model which contains linear, quadratic, and nonlinear constraints. For the nonlinear constraints, I can use the NLPEvaluator with function eval\_constraint\_jacobian. For the lin…

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

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