# Optimization (Mathematical)

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

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

**Page:** 90

---

## [Printing Jump NLexpression during solution](https://discourse.julialang.org/t/printing-jump-nlexpression-during-solution/49928)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 1\
**Last updated:** [November 11, 2020, 9:59pm UTC](https://discourse.julialang.org/t/printing-jump-nlexpression-during-solution/49928 "2020-11-11T21:59:38Z")

</div>

i’m having trouble debugging my NL model in Jump. Here is a MWE: using JuMP, Ipopt function j\_test(a) m = Model(Ipopt.Optimizer) @variable(m,x \>= 1.0) @variable(m,y) @NLexpression(m, q, x^a + log(x + a) ) …

---

## [Sparse Gradient using Zygote & Optim](https://discourse.julialang.org/t/sparse-gradient-using-zygote-optim/49087)

<div class="topic-metadata">

**Author:** [@sobhan](https://discourse.julialang.org/u/sobhan)\
**Replies:** 2\
**Last updated:** [November 11, 2020, 3:59pm UTC](https://discourse.julialang.org/t/sparse-gradient-using-zygote-optim/49087 "2020-11-11T15:59:31Z")

</div>

I’m trying to minimize a function and i use Zygote to calculate the derivatives to minimize it with BFGS(from Optim), Can i get sparse gradient/hessiens and use them with optim. I really need to switch to sparse since on…

---

## [JuMP to Convex](https://discourse.julialang.org/t/jump-to-convex/49957)

<div class="topic-metadata">

**Author:** [@faisal\_moh](https://discourse.julialang.org/u/faisal_moh)\
**Replies:** 1\
**Last updated:** [November 10, 2020, 11:57pm UTC](https://discourse.julialang.org/t/jump-to-convex/49957 "2020-11-10T23:57:52Z")

</div>

Hi, I’m new to Julia. Working on converting an optimization model from JuMP to Convex. m = Model(Ipopt.Optimizer) variable(m, x1 \>= 0) variable(m, x2 \>= 0) NLobjective(m, Max, 126x1 - 9x2^2 + 182x2 - 13x2^2) constr…

---

## [Unable to install Gurobi 9.1](https://discourse.julialang.org/t/unable-to-install-gurobi-9-1/49915)

<div class="topic-metadata">

**Author:** [@hassanis](https://discourse.julialang.org/u/hassanis)\
**Replies:** 2\
**Last updated:** [November 10, 2020, 11:58pm UTC](https://discourse.julialang.org/t/unable-to-install-gurobi-9-1/49915 "2020-11-10T23:58:31Z")

</div>

I’m having trouble installing Gurobi 9.1. My license is up to date and the new Gurobi has been installed in the correct location. I’ve also added the correct path prior to building the package: ENV\["GUROBI\_HOME"\] = "/Lib…

---

## [Simplex solver](https://discourse.julialang.org/t/simplex-solver/49827)

<div class="topic-metadata">

**Author:** [@fusion809](https://discourse.julialang.org/u/fusion809)\
**Replies:** 6\
**Last updated:** [November 10, 2020, 11:38am UTC](https://discourse.julialang.org/t/simplex-solver/49827 "2020-11-10T11:38:12Z")

</div>

I have just completed an operations research subject in which I was taught the simplex method and a foundation programming subject in which I was taught JavaScript/HTML. During these subjects, I wrote this webpage (sourc…

---

## [Condition for particular index in array to be maximum](https://discourse.julialang.org/t/condition-for-particular-index-in-array-to-be-maximum/49846)

<div class="topic-metadata">

**Author:** [@shashankchahar](https://discourse.julialang.org/u/shashankchahar)\
**Replies:** 2\
**Last updated:** [November 9, 2020, 10:28pm UTC](https://discourse.julialang.org/t/condition-for-particular-index-in-array-to-be-maximum/49846 "2020-11-09T22:28:19Z")

</div>

Hi, I am new to Julia and trying to solve a fitting problem. I have a transition matrix that I am trying to fit. I have got some results but they are non-intutive as the probability of being in state i,i should be the g…

---

## [Multithreading unstable with JuMP](https://discourse.julialang.org/t/multithreading-unstable-with-jump/49494)

<div class="topic-metadata">

**Author:** [@JohnZ](https://discourse.julialang.org/u/JohnZ)\
**Replies:** 15\
**Last updated:** [November 9, 2020, 6:18pm UTC](https://discourse.julialang.org/t/multithreading-unstable-with-jump/49494 "2020-11-09T18:18:53Z")

</div>

Hi, I am trying to use multithreading to make a loop parallel. That loop makes a call to a function to build the model and then optimise it. So individual iterations are independent, except that results are stored in arr…

---

## [Array variable - matrix multplication in JuMP](https://discourse.julialang.org/t/array-variable-matrix-multplication-in-jump/49801)

<div class="topic-metadata">

**Author:** [@shashankchahar](https://discourse.julialang.org/u/shashankchahar)\
**Replies:** 2\
**Last updated:** [November 9, 2020, 1:12pm UTC](https://discourse.julialang.org/t/array-variable-matrix-multplication-in-jump/49801 "2020-11-09T13:12:30Z")

</div>

Hello, I am new to Julia and trying to convert one of the tasks that I used to do in Excel into Julia. I need to find a matrix X. Matrix X represents discrete Markov model transition probabilities with the final column …

---

## [How do I reset a variable value in a loop?](https://discourse.julialang.org/t/how-do-i-reset-a-variable-value-in-a-loop/49821)

<div class="topic-metadata">

**Author:** [@carlos](https://discourse.julialang.org/u/carlos)\
**Replies:** 2\
**Last updated:** [November 9, 2020, 9:19am UTC](https://discourse.julialang.org/t/how-do-i-reset-a-variable-value-in-a-loop/49821 "2020-11-09T09:19:47Z")

</div>

Let’s say I have a model like this: using JuMP using CPLEX model = Model(CPLEX.Optimizer) for k = 1:3 @variables(model, begin sigma x\[1:3\]\>=0 end) @constraints(model,begin sigma == sum(x\[i\]…

---

## [Reading mps file with MathProgBase](https://discourse.julialang.org/t/reading-mps-file-with-mathprogbase/49776)

<div class="topic-metadata">

**Author:** [@Pierre-Louis\_Poirion](https://discourse.julialang.org/u/Pierre-Louis_Poirion)\
**Replies:** 3\
**Last updated:** [November 8, 2020, 8:14pm UTC](https://discourse.julialang.org/t/reading-mps-file-with-mathprogbase/49776 "2020-11-08T20:14:01Z")

</div>

Hi, I am trying to read a mps file using the following code: using JuMP using MathProgBase using Gurobi … function readLP(s) m\_internal = MathProgBase.LinearQuadraticModel(GurobiSolver()) MathProgBase.loadproblem…

---

## [Declare two exceptions in an equation](https://discourse.julialang.org/t/declare-two-exceptions-in-an-equation/49755)

<div class="topic-metadata">

**Author:** [@carlos](https://discourse.julialang.org/u/carlos)\
**Replies:** 4\
**Last updated:** [November 7, 2020, 10:54pm UTC](https://discourse.julialang.org/t/declare-two-exceptions-in-an-equation/49755 "2020-11-07T22:54:40Z")

</div>

Hi, I’m trying to declare two exceptions in the following equation but it doesn’t work like this: e52\[i=1:29,k=1:29;i != L,k != L\], -lambdaVI\[i\] \<= M\*BCC\[i,k\]

---

## [JuMP @constraint - "begin end" block not working](https://discourse.julialang.org/t/jump-constraint-begin-end-block-not-working/49734)

<div class="topic-metadata">

**Author:** [@shashankchahar](https://discourse.julialang.org/u/shashankchahar)\
**Replies:** 2\
**Last updated:** [November 7, 2020, 5:14pm UTC](https://discourse.julialang.org/t/jump-constraint-begin-end-block-not-working/49734 "2020-11-07T17:14:54Z")

</div>

Hi, I am trying to set some constraints in JuMP within Pluto. If I specify each constraint on a separate line then I don’t get an error message but if I try to put all the constraints in a begin-end block then Pluto giv…

---

## [Optimizing over real matrices with eigenvalues in $(0,1)$](https://discourse.julialang.org/t/optimizing-over-real-matrices-with-eigenvalues-in-0-1/49630)

<div class="topic-metadata">

**Author:** [@marcus](https://discourse.julialang.org/u/marcus)\
**Replies:** 3\
**Last updated:** [November 5, 2020, 5:35pm UTC](https://discourse.julialang.org/t/optimizing-over-real-matrices-with-eigenvalues-in-0-1/49630 "2020-11-05T17:35:58Z")

</div>

I’m trying to optimize a function with respect to a real matrix M with all eigenvalues real and lying in the open interval (0,1). I know that for a real symmetric positive-definite matrix S, we can use the Cholesky fact…

---

## [Solving a linear system of equalities and inequalities](https://discourse.julialang.org/t/solving-a-linear-system-of-equalities-and-inequalities/49579)

<div class="topic-metadata">

**Author:** [@Huy\_Nguyen](https://discourse.julialang.org/u/Huy_Nguyen)\
**Replies:** 18\
**Last updated:** [November 5, 2020, 12:01pm UTC](https://discourse.julialang.org/t/solving-a-linear-system-of-equalities-and-inequalities/49579 "2020-11-05T12:01:33Z")

</div>

I have a mixed system of equalities and inequalities, for example: x + 2y +3z = 10 2x + 4y + 10z = 20 4x + y + z \< 10 where unknown variables x, y, z are all real-valued. How can get a solution (or the range of all …

---

## [Defining : name 'BenchmarkToools' - how?](https://discourse.julialang.org/t/defining-name-benchmarktoools-how/49428)

<div class="topic-metadata">

**Author:** [@teriiju](https://discourse.julialang.org/u/teriiju)\
**Replies:** 13\
**Last updated:** [November 2, 2020, 6:48pm UTC](https://discourse.julialang.org/t/defining-name-benchmarktoools-how/49428 "2020-11-02T18:48:10Z")

</div>

Hi, newbie trying to understand how to define the ‘BenchmarkToools’ ? I installed ‘BenchmarkToools’ with using/add Pkg. now in jupyter notebook : getting msg: NameError: name ‘BenchmarkToools’ is not defined So does…

---

## [Mosek doesnt add its generated cuts](https://discourse.julialang.org/t/mosek-doesnt-add-its-generated-cuts/49457)

<div class="topic-metadata">

**Author:** [@hassanis](https://discourse.julialang.org/u/hassanis)\
**Replies:** 1\
**Last updated:** [November 2, 2020, 1:29pm UTC](https://discourse.julialang.org/t/mosek-doesnt-add-its-generated-cuts/49457 "2020-11-02T13:29:50Z")

</div>

Hello, I’m working on a problem using Mosektools & JUMP. It seems that after running it heuristics and cut generation at the root node, it fails to add them to the problem. As you can see in the output below, the relaxa…

---

## [MultiJuMP failed](https://discourse.julialang.org/t/multijump-failed/49265)

<div class="topic-metadata">

**Author:** [@mayar](https://discourse.julialang.org/u/mayar)\
**Replies:** 3\
**Last updated:** [November 1, 2020, 8:48pm UTC](https://discourse.julialang.org/t/multijump-failed/49265 "2020-11-01T20:48:55Z")

</div>

It failed to compile this package ,is there a way to add and use this package for multi objective optimization Thanks

---

## [CPLEX.jl Quadratic Expression symmetric matrix bug?](https://discourse.julialang.org/t/cplex-jl-quadratic-expression-symmetric-matrix-bug/49315)

<div class="topic-metadata">

**Author:** [@Paul\_McVay](https://discourse.julialang.org/u/Paul_McVay)\
**Replies:** 9\
**Last updated:** [October 31, 2020, 6:17am UTC](https://discourse.julialang.org/t/cplex-jl-quadratic-expression-symmetric-matrix-bug/49315 "2020-10-31T06:17:01Z")

</div>

I have a optimization procedure that used to work but now I’m getting an error. Is it related to the new CPLEX.jl package? A simple working example that produces the error is: m = Model(CPLEX.Optimizer) @variable m x\[1:…

---

## [Nonlinear optimization help. Optim, JuMP, something else?](https://discourse.julialang.org/t/nonlinear-optimization-help-optim-jump-something-else/47163)

<div class="topic-metadata">

**Author:** [@dweb](https://discourse.julialang.org/u/dweb)\
**Replies:** 5\
**Last updated:** [October 31, 2020, 5:19am UTC](https://discourse.julialang.org/t/nonlinear-optimization-help-optim-jump-something-else/47163 "2020-10-31T05:19:16Z")

</div>

I have a nonlinear optimization problem that I’ve tried solving with scipy. For small scale it (the ‘TNC’ option in scipy minimize, specifically) works well, but it’s too slow when I get to thousands of variables. I’m le…

---

## [JuMP abs in expression macro](https://discourse.julialang.org/t/jump-abs-in-expression-macro/49196)

<div class="topic-metadata">

**Author:** [@Paul\_McVay](https://discourse.julialang.org/u/Paul_McVay)\
**Replies:** 3\
**Last updated:** [October 29, 2020, 6:08pm UTC](https://discourse.julialang.org/t/jump-abs-in-expression-macro/49196 "2020-10-29T18:08:48Z")

</div>

I am hoping to extend the expression/objective JuMP macro to automatically introduce the necessary slack variable when using absolute values. I don’t have a lot of experience with JuMP internals and was hoping for some p…

---

## [Can't fit nonlinear function including '^' in LsqFit](https://discourse.julialang.org/t/cant-fit-nonlinear-function-including-in-lsqfit/49199)

<div class="topic-metadata">

**Author:** [@gedankenexperiment](https://discourse.julialang.org/u/gedankenexperiment)\
**Replies:** 2\
**Last updated:** [October 29, 2020, 8:33am UTC](https://discourse.julialang.org/t/cant-fit-nonlinear-function-including-in-lsqfit/49199 "2020-10-29T08:33:18Z")

</div>

Hi there, When I try to fit to a concentration-response curve (Hill equation) and use the exponent as a free parameter, Julia throws me an error complaining that the base should be a complex number. Even using lower bou…

---

## [L1 regularization with box constraint in JuMP?](https://discourse.julialang.org/t/l1-regularization-with-box-constraint-in-jump/49105)

<div class="topic-metadata">

**Author:** [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)\
**Replies:** 4\
**Last updated:** [October 28, 2020, 3:07pm UTC](https://discourse.julialang.org/t/l1-regularization-with-box-constraint-in-jump/49105 "2020-10-28T15:07:01Z")

</div>

Does JuMP have L1 regularization with box constraint in following form as utility ? minimize || Ax - b || subject to 1st norm of x i.e. |x| \< lambda (some parameter) and 0 \<= x\[i\] \<= kappa (some parameter) where, A i…

---

## [Splatting keyword arguments to @variable macro in JuMP](https://discourse.julialang.org/t/splatting-keyword-arguments-to-variable-macro-in-jump/49130)

<div class="topic-metadata">

**Author:** [@gobs](https://discourse.julialang.org/u/gobs)\
**Replies:** 2\
**Last updated:** [October 28, 2020, 12:57pm UTC](https://discourse.julialang.org/t/splatting-keyword-arguments-to-variable-macro-in-jump/49130 "2020-10-28T12:57:00Z")

</div>

I have a function which returns a particular variable, but defines it differently depending on my model type. I’ve recreated a MWE below. using JuMP function get\_z\_kwargs(m::Model) if m.ext\[:model\_type\] == "binary"…

---

## [Objective function error in a robust model](https://discourse.julialang.org/t/objective-function-error-in-a-robust-model/49123)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 2\
**Last updated:** [October 27, 2020, 7:29pm UTC](https://discourse.julialang.org/t/objective-function-error-in-a-robust-model/49123 "2020-10-27T19:29:42Z")

</div>

I need to put this objective function in Julia. Can someone help me? I started doing this, but I still couldn’t compile the objective function using JuMP, JuMPeR, DataFrames, MathOptInterface, GLPKMathProgInterface M…

---

## [Is LsqFit mantained?](https://discourse.julialang.org/t/is-lsqfit-mantained/49127)

<div class="topic-metadata">

**Author:** [@shiroghost](https://discourse.julialang.org/u/shiroghost)\
**Replies:** 4\
**Last updated:** [October 27, 2020, 6:08pm UTC](https://discourse.julialang.org/t/is-lsqfit-mantained/49127 "2020-10-27T18:08:22Z")

</div>

Dear all, I have seen that LsqFit has several pull requests that are not being merged. Does anyone know if the package is still matained? If not, what are good alternatives? Many thanks,

---

## [AmplNLWriter.jl with Ipopt from Ipopt.jl](https://discourse.julialang.org/t/amplnlwriter-jl-with-ipopt-from-ipopt-jl/49038)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [October 27, 2020, 8:42am UTC](https://discourse.julialang.org/t/amplnlwriter-jl-with-ipopt-from-ipopt-jl/49038 "2020-10-27T08:42:40Z")

</div>

I am trying to use Ipopt, as “shipped” with Ipopt.jl, using AmplNLWriter.jl. The way indicated in the AmplNLWriter.jl readme, myModel = Model(() -\> AmplNLWriter.Optimizer(Ipopt.amplexe)), returns me a MethodError. How…

---

## [Formalizing a governance structure for JuMP](https://discourse.julialang.org/t/formalizing-a-governance-structure-for-jump/49017)

<div class="topic-metadata">

**Author:** [@odow](https://discourse.julialang.org/u/odow)\
**Replies:** 2\
**Last updated:** [October 26, 2020, 6:53pm UTC](https://discourse.julialang.org/t/formalizing-a-governance-structure-for-jump/49017 "2020-10-26T18:53:23Z")

</div>

Dear all, Recently, JuMP turned eight years old. (The first commit for “Julp” was made on 10 October 2012!) It has come a long way since it’s creation as a side-project of two graduate students at MIT, and as we approac…

---

## [Fixing and freeing variables o JuMP](https://discourse.julialang.org/t/fixing-and-freeing-variables-o-jump/48838)

<div class="topic-metadata">

**Author:** [@baprata](https://discourse.julialang.org/u/baprata)\
**Replies:** 13\
**Last updated:** [October 24, 2020, 4:45pm UTC](https://discourse.julialang.org/t/fixing-and-freeing-variables-o-jump/48838 "2020-10-24T16:45:49Z")

</div>

I am studying a combinatorial optimization problem with JuMP and Gurobi. I need to fix some decision variables for a given number of iterations or a given time limit. After that, I would like to unfix these variables pre…

---

## [Detailed simplex, branch and bound and transportation solvers for Julia](https://discourse.julialang.org/t/detailed-simplex-branch-and-bound-and-transportation-solvers-for-julia/46538)

<div class="topic-metadata">

**Author:** [@fusion809](https://discourse.julialang.org/u/fusion809)\
**Replies:** 2\
**Last updated:** [October 23, 2020, 11:20am UTC](https://discourse.julialang.org/t/detailed-simplex-branch-and-bound-and-transportation-solvers-for-julia/46538 "2020-10-23T11:20:04Z")

</div>

I’m just wondering whether there are any Julia packages that show: detailed simplex tableaux for each iteration of the simplex method required to solve a linear programming problem; detailed information about the branc…

---

## [Numerical error when optimising expression with JuMP](https://discourse.julialang.org/t/numerical-error-when-optimising-expression-with-jump/48847)

<div class="topic-metadata">

**Author:** [@f6v](https://discourse.julialang.org/u/f6v)\
**Replies:** 1\
**Last updated:** [October 22, 2020, 9:58pm UTC](https://discourse.julialang.org/t/numerical-error-when-optimising-expression-with-jump/48847 "2020-10-22T21:58:40Z")

</div>

I’m completely new to mathematical optimisation and would appreciate if you could give a hint here. I have a function of three vectors x, y and z(each of size 15). Now I want to maximise a function of the vectors with c…

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

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