# Optimization (Mathematical)

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

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

**Page:** 84

---

## [JuMP/CPLEX: how to set heuristic solution using SparseAxisArrays in callback](https://discourse.julialang.org/t/jump-cplex-how-to-set-heuristic-solution-using-sparseaxisarrays-in-callback/56938)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 2\
**Last updated:** [March 12, 2021, 9:04am UTC](https://discourse.julialang.org/t/jump-cplex-how-to-set-heuristic-solution-using-sparseaxisarrays-in-callback/56938 "2021-03-12T09:04:43Z")

</div>

Dear folks, unfortunately I fail to submit a heuristic solution using SparseAxisArrays in a callback. Here is an MWE: using JuMP, CPLEX model = JuMP.direct\_model( CPLEX.Optimizer() ) set\_optimizer\_attribute( model, "C…

---

## [Warning invalid warm start GLPK](https://discourse.julialang.org/t/warning-invalid-warm-start-glpk/46441)

<div class="topic-metadata">

**Author:** [@ErwanPiR](https://discourse.julialang.org/u/ErwanPiR)\
**Replies:** 3\
**Last updated:** [March 11, 2021, 2:20am UTC](https://discourse.julialang.org/t/warning-invalid-warm-start-glpk/46441 "2021-03-11T02:20:50Z")

</div>

Hi, I see some topics dated from 2019 talking about the warm start in JuMP with GLPK. I still have the warning : Warning: MathOptInterface.VariablePrimalStart() is not supported by MathOptInterface.Bridges.LazyBridgeOp…

---

## [In JuMP, how to access a named constraint created inside a function](https://discourse.julialang.org/t/in-jump-how-to-access-a-named-constraint-created-inside-a-function/56912)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 2\
**Last updated:** [March 10, 2021, 10:54pm UTC](https://discourse.julialang.org/t/in-jump-how-to-access-a-named-constraint-created-inside-a-function/56912 "2021-03-10T22:54:02Z")

</div>

I would like to delete a constraint created inside a function. For example, function mymodel(a) m = Model() @variable(model, w\[1:n\] \>= 0) @constraint(model, budget, sum(w) == a) ... return m end …

---

## [Question about write.to.file with .lp (JuMP context)](https://discourse.julialang.org/t/question-about-write-to-file-with-lp-jump-context/56892)

<div class="topic-metadata">

**Author:** [@felcbd](https://discourse.julialang.org/u/felcbd)\
**Replies:** 1\
**Last updated:** [March 10, 2021, 7:40pm UTC](https://discourse.julialang.org/t/question-about-write-to-file-with-lp-jump-context/56892 "2021-03-10T19:40:35Z")

</div>

Hi everyone, I had a question about a practice case I actually have with the write.to.file function. I have my model writed with JuMP and I want to solve it with CPLEX directly from my .jl file with !optimize, and I ha…

---

## [ForwardDiff evaluation of objective in Optim returns wrong result (objective uses DifferentialEquations pkg)](https://discourse.julialang.org/t/forwarddiff-evaluation-of-objective-in-optim-returns-wrong-result-objective-uses-differentialequations-pkg/54624)

<div class="topic-metadata">

**Author:** [@moesphere](https://discourse.julialang.org/u/moesphere)\
**Replies:** 7\
**Last updated:** [March 10, 2021, 3:38pm UTC](https://discourse.julialang.org/t/forwarddiff-evaluation-of-objective-in-optim-returns-wrong-result-objective-uses-differentialequations-pkg/54624 "2021-03-10T15:38:52Z")

</div>

I am having a strange problem with ForwardDiff that is internally used in Optim. The minimum returned by Optim is not the same value as the value of the objective function when the minimizer returned by Optim is used, se…

---

## [Please suggest improvements to the JuMP documentation](https://discourse.julialang.org/t/please-suggest-improvements-to-the-jump-documentation/55596)

<div class="topic-metadata">

**Author:** [@odow](https://discourse.julialang.org/u/odow)\
**Replies:** 4\
**Last updated:** [March 9, 2021, 8:26pm UTC](https://discourse.julialang.org/t/please-suggest-improvements-to-the-jump-documentation/55596 "2021-03-09T20:26:37Z")

</div>

Dear all, I have been busy making improvements to the JuMP documentation that will be available in the next release. (You can find the development version here: Introduction · JuMP) Highlights of the changes include int…

---

## [KeyError: key not found](https://discourse.julialang.org/t/keyerror-key-not-found/56813)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 1\
**Last updated:** [March 9, 2021, 5:03pm UTC](https://discourse.julialang.org/t/keyerror-key-not-found/56813 "2021-03-09T17:03:58Z")

</div>

Hello everybody Because when I try to compile this part of the model it returns this error to me: KeyError: key 5 not found using JuMP, GLPK, GLPKMathProgInterface ModelD = Model(GLPK.Optimizer) t = 1:4 w = 1:2 l = …

---

## [JuMP Mosek sparsity scaling](https://discourse.julialang.org/t/jump-mosek-sparsity-scaling/56731)

<div class="topic-metadata">

**Author:** [@Philip\_Olhager](https://discourse.julialang.org/u/Philip_Olhager)\
**Replies:** 6\
**Last updated:** [March 9, 2021, 4:00pm UTC](https://discourse.julialang.org/t/jump-mosek-sparsity-scaling/56731 "2021-03-09T16:00:54Z")

</div>

I’m trying to solve an SDP problem on the form \\begin{align} \\min \\hspace{0.5cm} & c^\\intercal x \\\\ \\text{s.t.} \\hspace{0.5cm} & A\_0 + \\sum A\_i x\_i \\succeq 0 \\end{align} with x being of size ~370 and the A matrices …

---

## [Cannot assign a value to variable workspace](https://discourse.julialang.org/t/cannot-assign-a-value-to-variable-workspace/56613)

<div class="topic-metadata">

**Author:** [@priod](https://discourse.julialang.org/u/priod)\
**Replies:** 1\
**Last updated:** [March 6, 2021, 6:30pm UTC](https://discourse.julialang.org/t/cannot-assign-a-value-to-variable-workspace/56613 "2021-03-06T18:30:49Z")

</div>

I am using Ipopt optimizer in a problem, I have created a variable name inside the model in an array form, for instance, (k,p\[1:2\]), after running the specific cell, it is giving me the error, that cannot assign a value …

---

## [How to solve set of nonlinear fixed-point equations using Anderson acceleration in NLsolve.jl?](https://discourse.julialang.org/t/how-to-solve-set-of-nonlinear-fixed-point-equations-using-anderson-acceleration-in-nlsolve-jl/55994)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 7\
**Last updated:** [March 6, 2021, 1:16pm UTC](https://discourse.julialang.org/t/how-to-solve-set-of-nonlinear-fixed-point-equations-using-anderson-acceleration-in-nlsolve-jl/55994 "2021-03-06T13:16:18Z")

</div>

I have a set of two nonlinear fixed-point equations like x = g1(x, y) y = g2(x, y) where x and y are n-dimensional arrays (n=1,2,3), length(x) and length(y) can be very large, e.g. 128x128x128 for 3D problem. How can I…

---

## [How to set verbose=false for \`Mosek\` in \`Convex.jl\`](https://discourse.julialang.org/t/how-to-set-verbose-false-for-mosek-in-convex-jl/46378)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 4\
**Last updated:** [March 6, 2021, 8:18am UTC](https://discourse.julialang.org/t/how-to-set-verbose-false-for-mosek-in-convex-jl/46378 "2021-03-06T08:18:55Z")

</div>

I’m using Convex.jl to solve convex optimisation problems. In Convex.jl, I can use various solvers, but I cannot make the solver verbose=false only when using Mosek. How can I do this? Here’s an MWE: using Convex usi…

---

## [LP Relaxation in JuMP](https://discourse.julialang.org/t/lp-relaxation-in-jump/56476)

<div class="topic-metadata">

**Author:** [@hdavid16](https://discourse.julialang.org/u/hdavid16)\
**Replies:** 1\
**Last updated:** [March 4, 2021, 4:12pm UTC](https://discourse.julialang.org/t/lp-relaxation-in-jump/56476 "2021-03-04T16:12:01Z")

</div>

What is the best way to get the LP relaxation of a MIP? Should I call relax\_integrality() and optimize, or is there a better way?

---

## [How to deal with the sum of absolute functions in a JuMP model?](https://discourse.julialang.org/t/how-to-deal-with-the-sum-of-absolute-functions-in-a-jump-model/56452)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 3\
**Last updated:** [March 4, 2021, 12:45pm UTC](https://discourse.julialang.org/t/how-to-deal-with-the-sum-of-absolute-functions-in-a-jump-model/56452 "2021-03-04T12:45:49Z")

</div>

I would like to add a constraint that is the sum of absolute values, something like using JuMP model = Model(Ipopt.Optimizer) @variable(model, w\[1:n\] \>=0) ... @constraint(model, sum(abs.(w - p)) \<= alpha) # not possib…

---

## [Setting Time Limits for JuMP (with CBC solver)](https://discourse.julialang.org/t/setting-time-limits-for-jump-with-cbc-solver/56303)

<div class="topic-metadata">

**Author:** [@acwkim](https://discourse.julialang.org/u/acwkim)\
**Replies:** 6\
**Last updated:** [March 3, 2021, 3:05am UTC](https://discourse.julialang.org/t/setting-time-limits-for-jump-with-cbc-solver/56303 "2021-03-03T03:05:19Z")

</div>

Hi all. Is there a way to set time limit for JuMP models using CBC solver? The “seconds” parameter only limits CPU seconds, which is different from Wallclock seconds. I need to set a limit for Wallclock second! Thanks …

---

## [How to access CPLEX.CplexError in JuMP 0.18?](https://discourse.julialang.org/t/how-to-access-cplex-cplexerror-in-jump-0-18/22598)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 5\
**Last updated:** [March 2, 2021, 8:18pm UTC](https://discourse.julialang.org/t/how-to-access-cplex-cplexerror-in-jump-0-18/22598 "2021-03-02T20:18:27Z")

</div>

Dear community, I always start cplex like for instance: try status = solve(model) println("status: ", status) println("obj\_val: ", getobjectivevalue(model)) catch msg println("ERROR SOLVING MODEL: ", ms…

---

## [How to write a sum constraint in JuMP with condition](https://discourse.julialang.org/t/how-to-write-a-sum-constraint-in-jump-with-condition/56269)

<div class="topic-metadata">

**Author:** [@GraceMabele](https://discourse.julialang.org/u/GraceMabele)\
**Replies:** 4\
**Last updated:** [March 1, 2021, 8:30pm UTC](https://discourse.julialang.org/t/how-to-write-a-sum-constraint-in-jump-with-condition/56269 "2021-03-01T20:30:11Z")

</div>

Hi, I am having trouble writing the following constraint in JuMP I currently have it written as below but it is not returning the desired output. @constraints model begin constraint\_1\[n in n\], sum(w\[i,n,n…

---

## [SOCP constraint](https://discourse.julialang.org/t/socp-constraint/56234)

<div class="topic-metadata">

**Author:** [@SonLe](https://discourse.julialang.org/u/SonLe)\
**Replies:** 3\
**Last updated:** [March 1, 2021, 6:25pm UTC](https://discourse.julialang.org/t/socp-constraint/56234 "2021-03-01T18:25:14Z")

</div>

Hi, I have a question about verifying the SOCP constraint in JuMP. So far, my SOCP constraint is \\epsilon t \\geq \\theta\\|\\mathbf{x}\\|\_{2}+\\frac{1}{N} \\sum\_{i \\in\[N\]} r^{i} and my code is @constraint(model, \[ϵ \* t \* (1…

---

## [MethodError: no method matching getindex(::VariableRef, ::Int64)](https://discourse.julialang.org/t/methoderror-no-method-matching-getindex-variableref-int64/56252)

<div class="topic-metadata">

**Author:** [@Kavitha](https://discourse.julialang.org/u/Kavitha)\
**Replies:** 4\
**Last updated:** [March 1, 2021, 5:55pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-getindex-variableref-int64/56252 "2021-03-01T17:55:33Z")

</div>

Hi, I’m using JuMP to solve my optimization problem. Following is a part of the formulation and its causing the methoderror. for t in 1:tp for j in 1:nt c10= @constraint(p, LT\[j\]\[t\] - (l\[j\] \* Z\[j\]\[t\]) == 0) set\_nam…

---

## [How to plot Newton's method](https://discourse.julialang.org/t/how-to-plot-newtons-method/51160)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 45\
**Last updated:** [February 23, 2021, 3:29am UTC](https://discourse.julialang.org/t/how-to-plot-newtons-method/51160 "2021-02-23T03:29:14Z")

</div>

I’m looking at how to plot Newton’s method. I was going to add x values of each itteration, with y=0 to a DataFrame, then run a scatter plot. Is this what I should do, or is there a better way to go about this?

---

## [Hobby project: SequentialFit.jl](https://discourse.julialang.org/t/hobby-project-sequentialfit-jl/55717)

<div class="topic-metadata">

**Author:** [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Replies:** 13\
**Last updated:** [February 22, 2021, 9:44pm UTC](https://discourse.julialang.org/t/hobby-project-sequentialfit-jl/55717 "2021-02-22T21:44:48Z")

</div>

I don’t know mathematical optimization, and this might be a tremendously dumb idea, but I couldn’t get it out of my head after working on a project where I was fitting a surrogate model to the outputs from a very expensi…

---

## [Using SCIP GCG in JuMP](https://discourse.julialang.org/t/using-scip-gcg-in-jump/55770)

<div class="topic-metadata">

**Author:** [@Kreiton\_Sitorus](https://discourse.julialang.org/u/Kreiton_Sitorus)\
**Replies:** 2\
**Last updated:** [February 22, 2021, 9:22pm UTC](https://discourse.julialang.org/t/using-scip-gcg-in-jump/55770 "2021-02-22T21:22:31Z")

</div>

Hello, I’m new to JuMP and I’ve been working on implementing a branch and price framework for the Inventory Routing Problem. I stumbled across GCG (a generic branch and price) as an extension of SCIP. Is it accessible th…

---

## [\[MathOptFormat.jl\] Error when reading MPS file: objective functions with constant terms](https://discourse.julialang.org/t/mathoptformat-jl-error-when-reading-mps-file-objective-functions-with-constant-terms/55683)

<div class="topic-metadata">

**Author:** [@hustkisas](https://discourse.julialang.org/u/hustkisas)\
**Replies:** 1\
**Last updated:** [February 20, 2021, 9:31pm UTC](https://discourse.julialang.org/t/mathoptformat-jl-error-when-reading-mps-file-objective-functions-with-constant-terms/55683 "2021-02-20T21:31:21Z")

</div>

The objective function of a math programming problem usually does not have constant terms. But occasionally, MILP models processed by the solvers (CPLEX in this case) have constants in objective functions. When JuMP.read…

---

## [How to create multidimensional sets in JuMP/Julia as in GAMS](https://discourse.julialang.org/t/how-to-create-multidimensional-sets-in-jump-julia-as-in-gams/55581)

<div class="topic-metadata">

**Author:** [@GraceMabele](https://discourse.julialang.org/u/GraceMabele)\
**Replies:** 5\
**Last updated:** [February 20, 2021, 10:49am UTC](https://discourse.julialang.org/t/how-to-create-multidimensional-sets-in-jump-julia-as-in-gams/55581 "2021-02-20T10:49:38Z")

</div>

In GAMS, we can create multidimensional sets as follows Set i "mining regions" / china, ghana, ee+ussr, s-leone / n "ports" / accra, freetown, leningrad, shanghai / in(i,n) "mines to…

---

## [JuMP/Simplex - basic question: derivatives](https://discourse.julialang.org/t/jump-simplex-basic-question-derivatives/55416)

<div class="topic-metadata">

**Author:** [@TheMEGuy](https://discourse.julialang.org/u/TheMEGuy)\
**Replies:** 3\
**Last updated:** [February 16, 2021, 10:27pm UTC](https://discourse.julialang.org/t/jump-simplex-basic-question-derivatives/55416 "2021-02-16T22:27:47Z")

</div>

Hi, I am new to optimization and I have a question for you: these might be naive questions but when I register a nonlinear function I have two options: to provide JuMP with the first two derivations to use the auto d…

---

## [Cannot capture log with JuMP](https://discourse.julialang.org/t/cannot-capture-log-with-jump/55365)

<div class="topic-metadata">

**Author:** [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Replies:** 5\
**Last updated:** [February 16, 2021, 2:43pm UTC](https://discourse.julialang.org/t/cannot-capture-log-with-jump/55365 "2021-02-16T14:43:48Z")

</div>

I wanna capture CPLEX log in a file when it executes. However, when solving MIP instances the last bit of the log is never captured by redirect\_stdout and redirect\_stderr. I do not know the reason, I only know it happens…

---

## [Strange behavior of JuMP 0.21.5 while using CPLEX 20.1](https://discourse.julialang.org/t/strange-behavior-of-jump-0-21-5-while-using-cplex-20-1/55329)

<div class="topic-metadata">

**Author:** [@ahmadreza-marandi](https://discourse.julialang.org/u/ahmadreza-marandi)\
**Replies:** 4\
**Last updated:** [February 16, 2021, 8:02am UTC](https://discourse.julialang.org/t/strange-behavior-of-jump-0-21-5-while-using-cplex-20-1/55329 "2021-02-16T08:02:20Z")

</div>

Dear all, I have faced a strange behavior of CPLEX 20.1 while solving a nonconvex quadratic problem. As I couldn’t replicate the issue with small instances, I am attaching the data here: data information data (in .ma…

---

## [Optimization with Optim gives different results each time](https://discourse.julialang.org/t/optimization-with-optim-gives-different-results-each-time/54143)

<div class="topic-metadata">

**Author:** [@Michael\_Barmann](https://discourse.julialang.org/u/Michael_Barmann)\
**Replies:** 16\
**Last updated:** [February 14, 2021, 7:35pm UTC](https://discourse.julialang.org/t/optimization-with-optim-gives-different-results-each-time/54143 "2021-02-14T19:35:06Z")

</div>

I’m using IPNewton() from the Optim package for an inequality-constrained optimization problem. Strangely, I keep getting different results each time I run the same block of code (without changing anything). For example,…

---

## [JuMP: optimizing in loop with an updated parameter does not work as I expect from experience with AMPL/GAMS behavior](https://discourse.julialang.org/t/jump-optimizing-in-loop-with-an-updated-parameter-does-not-work-as-i-expect-from-experience-with-ampl-gams-behavior/55245)

<div class="topic-metadata">

**Author:** [@jovansam](https://discourse.julialang.org/u/jovansam)\
**Replies:** 2\
**Last updated:** [February 14, 2021, 11:52am UTC](https://discourse.julialang.org/t/jump-optimizing-in-loop-with-an-updated-parameter-does-not-work-as-i-expect-from-experience-with-ampl-gams-behavior/55245 "2021-02-14T11:52:43Z")

</div>

Hi, When I update a parameter of a predefined model, JuMP does not seem to update the parameter, at least when I call to optimize!. My solution for now is to put the whole model definition in a function as in the first…

---

## [GAMS executable not found! - JuMP](https://discourse.julialang.org/t/gams-executable-not-found-jump/54927)

<div class="topic-metadata">

**Author:** [@GraceMabele](https://discourse.julialang.org/u/GraceMabele)\
**Replies:** 2\
**Last updated:** [February 12, 2021, 12:32pm UTC](https://discourse.julialang.org/t/gams-executable-not-found-jump/54927 "2021-02-12T12:32:14Z")

</div>

Hi, I would like to use the GAMS Optimizer for my JuMP/Julia model. I have installed the GAMS package correctly using GAMS and it is updated however, when I want to use it as an optimizer as follows model\_name = Model…

---

## [HiGHS.jl v0.1.0 released](https://discourse.julialang.org/t/highs-jl-v0-1-0-released/55114)

<div class="topic-metadata">

**Author:** [@odow](https://discourse.julialang.org/u/odow)\
**Replies:** 0\
**Last updated:** [February 12, 2021, 3:35am UTC](https://discourse.julialang.org/t/highs-jl-v0-1-0-released/55114 "2021-02-12T03:35:04Z")

</div>

Dear all, We are happy to announce the initial v0.1 release of HiGHS.jl, a wrapper for HiGHS. HiGHS is a new high-performance open-source linear programming solver being developed by Julian Hall and colleagues at the U…

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

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