# Optimization (Mathematical)

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

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

**Page:** 46

---

## [Passing arrays as variable bounds without indexing them is not supported. JuMP](https://discourse.julialang.org/t/passing-arrays-as-variable-bounds-without-indexing-them-is-not-supported-jump/97697)

<div class="topic-metadata">

**Author:** [@himgoy](https://discourse.julialang.org/u/himgoy)\
**Replies:** 5\
**Last updated:** [April 20, 2023, 11:30pm UTC](https://discourse.julialang.org/t/passing-arrays-as-variable-bounds-without-indexing-them-is-not-supported-jump/97697 "2023-04-20T23:30:19Z")

</div>

Hello Everyone, I am working on a linear programming problem for which I am creating lower bounds and upper bounds for each variable using for loop and pushing it into an array. I have a total of 5489 variables. M = Mo…

---

## [ModelingToolkit & Distributions for MLE estimation](https://discourse.julialang.org/t/modelingtoolkit-distributions-for-mle-estimation/97613)

<div class="topic-metadata">

**Author:** [@dmetivie](https://discourse.julialang.org/u/dmetivie)\
**Replies:** 4\
**Last updated:** [April 19, 2023, 4:17pm UTC](https://discourse.julialang.org/t/modelingtoolkit-distributions-for-mle-estimation/97613 "2023-04-19T16:17:04Z")

</div>

I am trying to use ModelingToolKit.jl to write a maximum loglikelihood estimator for generic distributions eg Univariate, Mixture, Multivariate etc. using ModelingToolkit, Optimization, OptimizationOptimJL using Distrib…

---

## [Simplifying LP for repeated resolving](https://discourse.julialang.org/t/simplifying-lp-for-repeated-resolving/97528)

<div class="topic-metadata">

**Author:** [@mikel8](https://discourse.julialang.org/u/mikel8)\
**Replies:** 13\
**Last updated:** [April 18, 2023, 9:00am UTC](https://discourse.julialang.org/t/simplifying-lp-for-repeated-resolving/97528 "2023-04-18T09:00:03Z")

</div>

Hi all, I’m working on a problem that requires repeated resolving of a large LP with different objectives. The methodology I’m working on involves solving a first problem to optimality, then imposing an epsilon constrai…

---

## [Arrays of vector variables in definitions of nonlinear programs in JuMP](https://discourse.julialang.org/t/arrays-of-vector-variables-in-definitions-of-nonlinear-programs-in-jump/97593)

<div class="topic-metadata">

**Author:** [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Replies:** 1\
**Last updated:** [April 18, 2023, 12:27am UTC](https://discourse.julialang.org/t/arrays-of-vector-variables-in-definitions-of-nonlinear-programs-in-jump/97593 "2023-04-18T00:27:15Z")

</div>

Is it possible to define arrays of vector variables while building a nonlinear programming problem in JuMP? I know we can define a scalar variable through @variable(model,x) I also know we can define a vector variable…

---

## [UndefVarError: solver not defined](https://discourse.julialang.org/t/undefvarerror-solver-not-defined/97497)

<div class="topic-metadata">

**Author:** [@Meilame\_Tayebjee](https://discourse.julialang.org/u/Meilame_Tayebjee)\
**Replies:** 3\
**Last updated:** [April 15, 2023, 3:56am UTC](https://discourse.julialang.org/t/undefvarerror-solver-not-defined/97497 "2023-04-15T03:56:30Z")

</div>

Hi, I am trying to run that small code that comes from Introduction to Julia using JuMP, Clp m = Model() @variable(m, x \>=0) @variable(m, y \>=0) @objective(m, Min, 10x + 26y) @constraint(m, const1, 11x + 3y \>= 21) @con…

---

## [Scalling both primal and dual feasibility tolerance according to the size of the problem](https://discourse.julialang.org/t/scalling-both-primal-and-dual-feasibility-tolerance-according-to-the-size-of-the-problem/97455)

<div class="topic-metadata">

**Author:** [@ErwanMeunier](https://discourse.julialang.org/u/ErwanMeunier)\
**Replies:** 2\
**Last updated:** [April 15, 2023, 12:44am UTC](https://discourse.julialang.org/t/scalling-both-primal-and-dual-feasibility-tolerance-according-to-the-size-of-the-problem/97455 "2023-04-15T00:44:17Z")

</div>

Hi, I have JuMP (MILP) models usually solved by HiGHS. Since some of my models were pretty constrained and had a lot of variables, some numerical issues arose and made some problems infeasible. I hence had to cross swor…

---

## [A new solver for robustified non-linear least squares problems, with non-Euclidean variables](https://discourse.julialang.org/t/a-new-solver-for-robustified-non-linear-least-squares-problems-with-non-euclidean-variables/96085)

<div class="topic-metadata">

**Author:** [@user664303](https://discourse.julialang.org/u/user664303)\
**Replies:** 6\
**Last updated:** [April 14, 2023, 10:30pm UTC](https://discourse.julialang.org/t/a-new-solver-for-robustified-non-linear-least-squares-problems-with-non-euclidean-variables/96085 "2023-04-14T22:30:19Z")

</div>

I have written a new solver for robustified non-linear least squares problems, with non-Euclidean variables. It can compute auto-differentiated Jacobians when necessary. I have called the package NLLSsolver. Please feel …

---

## [Recovering different form from JuMP model](https://discourse.julialang.org/t/recovering-different-form-from-jump-model/97401)

<div class="topic-metadata">

**Author:** [@shakedregev](https://discourse.julialang.org/u/shakedregev)\
**Replies:** 3\
**Last updated:** [April 12, 2023, 11:33pm UTC](https://discourse.julialang.org/t/recovering-different-form-from-jump-model/97401 "2023-04-12T23:33:31Z")

</div>

If I have a model that I know represents the LP min c'x s.t. Ax\<=b how can I extract (A, b, c) from the model? I know JuMP.\_nlp\_objective\_function will give me the objective function, but I actually need the vector c …

---

## [Why getting Infeasibility row despite it is not!?](https://discourse.julialang.org/t/why-getting-infeasibility-row-despite-it-is-not/97305)

<div class="topic-metadata">

**Author:** [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Replies:** 7\
**Last updated:** [April 10, 2023, 10:12pm UTC](https://discourse.julialang.org/t/why-getting-infeasibility-row-despite-it-is-not/97305 "2023-04-10T22:12:09Z")

</div>

I have a basic vehicle routing problem (VRP) model that I aim to solve using CPLEX and JuMP. Although I manually verified that the problem configuration(including the number of customers, drivers, locations, and costs) i…

---

## [Nonlinear optimization in JuMP adding the analytic gradient expression](https://discourse.julialang.org/t/nonlinear-optimization-in-jump-adding-the-analytic-gradient-expression/96867)

<div class="topic-metadata">

**Author:** [@mb96](https://discourse.julialang.org/u/mb96)\
**Replies:** 4\
**Last updated:** [April 9, 2023, 8:50pm UTC](https://discourse.julialang.org/t/nonlinear-optimization-in-jump-adding-the-analytic-gradient-expression/96867 "2023-04-09T20:50:04Z")

</div>

Hi, I am trying to solve a highly dimensional nonlinear optimization problem for which I have a function that maps a vector into a value and a its jacobian. I want to solve the problem providing the gradient but I can no…

---

## [IntervalRootFinding -- Multithreading causes random errors?](https://discourse.julialang.org/t/intervalrootfinding-multithreading-causes-random-errors/97247)

<div class="topic-metadata">

**Author:** [@Shmuley95](https://discourse.julialang.org/u/Shmuley95)\
**Replies:** 4\
**Last updated:** [April 8, 2023, 3:23pm UTC](https://discourse.julialang.org/t/intervalrootfinding-multithreading-causes-random-errors/97247 "2023-04-08T15:23:51Z")

</div>

I have found some erratic behaviour for the IntervalRootFinding.jl package when using multithreading. Specifically, when using multiple threads, the roots interface will sometimes return either false positives for non-ex…

---

## [JuMP with nonlinear vector constraints?](https://discourse.julialang.org/t/jump-with-nonlinear-vector-constraints/97223)

<div class="topic-metadata">

**Author:** [@irudik](https://discourse.julialang.org/u/irudik)\
**Replies:** 2\
**Last updated:** [April 8, 2023, 12:25pm UTC](https://discourse.julialang.org/t/jump-with-nonlinear-vector-constraints/97223 "2023-04-08T12:25:44Z")

</div>

This question is related to this old post, but I’m wondering if JuMP can now handle vector-valued nonlinear functions for constraints. I have a large scale problem where a nonlinear function of the variables x, multiplie…

---

## [SDDP simulation command](https://discourse.julialang.org/t/sddp-simulation-command/97197)

<div class="topic-metadata">

**Author:** [@Sorooshsa](https://discourse.julialang.org/u/Sorooshsa)\
**Replies:** 5\
**Last updated:** [April 8, 2023, 8:49am UTC](https://discourse.julialang.org/t/sddp-simulation-command/97197 "2023-04-08T08:49:27Z")

</div>

Hello everyone, I am using Julia and SDDP library to solve a multi-stage stochastic optimization model. The water inflow is my random variable. At the end of the SDDP, I used SDDP.train command to train the model. The…

---

## [Avoiding mutation in time course simulations - Zygote](https://discourse.julialang.org/t/avoiding-mutation-in-time-course-simulations-zygote/97141)

<div class="topic-metadata">

**Author:** [@Bill\_Holmes](https://discourse.julialang.org/u/Bill_Holmes)\
**Replies:** 1\
**Last updated:** [April 5, 2023, 11:15pm UTC](https://discourse.julialang.org/t/avoiding-mutation-in-time-course-simulations-zygote/97141 "2023-04-05T23:15:07Z")

</div>

Hello all. Yes, this is another question about avoiding mutation when using Zygote for AD. I am working on a problem where I will eventually need to differentiate through a time dependent simulation. As a toy problem con…

---

## [Adding extra objectives in JuMP](https://discourse.julialang.org/t/adding-extra-objectives-in-jump/67767)

<div class="topic-metadata">

**Author:** [@dbomahn](https://discourse.julialang.org/u/dbomahn)\
**Replies:** 3\
**Last updated:** [April 5, 2023, 6:42pm UTC](https://discourse.julialang.org/t/adding-extra-objectives-in-jump/67767 "2023-04-05T18:42:36Z")

</div>

Hello, I found that CPLEX 12.9 or later versions allow us to build a model with multiple objectives (not summing up the objectives by giving weights) and wanted to export the model to an LP file of CPLEX multi-objective…

---

## [Reducing model building time](https://discourse.julialang.org/t/reducing-model-building-time/97069)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 8\
**Last updated:** [April 5, 2023, 3:09am UTC](https://discourse.julialang.org/t/reducing-model-building-time/97069 "2023-04-05T03:09:51Z")

</div>

Is there a difference in the time taken to build the JuMP model if I use for loops for defining variables/constraints. For example: using JuMP model = Model() @variable(model, x\[i in 1:7, j in 1:10\] \>= 0) @constraint(…

---

## [JuMP/CPLEX: confusion with number of cuts added in callback](https://discourse.julialang.org/t/jump-cplex-confusion-with-number-of-cuts-added-in-callback/56033)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 6\
**Last updated:** [April 4, 2023, 12:44am UTC](https://discourse.julialang.org/t/jump-cplex-confusion-with-number-of-cuts-added-in-callback/56033 "2023-04-04T00:44:32Z")

</div>

Dear folks, I use JuMP (v0.21.4) and CPLEX (v0.7.3) to solve a MILP with lazy and user cuts added in a generic callback. However, I am confused with the output. To obtain the number of cuts after solving, I wrote the fu…

---

## [Job shop scheduling](https://discourse.julialang.org/t/job-shop-scheduling/96938)

<div class="topic-metadata">

**Author:** [@baprata](https://discourse.julialang.org/u/baprata)\
**Replies:** 4\
**Last updated:** [April 3, 2023, 12:52pm UTC](https://discourse.julialang.org/t/job-shop-scheduling/96938 "2023-04-03T12:52:40Z")

</div>

I am studying the mixed-integer linear programming formulation for the job shop with makespan minimization proposed by Manne (see Equations (1)-(7) from Ku and Beck (2016) http://dx.doi.org/10.1016/j.cor.2016.04.006, and…

---

## [Which JuMP supported solvers work well on Apple M2?](https://discourse.julialang.org/t/which-jump-supported-solvers-work-well-on-apple-m2/96992)

<div class="topic-metadata">

**Author:** [@nlaws](https://discourse.julialang.org/u/nlaws)\
**Replies:** 3\
**Last updated:** [April 3, 2023, 3:03am UTC](https://discourse.julialang.org/t/which-jump-supported-solvers-work-well-on-apple-m2/96992 "2023-04-03T03:03:29Z")

</div>

Looking at a new laptop RN and found this interesting discussion regarding Operations Research on M1: There is also this discussion on this discourse regarding CPLEX.jl on M2: However, the first discussion was last u…

---

## [Package for fast OLS using StaticArrays](https://discourse.julialang.org/t/package-for-fast-ols-using-staticarrays/96943)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 0\
**Last updated:** [April 1, 2023, 11:20am UTC](https://discourse.julialang.org/t/package-for-fast-ols-using-staticarrays/96943 "2023-04-01T11:20:39Z")

</div>

Hi all, I was just wondering if there is a package commonly used for performing OLS when the number of explanatory variables is known (and small), that leverages the benefits of StaticArrays.jl? For example: using Sta…

---

## [Cannot set an array of constraints @constraint, getting an error](https://discourse.julialang.org/t/cannot-set-an-array-of-constraints-constraint-getting-an-error/96901)

<div class="topic-metadata">

**Author:** [@Gregoryo](https://discourse.julialang.org/u/Gregoryo)\
**Replies:** 2\
**Last updated:** [April 1, 2023, 5:15am UTC](https://discourse.julialang.org/t/cannot-set-an-array-of-constraints-constraint-getting-an-error/96901 "2023-04-01T05:15:27Z")

</div>

Hi, I want to create a constraint in my model where I have np particles with a mass m at position x,y as variables. I want to set the constraint that the mass of particles is \>0 and I wrote the code below but I get an er…

---

## [Iterating through JuMP variables](https://discourse.julialang.org/t/iterating-through-jump-variables/96816)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 5\
**Last updated:** [March 31, 2023, 8:33pm UTC](https://discourse.julialang.org/t/iterating-through-jump-variables/96816 "2023-03-31T20:33:01Z")

</div>

I am doing some trivial checks on the variable values output by my optimization model, and I was wondering what is the correct way to iterate through a JuMP variable. For example, if my model has a variable x\[2:9, 10:15\],…

---

## [Nested Sum in NLObjective -](https://discourse.julialang.org/t/nested-sum-in-nlobjective/96890)

<div class="topic-metadata">

**Author:** [@Gregoryo](https://discourse.julialang.org/u/Gregoryo)\
**Replies:** 2\
**Last updated:** [March 31, 2023, 3:06pm UTC](https://discourse.julialang.org/t/nested-sum-in-nlobjective/96890 "2023-03-31T15:06:00Z")

</div>

Hi, I am totally new to both Julia and Optimization and I am trying to define a non linear objective that requires nested sums. I found some examples that I am trying to replicate, but I get an error. This is how I set m…

---

## [Using JuMP for variational data assimilation -- scalability and memory usage](https://discourse.julialang.org/t/using-jump-for-variational-data-assimilation-scalability-and-memory-usage/96686)

<div class="topic-metadata">

**Author:** [@zornsllama](https://discourse.julialang.org/u/zornsllama)\
**Replies:** 9\
**Last updated:** [March 31, 2023, 1:49am UTC](https://discourse.julialang.org/t/using-jump-for-variational-data-assimilation-scalability-and-memory-usage/96686 "2023-03-31T01:49:57Z")

</div>

Hi! I have been using JuMP over the last few months to perform variational data assimilation. Specifically, I am trying to estimate ODE parameters by direct transcription of the equations into a nonlinear program, utiliz…

---

## [@SDconstraint not working](https://discourse.julialang.org/t/sdconstraint-not-working/96685)

<div class="topic-metadata">

**Author:** [@shaurya](https://discourse.julialang.org/u/shaurya)\
**Replies:** 2\
**Last updated:** [March 29, 2023, 8:00pm UTC](https://discourse.julialang.org/t/sdconstraint-not-working/96685 "2023-03-29T20:00:18Z")

</div>

Hi, I’m new to Julia and this might be something very simple but I’m struggling to implement in JuMP. julia\> using JuMP julia\> using MosekTools julia\> model = Model(); julia\> @variable(model, x) x julia\> a = \[x 2x …

---

## [Rounding solution output in JuMP](https://discourse.julialang.org/t/rounding-solution-output-in-jump/96786)

<div class="topic-metadata">

**Author:** [@samerb](https://discourse.julialang.org/u/samerb)\
**Replies:** 5\
**Last updated:** [March 29, 2023, 7:32pm UTC](https://discourse.julialang.org/t/rounding-solution-output-in-jump/96786 "2023-03-29T19:32:55Z")

</div>

When I solve a problem in JuMP, my code ends with optimize!(model); @show value(m); end and then it prints the solution m to the problem–as directed by the @show value(m) line. But it prints many decimal places of m…

---

## [Set\_start\_value to reduce iterations](https://discourse.julialang.org/t/set-start-value-to-reduce-iterations/96760)

<div class="topic-metadata">

**Author:** [@Annaquest](https://discourse.julialang.org/u/Annaquest)\
**Replies:** 1\
**Last updated:** [March 29, 2023, 6:27pm UTC](https://discourse.julialang.org/t/set-start-value-to-reduce-iterations/96760 "2023-03-29T18:27:54Z")

</div>

I have written an algorithm where I update a penalty parameter, ρ, if some conditions are not satisfied. Then I update the objective function with the new increased parameter and call optimize! Like this, ρ = ρ\*10 init…

---

## [Suppress error for infeasible problem in Jump](https://discourse.julialang.org/t/suppress-error-for-infeasible-problem-in-jump/96758)

<div class="topic-metadata">

**Author:** [@umbe](https://discourse.julialang.org/u/umbe)\
**Replies:** 5\
**Last updated:** [March 29, 2023, 5:51pm UTC](https://discourse.julialang.org/t/suppress-error-for-infeasible-problem-in-jump/96758 "2023-03-29T17:51:44Z")

</div>

Hello to everyone! I am trying to solve a series of optimizations using Jump and Gurobi. When a problem is found to be infeasible because of the impossibility to satisfy all the boundaries/constraints, Jump stops the p…

---

## [Discrete Optimization](https://discourse.julialang.org/t/discrete-optimization/96731)

<div class="topic-metadata">

**Author:** [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Replies:** 5\
**Last updated:** [March 29, 2023, 5:28am UTC](https://discourse.julialang.org/t/discrete-optimization/96731 "2023-03-29T05:28:37Z")

</div>

Is there a Julia optimization package that minimizes an objective function subject to constraints, where the unknowns are discrete (i.e., integer-valued), similar to MATLAB’s ga?

---

## [How to specify variable with different indexes/bounds in JuMP](https://discourse.julialang.org/t/how-to-specify-variable-with-different-indexes-bounds-in-jump/96651)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [March 27, 2023, 7:29pm UTC](https://discourse.julialang.org/t/how-to-specify-variable-with-different-indexes-bounds-in-jump/96651 "2023-03-27T19:29:55Z")

</div>

Hello, I would like to declare in JuMP a variable s whose bounds depends form its index, with some indexes fixed. The problems is that if I declare it twice I get an error that the variable already attached to the model…

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

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