# Optimization (Mathematical)

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

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

**Page:** 76

---

## [Specifying datatype in JuMP expressions and constraints to save memory](https://discourse.julialang.org/t/specifying-datatype-in-jump-expressions-and-constraints-to-save-memory/66515)

<div class="topic-metadata">

**Author:** [@anon94806364](https://discourse.julialang.org/u/anon94806364)\
**Replies:** 14\
**Last updated:** [August 26, 2021, 1:43pm UTC](https://discourse.julialang.org/t/specifying-datatype-in-jump-expressions-and-constraints-to-save-memory/66515 "2021-08-26T13:43:07Z")

</div>

I am solving for an ILP that, despite my best efforts to downsize (ie. use sparse matrices), is taking ~ 100 GB RAM. In my model, I have expressions that are the sum of binary variables \* integer variables. Perhaps mist…

---

## [Error when calling 'using Cbc'](https://discourse.julialang.org/t/error-when-calling-using-cbc/67014)

<div class="topic-metadata">

**Author:** [@Kreiton\_Sitorus](https://discourse.julialang.org/u/Kreiton_Sitorus)\
**Replies:** 10\
**Last updated:** [August 26, 2021, 12:43pm UTC](https://discourse.julialang.org/t/error-when-calling-using-cbc/67014 "2021-08-26T12:43:28Z")

</div>

Hello, I think I need help. I’m trying to use Cbc. I’ve called the Pkg.add(“Cbc”) and it installs it as usual. But, when I called using Cbc this error message pops out: julia\> using Cbc \[ Info: Precompiling Cbc \[9961bab…

---

## [How to use functions in jump's target functions](https://discourse.julialang.org/t/how-to-use-functions-in-jumps-target-functions/67019)

<div class="topic-metadata">

**Author:** [@zhangsanle](https://discourse.julialang.org/u/zhangsanle)\
**Replies:** 1\
**Last updated:** [August 26, 2021, 8:17am UTC](https://discourse.julialang.org/t/how-to-use-functions-in-jumps-target-functions/67019 "2021-08-26T08:17:05Z")

</div>

I want to know why there was an error running the following program. I need to change the parameters wx and wy of tt several times, so I want to use them directly in the target function Incorrect number of arguments for…

---

## [Best way to define and re-use multiple JuMP nonlinear models](https://discourse.julialang.org/t/best-way-to-define-and-re-use-multiple-jump-nonlinear-models/66840)

<div class="topic-metadata">

**Author:** [@dmetivie](https://discourse.julialang.org/u/dmetivie)\
**Replies:** 3\
**Last updated:** [August 25, 2021, 8:18pm UTC](https://discourse.julialang.org/t/best-way-to-define-and-re-use-multiple-jump-nonlinear-models/66840 "2021-08-25T20:18:51Z")

</div>

I have a for loop where at each iteration I am solving multiple version of a similar nonlinear problem with some parameter update. I tried 3 ways to define the base(s) model I call at each iteration + update the paramet…

---

## [Non-linear gradient descent under linear constraints?](https://discourse.julialang.org/t/non-linear-gradient-descent-under-linear-constraints/66965)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 9\
**Last updated:** [August 25, 2021, 1:46pm UTC](https://discourse.julialang.org/t/non-linear-gradient-descent-under-linear-constraints/66965 "2021-08-25T13:46:19Z")

</div>

Hey, Is there a pure julia implementation of a non-linear gradient descent under linear matrix/vector equality and inequality constraints ? My problem is given as : \\min\\limits\_{Ax=b,\\, x\\ge 0}\\, f(x) where f is non-…

---

## [Gradient not zero when optimizing function](https://discourse.julialang.org/t/gradient-not-zero-when-optimizing-function/66972)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 0\
**Last updated:** [August 25, 2021, 11:34am UTC](https://discourse.julialang.org/t/gradient-not-zero-when-optimizing-function/66972 "2021-08-25T11:34:47Z")

</div>

I am optimizing a function. The algorithm finds a solution, but the gradient at the solution is not close to zero. What can be done in that case? sol3 = optimize(θ -\> -obj(θ), sol1.minimizer, NewtonTrustRegion(), …

---

## [Unpacking Matrix Columns as Vector Arguments](https://discourse.julialang.org/t/unpacking-matrix-columns-as-vector-arguments/66897)

<div class="topic-metadata">

**Author:** [@danphenderson](https://discourse.julialang.org/u/danphenderson)\
**Replies:** 3\
**Last updated:** [August 24, 2021, 5:45pm UTC](https://discourse.julialang.org/t/unpacking-matrix-columns-as-vector-arguments/66897 "2021-08-24T17:45:04Z")

</div>

I am trying to unpack the columns of a matrix S into the ForwardDiff.Dual{T} constructor. I have tried numerous different approaches without success. Specifically, I want a function that does the following: function gA…

---

## [JuMP error constraint forming KeyError:](https://discourse.julialang.org/t/jump-error-constraint-forming-keyerror/66905)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 2\
**Last updated:** [August 24, 2021, 1:18pm UTC](https://discourse.julialang.org/t/jump-error-constraint-forming-keyerror/66905 "2021-08-24T13:18:26Z")

</div>

Hi, I wanted to implement the attached constraint with below code but getting error const Gurobix = optimizer\_with\_attributes(Gurobi.Optimizer,"MIPGap"=\>0.0005) #"TimeLimit"=\>1000 mod2 = Model(Gurobix) Lf\_p= \[18 17 3…

---

## [Manage output report from optimization](https://discourse.julialang.org/t/manage-output-report-from-optimization/66881)

<div class="topic-metadata">

**Author:** [@Daniel\_Villamar](https://discourse.julialang.org/u/Daniel_Villamar)\
**Replies:** 2\
**Last updated:** [August 24, 2021, 1:13pm UTC](https://discourse.julialang.org/t/manage-output-report-from-optimization/66881 "2021-08-24T13:13:16Z")

</div>

I am using Jump to solve an optimisation. The solving process stops because it does not find a feasible solution. I am in the early stages of debugging my program. I use the println(model) function to display the variab…

---

## [Optimization of a decision vector of arbitrary dimension](https://discourse.julialang.org/t/optimization-of-a-decision-vector-of-arbitrary-dimension/66846)

<div class="topic-metadata">

**Author:** [@etas](https://discourse.julialang.org/u/etas)\
**Replies:** 3\
**Last updated:** [August 24, 2021, 7:31am UTC](https://discourse.julialang.org/t/optimization-of-a-decision-vector-of-arbitrary-dimension/66846 "2021-08-24T07:31:46Z")

</div>

Hi, For an optimization problem having time dependent variables (i.e. large vectors), I’m trying to define the problem like below, with variables constrained by vectors, and optimize one variable. using JuMP using CPLE…

---

## [Mosek Error upon using Powermodels.jl](https://discourse.julialang.org/t/mosek-error-upon-using-powermodels-jl/66856)

<div class="topic-metadata">

**Author:** [@aaldik](https://discourse.julialang.org/u/aaldik)\
**Replies:** 1\
**Last updated:** [August 23, 2021, 9:24pm UTC](https://discourse.julialang.org/t/mosek-error-upon-using-powermodels-jl/66856 "2021-08-23T21:24:19Z")

</div>

Hello I’m trying to use the solver Mosek to solve a SDP problem via the “Powermodels.jl” library. My code is very simple: using powermodels using MosekTools solver4 = Mosek.Optimizer; SDP\_relax=run\_opf(“pglib\_opf\_ca…

---

## [JuMP-dev 2021: that's a wrap](https://discourse.julialang.org/t/jump-dev-2021-thats-a-wrap/65584)

<div class="topic-metadata">

**Author:** [@odow](https://discourse.julialang.org/u/odow)\
**Replies:** 1\
**Last updated:** [August 23, 2021, 9:50am UTC](https://discourse.julialang.org/t/jump-dev-2021-thats-a-wrap/65584 "2021-08-23T09:50:11Z")

</div>

Dear all, That’s a wrap for JuMP-dev 2021! I want to start by thanking the JuliaCon organizing committee for helping us co-locate JuMP-dev at JuliaCon. They went over and beyond to accommodate us and make the interacti…

---

## [Experiences using JuMP with Gurobi cloud](https://discourse.julialang.org/t/experiences-using-jump-with-gurobi-cloud/66732)

<div class="topic-metadata">

**Author:** [@Akatz](https://discourse.julialang.org/u/Akatz)\
**Replies:** 1\
**Last updated:** [August 20, 2021, 8:19pm UTC](https://discourse.julialang.org/t/experiences-using-jump-with-gurobi-cloud/66732 "2021-08-20T20:19:51Z")

</div>

Hi, Anyone have experience or feedback on using JuMP with gurobi instant cloud?

---

## [Operations on NonlinearExpressions](https://discourse.julialang.org/t/operations-on-nonlinearexpressions/66453)

<div class="topic-metadata">

**Author:** [@tonygem96](https://discourse.julialang.org/u/tonygem96)\
**Replies:** 3\
**Last updated:** [August 19, 2021, 9:22pm UTC](https://discourse.julialang.org/t/operations-on-nonlinearexpressions/66453 "2021-08-19T21:22:29Z")

</div>

I am building a user defined function to be optimized in an NLP problem. However NLexpressions cannot be operated on without the @NLexpression macro (eg added, subtracted etc). Is there something wrong with lets say exte…

---

## [How to model two exponential cones \>= a specific value with JuMP?](https://discourse.julialang.org/t/how-to-model-two-exponential-cones-a-specific-value-with-jump/66589)

<div class="topic-metadata">

**Author:** [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Replies:** 1\
**Last updated:** [August 18, 2021, 12:31pm UTC](https://discourse.julialang.org/t/how-to-model-two-exponential-cones-a-specific-value-with-jump/66589 "2021-08-18T12:31:02Z")

</div>

The model is as follow: obj: min aexp(b)+cexp(d) subject to: 1\<=a\<=2 1\<=b\<=2 0.5\<=c\<=2 0.5\<=d\<=2 aexp(b)+cexp(d)\>=0.5 I see the exponential cones in Jump’s example is smaller than one specific value. Is there a…

---

## [Solving Fixed-MILP Problem](https://discourse.julialang.org/t/solving-fixed-milp-problem/51749)

<div class="topic-metadata">

**Author:** [@Deepedit](https://discourse.julialang.org/u/Deepedit)\
**Replies:** 12\
**Last updated:** [August 18, 2021, 2:44am UTC](https://discourse.julialang.org/t/solving-fixed-milp-problem/51749 "2021-08-18T02:44:54Z")

</div>

Hello to all. I’m trying to solve some generation schedule problem and we need access to the dual variables for pricing. The problem is MILP and, since the dual variables are no available, we used some suggestion to fix …

---

## [Cannot set the starting point for LP](https://discourse.julialang.org/t/cannot-set-the-starting-point-for-lp/66531)

<div class="topic-metadata">

**Author:** [@Aida\_Khajavirad](https://discourse.julialang.org/u/Aida_Khajavirad)\
**Replies:** 9\
**Last updated:** [August 17, 2021, 9:53pm UTC](https://discourse.julialang.org/t/cannot-set-the-starting-point-for-lp/66531 "2021-08-17T21:53:19Z")

</div>

Hello, I m trying to solve an LP where my variable has the following form @variable(model, x\[i=1:N-1, j=i+1:N, k=1:d, l=1:d\] \>= 0) I ve been struggling to set a starting point, I tried set\_start\_value but i get error…

---

## [MethodError: no method matching in JuMP](https://discourse.julialang.org/t/methoderror-no-method-matching-in-jump/66543)

<div class="topic-metadata">

**Author:** [@zhangsanle](https://discourse.julialang.org/u/zhangsanle)\
**Replies:** 1\
**Last updated:** [August 17, 2021, 8:09pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-in-jump/66543 "2021-08-17T20:09:34Z")

</div>

I am new in julia. When i use JuMP, i meet some problems: MethodError: no method matching (::Interpolations.Extrapolation{Float64, 1, ScaledInterpolation{Float64, 1, Interpolations.BSplineInterpolation{Float64, 1, Vector…

---

## [Gradient of expression with JuMP variables](https://discourse.julialang.org/t/gradient-of-expression-with-jump-variables/66259)

<div class="topic-metadata">

**Author:** [@ver\_kh](https://discourse.julialang.org/u/ver_kh)\
**Replies:** 3\
**Last updated:** [August 13, 2021, 7:16am UTC](https://discourse.julialang.org/t/gradient-of-expression-with-jump-variables/66259 "2021-08-13T07:16:53Z")

</div>

Hi! I have a complex nonlinear expression built with JuMP variables. And now I want to find gradient of this expression with respect to these variables. What package will be helpful in this situation?

---

## [Equating two symbolically symmetric matrices in JuMP without redundant constraints](https://discourse.julialang.org/t/equating-two-symbolically-symmetric-matrices-in-jump-without-redundant-constraints/66274)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 2\
**Last updated:** [August 12, 2021, 3:14pm UTC](https://discourse.julialang.org/t/equating-two-symbolically-symmetric-matrices-in-jump-without-redundant-constraints/66274 "2021-08-12T15:14:06Z")

</div>

Dear All, I am trying to define a constraint to equate two symbolically symmetric matrices and I am wondering if there is a compact way so that JuMP does not store redundant constraints. A simple example is as follows u…

---

## [Query optimizer support for indicator constraints](https://discourse.julialang.org/t/query-optimizer-support-for-indicator-constraints/66244)

<div class="topic-metadata">

**Author:** [@SupplyChef](https://discourse.julialang.org/u/SupplyChef)\
**Replies:** 1\
**Last updated:** [August 12, 2021, 3:39am UTC](https://discourse.julialang.org/t/query-optimizer-support-for-indicator-constraints/66244 "2021-08-12T03:39:30Z")

</div>

Hello, Is there a way to query if a solver supports indicator constraints? I’d like to write a function that produces a model that uses indicator constraints if they are supported and reverts to a big-M constraints if n…

---

## [Creating an array of symmetric matrix variables in \`JuMP\`](https://discourse.julialang.org/t/creating-an-array-of-symmetric-matrix-variables-in-jump/66229)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 2\
**Last updated:** [August 11, 2021, 9:13pm UTC](https://discourse.julialang.org/t/creating-an-array-of-symmetric-matrix-variables-in-jump/66229 "2021-08-11T21:13:23Z")

</div>

Dear All, I am trying to create an array of symmetric matrix variables in JuMP, i.e., an array of matrix variables X\_i\\in\\mathbf{S}^n for i\\in\\{1,2,\\ldots,N\\}. If I had only one symmetric matrix variable X\\in\\mathbf{S}^…

---

## [Automatic differentiation of \`cispi\`](https://discourse.julialang.org/t/automatic-differentiation-of-cispi/66075)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 4\
**Last updated:** [August 11, 2021, 3:43pm UTC](https://discourse.julialang.org/t/automatic-differentiation-of-cispi/66075 "2021-08-11T15:43:20Z")

</div>

I think the rrule for cispi seems to be missing. Maybe it should be included in the basic set of rules? function loss2(data) sum(abs.(cispi.(data))) end data = ones(2,2) loss2(data) gradient(loss2, data) yields: j…

---

## [Regular JuMP-NLP developer call](https://discourse.julialang.org/t/regular-jump-nlp-developer-call/65797)

<div class="topic-metadata">

**Author:** [@frapac](https://discourse.julialang.org/u/frapac)\
**Replies:** 1\
**Last updated:** [August 10, 2021, 7:37am UTC](https://discourse.julialang.org/t/regular-jump-nlp-developer-call/65797 "2021-08-10T07:37:13Z")

</div>

Hi everyone! Last week at JuMP-dev, we agreed on organizing a regular meeting to discuss the future of nonlinear programming in Julia/JuMP. As a follow-up, I would suggest to organize our first meeting by the end of Au…

---

## [LoadError: UndefVarError: @defVar not defined](https://discourse.julialang.org/t/loaderror-undefvarerror-defvar-not-defined/66022)

<div class="topic-metadata">

**Author:** [@zhangsanle](https://discourse.julialang.org/u/zhangsanle)\
**Replies:** 4\
**Last updated:** [August 9, 2021, 10:50am UTC](https://discourse.julialang.org/t/loaderror-undefvarerror-defvar-not-defined/66022 "2021-08-09T10:50:21Z")

</div>

I have a piece of code about JuMP. When I run it ,it says that LoadError: UndefVarError: @defVar not defined. I have tried using global forward or backward but both fails. See: function T1(w\_func,grid\_b,β,u,z) …

---

## [Error (optimize! not defined) using JuMP optimizing routines](https://discourse.julialang.org/t/error-optimize-not-defined-using-jump-optimizing-routines/65975)

<div class="topic-metadata">

**Author:** [@Peter-Jolly](https://discourse.julialang.org/u/Peter-Jolly)\
**Replies:** 2\
**Last updated:** [August 8, 2021, 4:30am UTC](https://discourse.julialang.org/t/error-optimize-not-defined-using-jump-optimizing-routines/65975 "2021-08-08T04:30:11Z")

</div>

Hi, I am trying out the examples in Julia documentation concerning JuMP. I get the same error no matter whether I use the linear or non linear examples(below is the linear example taken from the documentation: The error…

---

## [Debugging NLopt :FORCED\_STOP](https://discourse.julialang.org/t/debugging-nlopt-forced-stop/65840)

<div class="topic-metadata">

**Author:** [@cricci](https://discourse.julialang.org/u/cricci)\
**Replies:** 6\
**Last updated:** [August 5, 2021, 5:39pm UTC](https://discourse.julialang.org/t/debugging-nlopt-forced-stop/65840 "2021-08-05T17:39:06Z")

</div>

Hello, I have some issue when using NLopt.jl to perform constrained minimization. I have a function that I am trying to maximize, whose value depend from the solution of a system of ODE. However the optimizer suddenly t…

---

## [(Jump, Gurobi)Binary Variables end up with values no equal 1 or 0](https://discourse.julialang.org/t/jump-gurobi-binary-variables-end-up-with-values-no-equal-1-or-0/65610)

<div class="topic-metadata">

**Author:** [@Hirnfolter](https://discourse.julialang.org/u/Hirnfolter)\
**Replies:** 8\
**Last updated:** [August 5, 2021, 3:01pm UTC](https://discourse.julialang.org/t/jump-gurobi-binary-variables-end-up-with-values-no-equal-1-or-0/65610 "2021-08-05T15:01:44Z")

</div>

Hello, i try to opimise something and have the variable @variable(m, Taskstartstation\[1:Stationnumber, 1:Ordernumber, 1:Tasknumbertotal\], binary=true); or @variable(m, Taskstartstation\[1:Stationnumber, 1:Ordernum…

---

## [Linear Matrix Inequality](https://discourse.julialang.org/t/linear-matrix-inequality/65814)

<div class="topic-metadata">

**Author:** [@jeanluc](https://discourse.julialang.org/u/jeanluc)\
**Replies:** 11\
**Last updated:** [August 5, 2021, 11:32am UTC](https://discourse.julialang.org/t/linear-matrix-inequality/65814 "2021-08-05T11:32:12Z")

</div>

Hello everyone! Here is a code I have tried to solve an LMI But it failed. How can I fix it? Will this code give the solution? using Convex using SCS using LinearAlgebra n = 2 P = Semidefinite(n) Z12=zeros(Int8, 2, 2…

---

## [Solving JuMP model async with HTTP routing doesn't work](https://discourse.julialang.org/t/solving-jump-model-async-with-http-routing-doesnt-work/65854)

<div class="topic-metadata">

**Author:** [@obar](https://discourse.julialang.org/u/obar)\
**Replies:** 3\
**Last updated:** [August 5, 2021, 5:57am UTC](https://discourse.julialang.org/t/solving-jump-model-async-with-http-routing-doesnt-work/65854 "2021-08-05T05:57:38Z")

</div>

I’m in the process of building a web server that solves a mixed-integer program. The solve is triggered when the user hits a specific url. Because the MIP solve takes a while to complete, this causes a timeout in the HTT…

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

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