# Optimization (Mathematical)

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

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

**Page:** 69

---

## [Using Custom Structs for Nonlinear Optimization](https://discourse.julialang.org/t/using-custom-structs-for-nonlinear-optimization/75755)

<div class="topic-metadata">

**Author:** [@danny.s](https://discourse.julialang.org/u/danny.s)\
**Replies:** 1\
**Last updated:** [February 3, 2022, 10:35pm UTC](https://discourse.julialang.org/t/using-custom-structs-for-nonlinear-optimization/75755 "2022-02-03T22:35:55Z")

</div>

Hi, I’m new to JuMP and I’m trying to wrap my head around why what I’m doing is incorrect. A much simplified MWE is below: using JuMP, Ipopt M,N = 3,5 struct myPoly vec end function (f::myPoly)(x) ret = 0. …

---

## [Edit .NL files using JuMP](https://discourse.julialang.org/t/edit-nl-files-using-jump/75712)

<div class="topic-metadata">

**Author:** [@Luca](https://discourse.julialang.org/u/Luca)\
**Replies:** 1\
**Last updated:** [February 3, 2022, 5:41pm UTC](https://discourse.julialang.org/t/edit-nl-files-using-jump/75712 "2022-02-03T17:41:09Z")

</div>

Dear all, I would like to run a solvers comparison on several instances of MINLPLib. I can get the .NL files for each instance. Now, I would like to reformulate several instances and I need to edit the .NL files (in par…

---

## [Line-search SQP](https://discourse.julialang.org/t/line-search-sqp/75547)

<div class="topic-metadata">

**Author:** [@AhmedAlreweny](https://discourse.julialang.org/u/AhmedAlreweny)\
**Replies:** 5\
**Last updated:** [February 3, 2022, 2:32am UTC](https://discourse.julialang.org/t/line-search-sqp/75547 "2022-02-03T02:32:04Z")

</div>

Hi, I am trying to solve a PDE-constrained optimization problem that can be written as: minimize f(x) subject to h(x)=0 As this problem is nonlinear, I try to find a local minimum by starting from…

---

## [Optim.jl optimize 2 variable function with initial boundaries](https://discourse.julialang.org/t/optim-jl-optimize-2-variable-function-with-initial-boundaries/75497)

<div class="topic-metadata">

**Author:** [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Replies:** 6\
**Last updated:** [February 2, 2022, 1:16pm UTC](https://discourse.julialang.org/t/optim-jl-optimize-2-variable-function-with-initial-boundaries/75497 "2022-02-02T13:16:32Z")

</div>

I’m struggling to accomplish a basic task with Optim. Let’s say I defined a function f(a,x,y) = a + x^2 + y^2. I want to minimize this function given initial boundaries: x0 = \[-10, 10\], y0 = \[-10, 10\] and a = 10, as con…

---

## [Improve performance of a code with very large % of Garbage Collection](https://discourse.julialang.org/t/improve-performance-of-a-code-with-very-large-of-garbage-collection/75548)

<div class="topic-metadata">

**Author:** [@jmcastro2109](https://discourse.julialang.org/u/jmcastro2109)\
**Replies:** 19\
**Last updated:** [February 1, 2022, 10:31pm UTC](https://discourse.julialang.org/t/improve-performance-of-a-code-with-very-large-of-garbage-collection/75548 "2022-02-01T22:31:13Z")

</div>

Hello, I am trying to squeeze performance of the following code as much as possible. When I benchmark it, I get a very large number for the garbage collection statistic (see below). Does anyone have any recommendation fo…

---

## [Starter example in JuMP](https://discourse.julialang.org/t/starter-example-in-jump/75570)

<div class="topic-metadata">

**Author:** [@tonyhur](https://discourse.julialang.org/u/tonyhur)\
**Replies:** 4\
**Last updated:** [February 1, 2022, 7:24pm UTC](https://discourse.julialang.org/t/starter-example-in-jump/75570 "2022-02-01T19:24:57Z")

</div>

I tested JuMP some times ago an everything went perfect. Now when I retry the small model at: https://jump.dev/JuMP.jl/stable/tutorials/getting\_started/getting\_started\_with\_JuMP/ I get an error model = Model(GLPK.Opti…

---

## [ModelingToolkit Nonlinear Optimal Control](https://discourse.julialang.org/t/modelingtoolkit-nonlinear-optimal-control/75561)

<div class="topic-metadata">

**Author:** [@SCher](https://discourse.julialang.org/u/SCher)\
**Replies:** 4\
**Last updated:** [February 1, 2022, 7:15am UTC](https://discourse.julialang.org/t/modelingtoolkit-nonlinear-optimal-control/75561 "2022-02-01T07:15:19Z")

</div>

I ran the example nonlinear optimal control problem in the documentation, reproduced below: using ModelingToolkit @variables t x(t) v(t) u(t) @parameters p\[1:2\] D = Differential(t) loss = (4-x)^2 + 2v^2 + u^2 eqs = \[…

---

## [How to debug "Initial guess is not an interior point" in Optim.jl?](https://discourse.julialang.org/t/how-to-debug-initial-guess-is-not-an-interior-point-in-optim-jl/75554)

<div class="topic-metadata">

**Author:** [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Replies:** 3\
**Last updated:** [January 31, 2022, 11:41pm UTC](https://discourse.julialang.org/t/how-to-debug-initial-guess-is-not-an-interior-point-in-optim-jl/75554 "2022-01-31T23:41:11Z")

</div>

I’m trying to do constrained optimization using IPointNewton in Optim.jl, but running optimize(objective, dfc, θ0, IPNewton(), autodiff=:forward) produces: Initial guess is not an interior point …and then the results…

---

## [Problem with running Ipopt with Pardiso on jupyter notebook](https://discourse.julialang.org/t/problem-with-running-ipopt-with-pardiso-on-jupyter-notebook/75424)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 4\
**Last updated:** [January 31, 2022, 10:54pm UTC](https://discourse.julialang.org/t/problem-with-running-ipopt-with-pardiso-on-jupyter-notebook/75424 "2022-01-31T22:54:25Z")

</div>

Dear all, I am trying to solve an optimization problem from jupyter notebook using JuMP with solver Ipopt (Pardiso linear solver). I can solve the problem without any problem when the code is in a filename.jl file and I…

---

## [Best way to improve local minimas in nonlinear optimization?](https://discourse.julialang.org/t/best-way-to-improve-local-minimas-in-nonlinear-optimization/75215)

<div class="topic-metadata">

**Author:** [@Kevin\_Shen1](https://discourse.julialang.org/u/Kevin_Shen1)\
**Replies:** 29\
**Last updated:** [January 31, 2022, 10:23am UTC](https://discourse.julialang.org/t/best-way-to-improve-local-minimas-in-nonlinear-optimization/75215 "2022-01-31T10:23:03Z")

</div>

I’m trying to reduce the number of times NLP is returning a local minima instead of global minima (I know theoretically this is impossible if the objective is difficult enough). Currently I’m just doing a for-loop where …

---

## [Performance of Computation of Expectation of slow function](https://discourse.julialang.org/t/performance-of-computation-of-expectation-of-slow-function/74961)

<div class="topic-metadata">

**Author:** [@jmcastro2109](https://discourse.julialang.org/u/jmcastro2109)\
**Replies:** 13\
**Last updated:** [January 30, 2022, 4:48pm UTC](https://discourse.julialang.org/t/performance-of-computation-of-expectation-of-slow-function/74961 "2022-01-30T16:48:35Z")

</div>

Hi! I am trying to optimize this section of code. Basically, there are two functions. The first one solves a linear programming problem over a convex set. The second function computes a Monte Carlo experiment over S tria…

---

## [Finding the right JuMP package to solve a mixed-integer convex program](https://discourse.julialang.org/t/finding-the-right-jump-package-to-solve-a-mixed-integer-convex-program/75350)

<div class="topic-metadata">

**Author:** [@merlion](https://discourse.julialang.org/u/merlion)\
**Replies:** 3\
**Last updated:** [January 30, 2022, 3:29pm UTC](https://discourse.julialang.org/t/finding-the-right-jump-package-to-solve-a-mixed-integer-convex-program/75350 "2022-01-30T15:29:51Z")

</div>

I have a fairly straightforward optimisation problem that looks like this: \\max \\ \\log(a \\cdot x) + b \\cdot x \\\\ s.t. \\ x \\in \\{0,1\\}^n \\text{ and } \\sum\_{i \\in \[n\]}x\_i \\leq 10, for some a, b \\in \\mathbb{R}^n. I’d li…

---

## [How to delete a Gurobi logfile](https://discourse.julialang.org/t/how-to-delete-a-gurobi-logfile/75292)

<div class="topic-metadata">

**Author:** [@sebastian\_22](https://discourse.julialang.org/u/sebastian_22)\
**Replies:** 2\
**Last updated:** [January 28, 2022, 7:42am UTC](https://discourse.julialang.org/t/how-to-delete-a-gurobi-logfile/75292 "2022-01-28T07:42:46Z")

</div>

I have a model which runs multiple times with different input data. For each run I create a folder and place the Gurobi-Logfile within, by passing the Logfile-parameter to the optimizer after creating the model. After t…

---

## [Solving Matrix vector problem](https://discourse.julialang.org/t/solving-matrix-vector-problem/75259)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 6\
**Last updated:** [January 26, 2022, 11:41pm UTC](https://discourse.julialang.org/t/solving-matrix-vector-problem/75259 "2022-01-26T23:41:09Z")

</div>

Hi!, im trying to solve for x ∈ R^n the following equation: A\*x .\* x .+ x .-1 .= 0 or in matrix form: Diagonal(A\*x)\*x + x - ones(n) = zeros(n) One way to solve this is by using succesive substitution with the follow…

---

## [Weird Behaviour/Bug in Polyhedra.jl](https://discourse.julialang.org/t/weird-behaviour-bug-in-polyhedra-jl/74168)

<div class="topic-metadata">

**Author:** [@Codzilla](https://discourse.julialang.org/u/Codzilla)\
**Replies:** 1\
**Last updated:** [January 27, 2022, 1:27am UTC](https://discourse.julialang.org/t/weird-behaviour-bug-in-polyhedra-jl/74168 "2022-01-27T01:27:44Z")

</div>

I observed a strange behaviour with Polyhedra.jl. As a result of a rather complicated algorithm, I obtained a polyhedron as an intersection of half-planes. However, when I want to compute the vertices forming the complex…

---

## [MOI.Test.Config optimal\_status OPTIMAL or LOCALLY\_SOLVED?](https://discourse.julialang.org/t/moi-test-config-optimal-status-optimal-or-locally-solved/75227)

<div class="topic-metadata">

**Author:** [@renke.kuhlmann](https://discourse.julialang.org/u/renke.kuhlmann)\
**Replies:** 2\
**Last updated:** [January 26, 2022, 8:02pm UTC](https://discourse.julialang.org/t/moi-test-config-optimal-status-optimal-or-locally-solved/75227 "2022-01-26T20:02:05Z")

</div>

Is there a way to simply accept both optimal\_status OPTIMAL and LOCALLY\_SOLVED in MOI.Test.Config? For GAMS.jl I can’t really decide this, because it depends on what solver GAMS internally chooses. Would be great if I wo…

---

## [Hyperparameters to tune/try when getting ITERATION\_LIMIT, NUMERICAL\_ERROR for nonlinear optimization](https://discourse.julialang.org/t/hyperparameters-to-tune-try-when-getting-iteration-limit-numerical-error-for-nonlinear-optimization/75232)

<div class="topic-metadata">

**Author:** [@Kevin\_Shen1](https://discourse.julialang.org/u/Kevin_Shen1)\
**Replies:** 3\
**Last updated:** [January 26, 2022, 7:48pm UTC](https://discourse.julialang.org/t/hyperparameters-to-tune-try-when-getting-iteration-limit-numerical-error-for-nonlinear-optimization/75232 "2022-01-26T19:48:29Z")

</div>

Generally what hyperparameters should one try when getting the above two exit codes? I tried increasing max\_iter to 10,000 which noticeably slowed down the optimization but I’m still getting ITERATION\_LIMIT. One thing I’…

---

## [Identifying variables in GAMS.jl errors (how do I look up JuMP variables from auto-generated name x..)](https://discourse.julialang.org/t/identifying-variables-in-gams-jl-errors-how-do-i-look-up-jump-variables-from-auto-generated-name-x/74851)

<div class="topic-metadata">

**Author:** [@MartinBonde](https://discourse.julialang.org/u/MartinBonde)\
**Replies:** 3\
**Last updated:** [January 26, 2022, 12:55pm UTC](https://discourse.julialang.org/t/identifying-variables-in-gams-jl-errors-how-do-i-look-up-jump-variables-from-auto-generated-name-x/74851 "2022-01-26T12:55:19Z")

</div>

I am sending a JuMP model to a GAMS solver using GAMS.jl and get an error/warning: \*\* Error in Square System: A variable tries to exceed its bound. This is perfectly familiar and I get more information by looking in th…

---

## [How to reference JuMP constraint from solver index?](https://discourse.julialang.org/t/how-to-reference-jump-constraint-from-solver-index/57865)

<div class="topic-metadata">

**Author:** [@claytonpbarrows](https://discourse.julialang.org/u/claytonpbarrows)\
**Replies:** 6\
**Last updated:** [January 25, 2022, 10:29pm UTC](https://discourse.julialang.org/t/how-to-reference-jump-constraint-from-solver-index/57865 "2022-01-25T22:29:35Z")

</div>

Some solvers will indicate the constraints causing infeasibilities (e.g. Gurobi, Xpress, …) like this: User MIP start violates constraint R33048 by 0.493000000 Is there a way to retrieve the JuMP constraint ref corresp…

---

## [Undetected numerical issues with GLPK](https://discourse.julialang.org/t/undetected-numerical-issues-with-glpk/75196)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 1\
**Last updated:** [January 25, 2022, 9:48pm UTC](https://discourse.julialang.org/t/undetected-numerical-issues-with-glpk/75196 "2022-01-25T21:48:32Z")

</div>

I’ve ran across an issue in some unit tests (of a JuMP model), that were hard to track down. Those are only using GLPK since that is easy to integrate into the testing. I noticed that models with numerical issues seem to…

---

## [JuMP nonlinear optimization constraints broken to O(1e-9)](https://discourse.julialang.org/t/jump-nonlinear-optimization-constraints-broken-to-o-1e-9/75182)

<div class="topic-metadata">

**Author:** [@Kevin\_Shen1](https://discourse.julialang.org/u/Kevin_Shen1)\
**Replies:** 7\
**Last updated:** [January 25, 2022, 7:51pm UTC](https://discourse.julialang.org/t/jump-nonlinear-optimization-constraints-broken-to-o-1e-9/75182 "2022-01-25T19:51:51Z")

</div>

I’m running nonlinear optimization using the Ipopt optimizer. My objective/cost function relies on the constraints being adhered to strictly. However on some iterations the constraint are being broken. Specifically, my …

---

## [MOI.SingleVariable-in-MOI.Integer constraints are not supported by Ipopt](https://discourse.julialang.org/t/moi-singlevariable-in-moi-integer-constraints-are-not-supported-by-ipopt/75101)

<div class="topic-metadata">

**Author:** [@oxox](https://discourse.julialang.org/u/oxox)\
**Replies:** 4\
**Last updated:** [January 24, 2022, 6:28pm UTC](https://discourse.julialang.org/t/moi-singlevariable-in-moi-integer-constraints-are-not-supported-by-ipopt/75101 "2022-01-24T18:28:21Z")

</div>

Hi,I’m a beginner with JuMP and have some problems using the IPOPT solver. When using the IPOPT solver, there is no way to create an integer variable, an error occurs. Can someone help me？？？Thanks a lot. using JuMP u…

---

## [Issue with node\_count() - type of return](https://discourse.julialang.org/t/issue-with-node-count-type-of-return/74872)

<div class="topic-metadata">

**Author:** [@arkanver](https://discourse.julialang.org/u/arkanver)\
**Replies:** 4\
**Last updated:** [January 24, 2022, 2:09pm UTC](https://discourse.julialang.org/t/issue-with-node-count-type-of-return/74872 "2022-01-24T14:09:36Z")

</div>

Hello all, I’ve run into an issue with JuMP function node\_count(). This function seems to check the type of value returned by the solver and expects it to be Int64, however with some solvers this isn’t the case. For exa…

---

## [How to increase the maximum number of iterations in Ipopt?](https://discourse.julialang.org/t/how-to-increase-the-maximum-number-of-iterations-in-ipopt/75109)

<div class="topic-metadata">

**Author:** [@oxox](https://discourse.julialang.org/u/oxox)\
**Replies:** 2\
**Last updated:** [January 24, 2022, 12:09pm UTC](https://discourse.julialang.org/t/how-to-increase-the-maximum-number-of-iterations-in-ipopt/75109 "2022-01-24T12:09:31Z")

</div>

I got stuck while solving a problem with Ipopt, showing EXIT: Maximum Number of Iterations Exceeded. Its maximum number of iterations is 3000, how can I increase the maximum number of iterations？？？

---

## [Objective bound of a model within the callback](https://discourse.julialang.org/t/objective-bound-of-a-model-within-the-callback/74941)

<div class="topic-metadata">

**Author:** [@ahmad88](https://discourse.julialang.org/u/ahmad88)\
**Replies:** 3\
**Last updated:** [January 21, 2022, 9:22am UTC](https://discourse.julialang.org/t/objective-bound-of-a-model-within-the-callback/74941 "2022-01-21T09:22:08Z")

</div>

I have a model where I try to add cuts to it within the callback, I am trying to access the objective bound of the model but it is not possible in the callback with the following error message Error evaluating cec-proce…

---

## [Hessian with user-defined functions in MathOptNLSModel](https://discourse.julialang.org/t/hessian-with-user-defined-functions-in-mathoptnlsmodel/74672)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 2\
**Last updated:** [January 20, 2022, 10:04pm UTC](https://discourse.julialang.org/t/hessian-with-user-defined-functions-in-mathoptnlsmodel/74672 "2022-01-20T22:04:04Z")

</div>

I am trying to use user-defined functions with the MathOptNLSModel for solving nonlinear least squares problems. I use: using JuMP using NLPModelsJuMP using JSOSolvers model = Mod…

---

## [How to give a parameter list to Gurobi](https://discourse.julialang.org/t/how-to-give-a-parameter-list-to-gurobi/74878)

<div class="topic-metadata">

**Author:** [@fksayaci](https://discourse.julialang.org/u/fksayaci)\
**Replies:** 4\
**Last updated:** [January 19, 2022, 9:25pm UTC](https://discourse.julialang.org/t/how-to-give-a-parameter-list-to-gurobi/74878 "2022-01-19T21:25:57Z")

</div>

Hi all, I use Gurobi to solve an optimization problem. I might need to try different Gurobi parameters. Currently, I write parameters and their values inside the model directly, like Expansion\_Model = Model(optimizer…

---

## [Repeated indext at optimization problem in JuMP](https://discourse.julialang.org/t/repeated-indext-at-optimization-problem-in-jump/74295)

<div class="topic-metadata">

**Author:** [@Yuri\_Mizusawa](https://discourse.julialang.org/u/Yuri_Mizusawa)\
**Replies:** 4\
**Last updated:** [January 18, 2022, 11:04pm UTC](https://discourse.julialang.org/t/repeated-indext-at-optimization-problem-in-jump/74295 "2022-01-18T23:04:56Z")

</div>

Hi, I getting an error that says " Repeated index 1. Index sets must have unique elements." My problem has to be the following structure: x(1,0,0)+x(1,0,4)+x(1,4,0)+x(1,4,4)+x(2,0,0)+x(2,4,0)+x(2,6,0) Max I reduced o…

---

## [Adding nonlinear constraints in JuMP without hard-coding](https://discourse.julialang.org/t/adding-nonlinear-constraints-in-jump-without-hard-coding/74626)

<div class="topic-metadata">

**Author:** [@ReinhardMu](https://discourse.julialang.org/u/ReinhardMu)\
**Replies:** 4\
**Last updated:** [January 18, 2022, 1:38am UTC](https://discourse.julialang.org/t/adding-nonlinear-constraints-in-jump-without-hard-coding/74626 "2022-01-18T01:38:28Z")

</div>

Hi, I am trying to do some kind of cutting-plan algorithm in JuMP. I currently have the following example: function generate\_model(ydisc :: Vector{Vector{Float64}}) model = Model(SCIP.Optimizer) @variable(mod…

---

## [Design gear train with specific ratio with a set of fixed gears](https://discourse.julialang.org/t/design-gear-train-with-specific-ratio-with-a-set-of-fixed-gears/74675)

<div class="topic-metadata">

**Author:** [@pepijndevos](https://discourse.julialang.org/u/pepijndevos)\
**Replies:** 7\
**Last updated:** [January 16, 2022, 10:35pm UTC](https://discourse.julialang.org/t/design-gear-train-with-specific-ratio-with-a-set-of-fixed-gears/74675 "2022-01-16T22:35:30Z")

</div>

I want to make a gear train out of lego gears that needs a specific gear ratio. So let’s say I want a gear train with a ratio of 45/28 or whatever, and I have gears with \[8, 12, 16, 20, 24, 36, 40\] teeth. What combinatio…

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

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