# Optimization (Mathematical)

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

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

**Page:** 88

---

## [ReverseDiff: differentiating a function with an indexing argument](https://discourse.julialang.org/t/reversediff-differentiating-a-function-with-an-indexing-argument/51530)

<div class="topic-metadata">

**Author:** [@jacobusmmsmit](https://discourse.julialang.org/u/jacobusmmsmit)\
**Replies:** 5\
**Last updated:** [December 15, 2020, 12:09pm UTC](https://discourse.julialang.org/t/reversediff-differentiating-a-function-with-an-indexing-argument/51530 "2020-12-15T12:09:52Z")

</div>

I am looking to move from using ForwardDiff to ReverseDiff due to the speedup provided by compiled tapes. I would like to differentiate a function where one of the arguments is an index of the output, and then compile th…

---

## [Retrieving the Hessian, and eventually calculating the standard errors using JuMP](https://discourse.julialang.org/t/retrieving-the-hessian-and-eventually-calculating-the-standard-errors-using-jump/51823)

<div class="topic-metadata">

**Author:** [@jovansam](https://discourse.julialang.org/u/jovansam)\
**Replies:** 3\
**Last updated:** [December 15, 2020, 9:47am UTC](https://discourse.julialang.org/t/retrieving-the-hessian-and-eventually-calculating-the-standard-errors-using-jump/51823 "2020-12-15T09:47:47Z")

</div>

After obtaining the optimum, I am interested in finding the Hessian. I then intend to use this to find standard errors. More like what is done here, but that code refers to old JuMP and I am having trouble translating it…

---

## [Julia not accepting this constraint. No method matching cartesian index](https://discourse.julialang.org/t/julia-not-accepting-this-constraint-no-method-matching-cartesian-index/51850)

<div class="topic-metadata">

**Author:** [@prit](https://discourse.julialang.org/u/prit)\
**Replies:** 1\
**Last updated:** [December 15, 2020, 9:13am UTC](https://discourse.julialang.org/t/julia-not-accepting-this-constraint-no-method-matching-cartesian-index/51850 "2020-12-15T09:13:33Z")

</div>

I have the following code in which the JuMP constraint is throwing an error. using JuMP using MosekTools K = 3 N = 2 penalties = \[1.0, 3.9, 8.7\] function A\_tau(r::Number, n::Number, tau::Float64) fac = 1 for m …

---

## [List of JuMP solvers that have a compute\_conflict! function implemented](https://discourse.julialang.org/t/list-of-jump-solvers-that-have-a-compute-conflict-function-implemented/51825)

<div class="topic-metadata">

**Author:** [@bhalonen](https://discourse.julialang.org/u/bhalonen)\
**Replies:** 2\
**Last updated:** [December 14, 2020, 9:05pm UTC](https://discourse.julialang.org/t/list-of-jump-solvers-that-have-a-compute-conflict-function-implemented/51825 "2020-12-14T21:05:19Z")

</div>

I am interested in using the compute\_conflict! function in JuMP, I noticed that Gurobi.jl and CPLEX.jl are cited in the documentation in a comment as available solvers. I also found that Xpress.jl has the same functional…

---

## [Gurobi constraint](https://discourse.julialang.org/t/gurobi-constraint/51798)

<div class="topic-metadata">

**Author:** [@jay-dave](https://discourse.julialang.org/u/jay-dave)\
**Replies:** 2\
**Last updated:** [December 14, 2020, 8:59pm UTC](https://discourse.julialang.org/t/gurobi-constraint/51798 "2020-12-14T20:59:55Z")

</div>

Below is the minimum example of the model I am able to solve. Why is the constraint @constraint(model, Cost == (x-y)\*z) allowed in Gurobi? Isn’t it nonlinear? using JuMP using Gurobi model = Model(with\_optimizer(Gurobi.…

---

## [Multiple Constraints using JuMP for unbounded knapsack](https://discourse.julialang.org/t/multiple-constraints-using-jump-for-unbounded-knapsack/51015)

<div class="topic-metadata">

**Author:** [@TheMEGuy](https://discourse.julialang.org/u/TheMEGuy)\
**Replies:** 6\
**Last updated:** [December 14, 2020, 2:58pm UTC](https://discourse.julialang.org/t/multiple-constraints-using-jump-for-unbounded-knapsack/51015 "2020-12-14T14:58:17Z")

</div>

I am new to programming, so I hope that the description of my probleme is accurate: Based on knapsack, I used JuMP and GLPK to come up with a solution for the unbounded knapsack problem.: function unbounded\_knapsack(va…

---

## [MethodError: no method matching \_parse\_NL\_expr\_runtime (Bilevel problem)](https://discourse.julialang.org/t/methoderror-no-method-matching-parse-nl-expr-runtime-bilevel-problem/51681)

<div class="topic-metadata">

**Author:** [@trathi](https://discourse.julialang.org/u/trathi)\
**Replies:** 2\
**Last updated:** [December 12, 2020, 3:44am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-parse-nl-expr-runtime-bilevel-problem/51681 "2020-12-12T03:44:50Z")

</div>

I am trying to solve a bilevel problem using the BilevelJuMP package. However, I get the following error on execution: MethodError: no method matching \_parse\_NL\_expr\_runtime(::BilevelJuMP.UpperModel, ::Int64, ::Array{JuM…

---

## [How to index a JuMP variable during optimization](https://discourse.julialang.org/t/how-to-index-a-jump-variable-during-optimization/51658)

<div class="topic-metadata">

**Author:** [@prit](https://discourse.julialang.org/u/prit)\
**Replies:** 3\
**Last updated:** [December 12, 2020, 2:48am UTC](https://discourse.julialang.org/t/how-to-index-a-jump-variable-during-optimization/51658 "2020-12-12T02:48:39Z")

</div>

I have an undetermined (K) number of optimization problems to solve, and so far I have the following code to solve the K optimization problems. using JuMP using MosekTools m = Model(optimizer\_with\_attributes(Mosek.Optim…

---

## [The objective function is not supported by JuMP](https://discourse.julialang.org/t/the-objective-function-is-not-supported-by-jump/51652)

<div class="topic-metadata">

**Author:** [@prit](https://discourse.julialang.org/u/prit)\
**Replies:** 7\
**Last updated:** [December 11, 2020, 9:51am UTC](https://discourse.julialang.org/t/the-objective-function-is-not-supported-by-jump/51652 "2020-12-11T09:51:37Z")

</div>

How to optimize a function in jump that contains an array in the objective function? I have the following constraint optimization problem in jump: m = Model(optimizer\_with\_attributes(Mosek.Optimizer, "QUIET" =\> false, …

---

## [How can I use optim.jl to find some values](https://discourse.julialang.org/t/how-can-i-use-optim-jl-to-find-some-values/51317)

<div class="topic-metadata">

**Author:** [@Lucas\_Pollito](https://discourse.julialang.org/u/Lucas_Pollito)\
**Replies:** 15\
**Last updated:** [December 11, 2020, 5:33am UTC](https://discourse.julialang.org/t/how-can-i-use-optim-jl-to-find-some-values/51317 "2020-12-11T05:33:31Z")

</div>

I have some working code that i cant optmization to find some x\[1\] x\[2\] x\[3\] x\[4\] constants. A link for all the code is: https://drive.google.com/drive/folders/11cqtyUnWAoAYWdWyWOd6fbu4TVejbBlM?usp=sharing aRe = \[1.…

---

## [Solving dynamic complementarity problem using Optim.jl or Complementarity.jl](https://discourse.julialang.org/t/solving-dynamic-complementarity-problem-using-optim-jl-or-complementarity-jl/51498)

<div class="topic-metadata">

**Author:** [@jovansam](https://discourse.julialang.org/u/jovansam)\
**Replies:** 3\
**Last updated:** [December 11, 2020, 2:13am UTC](https://discourse.julialang.org/t/solving-dynamic-complementarity-problem-using-optim-jl-or-complementarity-jl/51498 "2020-12-11T02:13:20Z")

</div>

I am interested in solving a dynamic complementarity problem using Complementarity.jl or Optim.jl. In particular I would appreciate some assistance in solving or how I could solve the following. A - B\*q\[t\] = λ\[t\] …

---

## [Setting Knitro options](https://discourse.julialang.org/t/setting-knitro-options/51637)

<div class="topic-metadata">

**Author:** [@Arega\_Getaneh](https://discourse.julialang.org/u/Arega_Getaneh)\
**Replies:** 1\
**Last updated:** [December 11, 2020, 12:33am UTC](https://discourse.julialang.org/t/setting-knitro-options/51637 "2020-12-11T00:33:21Z")

</div>

I am using Knitro solver for MPEC problem. However, while solving, the solver exited before reaching the optimal decision and the information reads as EXIT: Problem appears to be unbounded. Iterate is feasible and objec…

---

## [Extracting JuMP results](https://discourse.julialang.org/t/extracting-jump-results/51429)

<div class="topic-metadata">

**Author:** [@JohnZ](https://discourse.julialang.org/u/JohnZ)\
**Replies:** 6\
**Last updated:** [December 10, 2020, 10:25pm UTC](https://discourse.julialang.org/t/extracting-jump-results/51429 "2020-12-10T22:25:19Z")

</div>

It seems like matrix multiplication does not work in the usual way with DenseAxisArray, If I use, ones(5,15)\*x using the code in the MWE it throws an error. Interestingly, array slicing ones(5,15)\[1,:\]'\*x works fine, b…

---

## [Modifying coefficient of quadratic term in objective function](https://discourse.julialang.org/t/modifying-coefficient-of-quadratic-term-in-objective-function/51622)

<div class="topic-metadata">

**Author:** [@guilhermebodin](https://discourse.julialang.org/u/guilhermebodin)\
**Replies:** 1\
**Last updated:** [December 10, 2020, 5:59pm UTC](https://discourse.julialang.org/t/modifying-coefficient-of-quadratic-term-in-objective-function/51622 "2020-12-10T17:59:17Z")

</div>

Suppose I have this problem: using JuMP, OSQP m = Model(OSQP.Optimizer) @variable(m, x\[1:3\] \>= 0) @constraint(m, sum(x) .\>= 1) @objective(m, Min, x\[1\] + 2x\[2\] + 3x\[3\]^2 + 2x\[1\]^2) optimize!(m) objective\_value(m) I can …

---

## [Add constraints in parallel](https://discourse.julialang.org/t/add-constraints-in-parallel/51382)

<div class="topic-metadata">

**Author:** [@cyanzhao42](https://discourse.julialang.org/u/cyanzhao42)\
**Replies:** 2\
**Last updated:** [December 10, 2020, 6:39am UTC](https://discourse.julialang.org/t/add-constraints-in-parallel/51382 "2020-12-10T06:39:27Z")

</div>

Hi all, I am wondering can I add constraints to one model in parallel? The constraints is added via a for-loop. Thanks!

---

## [Which solver/model library can be used recursively / reentrantly](https://discourse.julialang.org/t/which-solver-model-library-can-be-used-recursively-reentrantly/51294)

<div class="topic-metadata">

**Author:** [@xyz1](https://discourse.julialang.org/u/xyz1)\
**Replies:** 2\
**Last updated:** [December 9, 2020, 8:47pm UTC](https://discourse.julialang.org/t/which-solver-model-library-can-be-used-recursively-reentrantly/51294 "2020-12-09T20:47:48Z")

</div>

Hello, my code currently consists of a recursive function f and I am planning on using an optimization solver (global optimization for integer programming with binary variables) for solving a sub-problem of the function f…

---

## [NLSolve performance 32 vs 64 bits](https://discourse.julialang.org/t/nlsolve-performance-32-vs-64-bits/51515)

<div class="topic-metadata">

**Author:** [@bdc](https://discourse.julialang.org/u/bdc)\
**Replies:** 1\
**Last updated:** [December 9, 2020, 12:18pm UTC](https://discourse.julialang.org/t/nlsolve-performance-32-vs-64-bits/51515 "2020-12-09T12:18:45Z")

</div>

Hi, For an application with NLsolve.jl I ran into an OutOfMemoryError(), so I decided to try using single instead of double precision in order to reduce the memory footprint (approach similar to machine learning on GPU’…

---

## [Trying to solve a second order differential equation. Your advices](https://discourse.julialang.org/t/trying-to-solve-a-second-order-differential-equation-your-advices/41162)

<div class="topic-metadata">

**Author:** [@aquarelle332](https://discourse.julialang.org/u/aquarelle332)\
**Replies:** 19\
**Last updated:** [December 9, 2020, 7:40am UTC](https://discourse.julialang.org/t/trying-to-solve-a-second-order-differential-equation-your-advices/41162 "2020-12-09T07:40:15Z")

</div>

Hello dear all, I don’t know whether it is the right place to post what follows… I am trying to resolve a differential equation like (namely Rayleigh-Plesset eq): R\*d²R/dt²+3/2\*dR/dt=P where P is a constant, say. Pre…

---

## [Packages for interval and radius of power series](https://discourse.julialang.org/t/packages-for-interval-and-radius-of-power-series/51230)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 24\
**Last updated:** [December 8, 2020, 6:06pm UTC](https://discourse.julialang.org/t/packages-for-interval-and-radius-of-power-series/51230 "2020-12-08T18:06:14Z")

</div>

What packages exist for studying power series(not sure the plural)? I’m trying to find the formula that originated the series, as well as the radius and interval of convergence.

---

## [Nonlinear Objective Function Splatting](https://discourse.julialang.org/t/nonlinear-objective-function-splatting/51251)

<div class="topic-metadata">

**Author:** [@Flesko](https://discourse.julialang.org/u/Flesko)\
**Replies:** 3\
**Last updated:** [December 7, 2020, 8:30am UTC](https://discourse.julialang.org/t/nonlinear-objective-function-splatting/51251 "2020-12-07T08:30:01Z")

</div>

Hey everyone, I was playing around with nonlinear functions for optimal control problems utilizing JuMP with IPOPT as the solver. I realized convergence problems as soon as I use the splatting operator for passing vecto…

---

## [Relationship between variables](https://discourse.julialang.org/t/relationship-between-variables/51272)

<div class="topic-metadata">

**Author:** [@JohnZ](https://discourse.julialang.org/u/JohnZ)\
**Replies:** 6\
**Last updated:** [December 6, 2020, 7:52pm UTC](https://discourse.julialang.org/t/relationship-between-variables/51272 "2020-12-06T19:52:34Z")

</div>

In an optimisation problem, I have some relationships between variables i.e. they should take same values. I define a dataframe (called Master) that contains all the data and another dataframe (called Relationship) that …

---

## [Summation formulation](https://discourse.julialang.org/t/summation-formulation/51276)

<div class="topic-metadata">

**Author:** [@Maria95](https://discourse.julialang.org/u/Maria95)\
**Replies:** 2\
**Last updated:** [December 6, 2020, 1:01pm UTC](https://discourse.julialang.org/t/summation-formulation/51276 "2020-12-06T13:01:20Z")

</div>

Hello, Apologies if this is not the right category for positing this question. I am not sure whether all linear algebra operations such as cumulative sum can be used with JuMP. I have given a working generic example to g…

---

## [How to write an objective function that has both a LASSO and a Ridge regularization term in JuMP](https://discourse.julialang.org/t/how-to-write-an-objective-function-that-has-both-a-lasso-and-a-ridge-regularization-term-in-jump/50727)

<div class="topic-metadata">

**Author:** [@Jaidy](https://discourse.julialang.org/u/Jaidy)\
**Replies:** 30\
**Last updated:** [December 6, 2020, 1:16am UTC](https://discourse.julialang.org/t/how-to-write-an-objective-function-that-has-both-a-lasso-and-a-ridge-regularization-term-in-jump/50727 "2020-12-06T01:16:27Z")

</div>

hello everyone, I am trying to use JuMP to minimize an objective function, essentially logistic regression with both LASSO and Ridge regularization term. Here is the setting: I have a matrix of inputs, X, having n rows…

---

## [Simplex implementation with A,b,c matrices](https://discourse.julialang.org/t/simplex-implementation-with-a-b-c-matrices/51307)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 5\
**Last updated:** [December 5, 2020, 8:06pm UTC](https://discourse.julialang.org/t/simplex-implementation-with-a-b-c-matrices/51307 "2020-12-05T20:06:02Z")

</div>

Hello, I would like to solve an LP min cx s.t. Ax = b for which I have A, b and c all prepared. That is, I don’t want to go through a modeling phase. Is there a way to define a JuMP model directly with these component…

---

## [Problems with Ipopt in Big Sur](https://discourse.julialang.org/t/problems-with-ipopt-in-big-sur/51255)

<div class="topic-metadata">

**Author:** [@mreguant](https://discourse.julialang.org/u/mreguant)\
**Replies:** 8\
**Last updated:** [December 4, 2020, 9:57pm UTC](https://discourse.julialang.org/t/problems-with-ipopt-in-big-sur/51255 "2020-12-04T21:57:23Z")

</div>

Hello, I am using JuMP and Ipopt. It was all working but it failed after my Mac upgrade to Big Sur. I cannot even get the basic examples to work. The code runs, but the solver fails to find a solution due to numerical is…

---

## [Can't use minimum() on constraint -MethodError: no method matching isless(...)](https://discourse.julialang.org/t/cant-use-minimum-on-constraint-methoderror-no-method-matching-isless/51219)

<div class="topic-metadata">

**Author:** [@valenmgama](https://discourse.julialang.org/u/valenmgama)\
**Replies:** 1\
**Last updated:** [December 3, 2020, 8:03pm UTC](https://discourse.julialang.org/t/cant-use-minimum-on-constraint-methoderror-no-method-matching-isless/51219 "2020-12-03T20:03:22Z")

</div>

I am trying to use minimum on a Julia Contraint but I get the following Method Error. I am 100% using the minimum() function is what causes the trouble. Any ideas on a work around? LoadError: MethodError: no method matc…

---

## [Can I use JuMP 0.18 with Gurobi.jl 0.9.3?](https://discourse.julialang.org/t/can-i-use-jump-0-18-with-gurobi-jl-0-9-3/51220)

<div class="topic-metadata">

**Author:** [@Wei\_Wang](https://discourse.julialang.org/u/Wei_Wang)\
**Replies:** 2\
**Last updated:** [December 3, 2020, 8:01pm UTC](https://discourse.julialang.org/t/can-i-use-jump-0-18-with-gurobi-jl-0-9-3/51220 "2020-12-03T20:01:42Z")

</div>

For some reasons, I currently still have to use JuMP 0.18. When I updated Gurobi to the latest version 9.1 and Gurobi.jl to 0.9.3, I got some problems building my model. When I do it with model=Model(solver=GurobiSolv…

---

## [Help using the JuMPeR package](https://discourse.julialang.org/t/help-using-the-jumper-package/51184)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 1\
**Last updated:** [December 3, 2020, 1:11pm UTC](https://discourse.julialang.org/t/help-using-the-jumper-package/51184 "2020-12-03T13:11:35Z")

</div>

Could someone point me to a tutorial on using JuMPeR? Thanks!!

---

## [It there a way or package to solve the nonlinear mixed complementarity problem?](https://discourse.julialang.org/t/it-there-a-way-or-package-to-solve-the-nonlinear-mixed-complementarity-problem/51161)

<div class="topic-metadata">

**Author:** [@jshengdb](https://discourse.julialang.org/u/jshengdb)\
**Replies:** 2\
**Last updated:** [December 3, 2020, 2:38am UTC](https://discourse.julialang.org/t/it-there-a-way-or-package-to-solve-the-nonlinear-mixed-complementarity-problem/51161 "2020-12-03T02:38:35Z")

</div>

Hi Julia user: I was wondering if there was a way or package to model and solver the nonlinear mixed complementarity problem? I know now we can model the linear complementarity problem by using complement constraints in…

---

## [Constraining binary integer variables with indicator constraints](https://discourse.julialang.org/t/constraining-binary-integer-variables-with-indicator-constraints/51043)

<div class="topic-metadata">

**Author:** [@bvilmann](https://discourse.julialang.org/u/bvilmann)\
**Replies:** 9\
**Last updated:** [December 2, 2020, 10:11pm UTC](https://discourse.julialang.org/t/constraining-binary-integer-variables-with-indicator-constraints/51043 "2020-12-02T22:11:15Z")

</div>

I want to constrain binary integer variables, x, with indicator constraints to express a change in a binary integer variable over a specific iterator, t. I thought this could be nice since the different cases are obviou…

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

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