# Optimization (Mathematical)

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

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

**Page:** 38

---

## [JuMP get number of iterations](https://discourse.julialang.org/t/jump-get-number-of-iterations/8452)

<div class="topic-metadata">

**Author:** [@nantonel](https://discourse.julialang.org/u/nantonel)\
**Replies:** 2\
**Last updated:** [October 11, 2023, 9:05am UTC](https://discourse.julialang.org/t/jump-get-number-of-iterations/8452 "2023-10-11T09:05:40Z")

</div>

Is there a way to access the number of iterations apart from the log of the solver? I’m comparing different solvers and I would like to store in a vector the number of iteration each one takes. I couldn’t really find a…

---

## [Looking for a constrained optimization algorithm](https://discourse.julialang.org/t/looking-for-a-constrained-optimization-algorithm/104799)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 7\
**Last updated:** [October 10, 2023, 1:32pm UTC](https://discourse.julialang.org/t/looking-for-a-constrained-optimization-algorithm/104799 "2023-10-10T13:32:00Z")

</div>

After solving some structural estimation problems in economics with existing tools, I have a more clear idea of the kind of algorithm I am looking for. AFAICT no existing Julia package exists that does everything below —…

---

## [Interim values of Metaheuristics optimiziers](https://discourse.julialang.org/t/interim-values-of-metaheuristics-optimiziers/104768)

<div class="topic-metadata">

**Author:** [@jcusick](https://discourse.julialang.org/u/jcusick)\
**Replies:** 3\
**Last updated:** [October 10, 2023, 12:45pm UTC](https://discourse.julialang.org/t/interim-values-of-metaheuristics-optimiziers/104768 "2023-10-10T12:45:31Z")

</div>

I’m interested in getting the interim population values for algorithms within Metaheuristics.jl at each timestep, for example Differential Evolution. I’ve seen examples where the single member of the population with the…

---

## [Help with a JuMP.jl problem](https://discourse.julialang.org/t/help-with-a-jump-jl-problem/104778)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 1\
**Last updated:** [October 10, 2023, 5:48am UTC](https://discourse.julialang.org/t/help-with-a-jump-jl-problem/104778 "2023-10-10T05:48:52Z")

</div>

The task is fairly straightforward. I need to group the numbers in A into pairs, such that the sum of each pair corresponds to one of the numbers in S. using HiGHS using JuMP m = Model(HiGHS.Optimizer) A = \[ 119 225 5…

---

## [Setting up gurobi environment inside a module](https://discourse.julialang.org/t/setting-up-gurobi-environment-inside-a-module/104736)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 8\
**Last updated:** [October 9, 2023, 2:22pm UTC](https://discourse.julialang.org/t/setting-up-gurobi-environment-inside-a-module/104736 "2023-10-09T14:22:52Z")

</div>

I have a module that has some functions that run some optimization problems modeling using the JuMP package and the Gurobi solver. a very generic structure of the code is as follows: module TestModule using JuMP using…

---

## [Question about the syntax of the @constraint command](https://discourse.julialang.org/t/question-about-the-syntax-of-the-constraint-command/104700)

<div class="topic-metadata">

**Author:** [@Artemisa\_Fontinele](https://discourse.julialang.org/u/Artemisa_Fontinele)\
**Replies:** 7\
**Last updated:** [October 8, 2023, 10:18am UTC](https://discourse.julialang.org/t/question-about-the-syntax-of-the-constraint-command/104700 "2023-10-08T10:18:13Z")

</div>

Hey guys! I’ve just started programming in julia and I want to implement two constraints for my code using the JuMP library. The constraints are: for i in 1:N for j in 1:N If sum of Xji == 0 then sum of Xij \>=2 If …

---

## [The erros of using RAPOSa(https://raposa.usc.es) based on AmplNLWriter](https://discourse.julialang.org/t/the-erros-of-using-raposa-https-raposa-usc-es-based-on-amplnlwriter/104493)

<div class="topic-metadata">

**Author:** [@wjulia](https://discourse.julialang.org/u/wjulia)\
**Replies:** 6\
**Last updated:** [October 7, 2023, 12:39pm UTC](https://discourse.julialang.org/t/the-erros-of-using-raposa-https-raposa-usc-es-based-on-amplnlwriter/104493 "2023-10-07T12:39:12Z")

</div>

using JuMP, AmplNLWriter m = Model(() → AmplNLWriter.Optimizer(“raposa”)) @variable(m, 1 \<= x \<= 10 ) @variable(m, 0 \<= y \<= 8 ) @NLobjective(m, Min, x^2 + y^2 + x ) @NLconstraint(m, x\*y \>= 1.0 ) optimize!(m) @sho…

---

## ["Switching" out the attached \`Optimizer\` of an (empty) model](https://discourse.julialang.org/t/switching-out-the-attached-optimizer-of-an-empty-model/104633)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 9\
**Last updated:** [October 6, 2023, 5:28pm UTC](https://discourse.julialang.org/t/switching-out-the-attached-optimizer-of-an-empty-model/104633 "2023-10-06T17:28:04Z")

</div>

I’m trying to do the following, in order to “parameterize” a model function make\_parametric!(model::JuMP.Model) if !isempty(model) @error "\[core\] Model must be empty when trying to switch to parametric mode"…

---

## [About Start Values in JuMP - MOA](https://discourse.julialang.org/t/about-start-values-in-jump-moa/104500)

<div class="topic-metadata">

**Author:** [@rodolforbcoutinho](https://discourse.julialang.org/u/rodolforbcoutinho)\
**Replies:** 6\
**Last updated:** [October 5, 2023, 1:39pm UTC](https://discourse.julialang.org/t/about-start-values-in-jump-moa/104500 "2023-10-05T13:39:54Z")

</div>

Hello to all! I have a doubt about using start values in variables. My hypothesis was that could speed up the execution time if I provide most of the values in variable vector already in optimum position. In my proble…

---

## [How to optimize a neural network with a "traditional" optimizer?](https://discourse.julialang.org/t/how-to-optimize-a-neural-network-with-a-traditional-optimizer/104580)

<div class="topic-metadata">

**Author:** [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Replies:** 1\
**Last updated:** [October 4, 2023, 6:50pm UTC](https://discourse.julialang.org/t/how-to-optimize-a-neural-network-with-a-traditional-optimizer/104580 "2023-10-04T18:50:44Z")

</div>

Nowadays neural networks are represented as trees with parameters as leaves. This is how PyTorch, JAX and Julia’s Flux do it. It doesn’t let one update all parameters at once like x = x - lr \* grad(objective)(x), so libr…

---

## [Solver-specific callback for custom termination rule for LP Barrier using Gurobi and JuMP](https://discourse.julialang.org/t/solver-specific-callback-for-custom-termination-rule-for-lp-barrier-using-gurobi-and-jump/104391)

<div class="topic-metadata">

**Author:** [@FelixSchmidt](https://discourse.julialang.org/u/FelixSchmidt)\
**Replies:** 13\
**Last updated:** [October 4, 2023, 9:10am UTC](https://discourse.julialang.org/t/solver-specific-callback-for-custom-termination-rule-for-lp-barrier-using-gurobi-and-jump/104391 "2023-10-04T09:10:49Z")

</div>

Hi all, I am implementing a Benders-like bundle method algorithm to solve a large-scale stochastic linear program. I want to use on-demand inexact cuts, i.e. I would like to solve the subproblems accurately only if they…

---

## [Trying to solve a SDP problem with quadratic constraints](https://discourse.julialang.org/t/trying-to-solve-a-sdp-problem-with-quadratic-constraints/104461)

<div class="topic-metadata">

**Author:** [@golanor](https://discourse.julialang.org/u/golanor)\
**Replies:** 3\
**Last updated:** [October 3, 2023, 5:06pm UTC](https://discourse.julialang.org/t/trying-to-solve-a-sdp-problem-with-quadratic-constraints/104461 "2023-10-03T17:06:43Z")

</div>

Hi, I’m trying to solve a SDP with quadratic constraints and I get the following error Unable to transform a quadratic constraint into a second-order cone constraint because the quadratic constraint is not strongly conv…

---

## [Nonlinear expressions may contain only scalar expressions](https://discourse.julialang.org/t/nonlinear-expressions-may-contain-only-scalar-expressions/45147)

<div class="topic-metadata">

**Author:** [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Replies:** 3\
**Last updated:** [October 2, 2023, 2:27pm UTC](https://discourse.julialang.org/t/nonlinear-expressions-may-contain-only-scalar-expressions/45147 "2023-10-02T14:27:51Z")

</div>

using JuMP,Gurobi n=4 PL=\[0.3;0.55;0;0\] model=Model(Gurobi.Optimizer) G=\[1.04209 -0.588235 -0.0 -0.453858;-0.588235 1.069 0 -0.480769;-0 0 0 0;-0.453858 -0.480769 0 0.934627\] Q=\[-8.24288 2.35294 3.66667 1.89107; …

---

## [How to set std value as objective?](https://discourse.julialang.org/t/how-to-set-std-value-as-objective/104304)

<div class="topic-metadata">

**Author:** [@jack\_lee](https://discourse.julialang.org/u/jack_lee)\
**Replies:** 7\
**Last updated:** [September 29, 2023, 7:56pm UTC](https://discourse.julialang.org/t/how-to-set-std-value-as-objective/104304 "2023-09-29T19:56:21Z")

</div>

function solution() model = Model(Gurobi.Optimizer);set\_silent(model) @variable(model,x\[1:3000,1:125\],Bin) @constraint(model,\[i=1:3000\],sum(x\[i,:\]) == 5) @constraint(model,\[i=1:125\],sum(x\[:,i\]) == 120) …

---

## [ANN: JuMP-dev 2023](https://discourse.julialang.org/t/ann-jump-dev-2023/91238)

<div class="topic-metadata">

**Author:** [@odow](https://discourse.julialang.org/u/odow)\
**Replies:** 3\
**Last updated:** [September 28, 2023, 4:22am UTC](https://discourse.julialang.org/t/ann-jump-dev-2023/91238 "2023-09-28T04:22:57Z")

</div>

Dear all, We are pleased to announce that JuMP-dev 2023 will be co-located with JuliaCon 2023. This year, JuliaCon is being held in person, 24-29 July, 2023 in Cambridge, Massachusetts. You can find more information on…

---

## [PowerModelsADA.jl](https://discourse.julialang.org/t/powermodelsada-jl/104290)

<div class="topic-metadata">

**Author:** [@priod](https://discourse.julialang.org/u/priod)\
**Replies:** 4\
**Last updated:** [September 27, 2023, 12:37am UTC](https://discourse.julialang.org/t/powermodelsada-jl/104290 "2023-09-27T00:37:12Z")

</div>

Hi, I am trying to run the PowerModelsADA.jl (Power Models Alternating Distributed Algorithms) and using the Alternating Direction Method of Multipliers (ADMM) technique. I am following the example code and facing the f…

---

## [Matrix inversion inside JuMP objective](https://discourse.julialang.org/t/matrix-inversion-inside-jump-objective/104214)

<div class="topic-metadata">

**Author:** [@lsablon](https://discourse.julialang.org/u/lsablon)\
**Replies:** 4\
**Last updated:** [September 26, 2023, 8:05pm UTC](https://discourse.julialang.org/t/matrix-inversion-inside-jump-objective/104214 "2023-09-26T20:05:07Z")

</div>

Hello, I am trying to solve the following problem using JuMP: find a set of values u subject to different linear constraints (namely positivity and mass conservation) such that the distance to a know solution of a linea…

---

## [Sequence of JuMP problems -- reduce memory usage](https://discourse.julialang.org/t/sequence-of-jump-problems-reduce-memory-usage/103797)

<div class="topic-metadata">

**Author:** [@gmantegazza](https://discourse.julialang.org/u/gmantegazza)\
**Replies:** 9\
**Last updated:** [September 26, 2023, 8:27am UTC](https://discourse.julialang.org/t/sequence-of-jump-problems-reduce-memory-usage/103797 "2023-09-26T08:27:03Z")

</div>

Hello everyone, Thanks for existing! I have a problem withe memory usage when solving a sequence of JuMP problems. The structure of my code is the following. using JuMP using Gurobi function Opt(ID,Ind\_availL) Rou…

---

## [How to continue for loop even if model is infeasible](https://discourse.julialang.org/t/how-to-continue-for-loop-even-if-model-is-infeasible/104219)

<div class="topic-metadata">

**Author:** [@cdomenig](https://discourse.julialang.org/u/cdomenig)\
**Replies:** 3\
**Last updated:** [September 26, 2023, 8:11am UTC](https://discourse.julialang.org/t/how-to-continue-for-loop-even-if-model-is-infeasible/104219 "2023-09-26T08:11:24Z")

</div>

Hi everybody, I am currently running a MILP model in a for loop, where I am trying out around 800 different parameter combinations (a kind of sensivity analysis). Sometimes the model doesn’t find a feasible solutions (t…

---

## [How does the Octeract engine compare to Alpine?](https://discourse.julialang.org/t/how-does-the-octeract-engine-compare-to-alpine/104231)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 3\
**Last updated:** [September 26, 2023, 5:19am UTC](https://discourse.julialang.org/t/how-does-the-octeract-engine-compare-to-alpine/104231 "2023-09-26T05:19:14Z")

</div>

The octeract engine solved 100% of the Mittelmann MINLP benchmark. It is a commercial software. We have a free MINLP solver called Alpine. How do they compare? As a side note, why doesn’t JuMP list octeract as a com…

---

## [HiGHS Error: No invertible representation for getDualRay](https://discourse.julialang.org/t/highs-error-no-invertible-representation-for-getdualray/101372)

<div class="topic-metadata">

**Author:** [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Replies:** 16\
**Last updated:** [September 26, 2023, 2:48am UTC](https://discourse.julialang.org/t/highs-error-no-invertible-representation-for-getdualray/101372 "2023-09-26T02:48:57Z")

</div>

I get an error when I try to solve a feasibility problem in JuMP using HiGHS. I use Julia v1.9.1 with the Julia packages JuMP v1.12.0 and HiGHS v1.5.2. $ julia JuMP\_solve.jl Running HiGHS 1.5.3 \[date: 1970-01-01, git ha…

---

## [Creating Matrix Parameters in JuMP](https://discourse.julialang.org/t/creating-matrix-parameters-in-jump/104159)

<div class="topic-metadata">

**Author:** [@Three](https://discourse.julialang.org/u/Three)\
**Replies:** 3\
**Last updated:** [September 24, 2023, 6:05pm UTC](https://discourse.julialang.org/t/creating-matrix-parameters-in-jump/104159 "2023-09-24T18:05:46Z")

</div>

Hello, Sorry if this is a dumb question, but I can’t figure out how to declare a matrix (or higher dimensional array) variable that is constrained to a parameter set in JuMP, as shown for the vector case here: Variables…

---

## [How do I make sure my optimization problem doesn’t get NP-hard?](https://discourse.julialang.org/t/how-do-i-make-sure-my-optimization-problem-doesn-t-get-np-hard/104190)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 1\
**Last updated:** [September 24, 2023, 6:32am UTC](https://discourse.julialang.org/t/how-do-i-make-sure-my-optimization-problem-doesn-t-get-np-hard/104190 "2023-09-24T06:32:57Z")

</div>

It’s quite easy to get some NP-hard instance of a problem, for example… maximize ax1^2 + bx1x2 + cx1x3 + … somethingx2x3 + somethingx2x4 + … Subject to all variables between some values and some values… Alone is NP ha…

---

## [Lyapunov + Symmetries = Infeasible, Lyapunov - Symmetries = Feasible](https://discourse.julialang.org/t/lyapunov-symmetries-infeasible-lyapunov-symmetries-feasible/101585)

<div class="topic-metadata">

**Author:** [@ilovemath](https://discourse.julialang.org/u/ilovemath)\
**Replies:** 9\
**Last updated:** [September 22, 2023, 11:21pm UTC](https://discourse.julialang.org/t/lyapunov-symmetries-infeasible-lyapunov-symmetries-feasible/101585 "2023-09-22T23:21:44Z")

</div>

Hi again @blegat @abulak I am using SOS programming to find a Lyapunov function, obeying some natural symmetry. The time derivative of V also obeys said symmetry. The feasibility of the Lyapunov function is dependent …

---

## [ERROR VariableNotOwned{VariableRef} when using add\_constraint](https://discourse.julialang.org/t/error-variablenotowned-variableref-when-using-add-constraint/104043)

<div class="topic-metadata">

**Author:** [@Luiz\_Monteiro](https://discourse.julialang.org/u/Luiz_Monteiro)\
**Replies:** 3\
**Last updated:** [September 21, 2023, 9:26pm UTC](https://discourse.julialang.org/t/error-variablenotowned-variableref-when-using-add-constraint/104043 "2023-09-21T21:26:33Z")

</div>

Hi, I am tryng to solve a MIP model (VRP) by solving a relaxed version of the model and repeatedly identifying violated contraints and adding those contraints to the model using add\_constraint(model1, cons). But I get …

---

## [BilevelJuMP and Lazy cns with Gurobi](https://discourse.julialang.org/t/bileveljump-and-lazy-cns-with-gurobi/104060)

<div class="topic-metadata">

**Author:** [@Fabrizio](https://discourse.julialang.org/u/Fabrizio)\
**Replies:** 1\
**Last updated:** [September 20, 2023, 8:25pm UTC](https://discourse.julialang.org/t/bileveljump-and-lazy-cns-with-gurobi/104060 "2023-09-20T20:25:00Z")

</div>

I repost this here for conveniece Dear all, when using pure Jump model i exensively use the lazy attribute with some cns using Gurobi as a solver with the syntiax MOI.set(MyMod, Gurobi.ConstraintAttribute(“Lazy”), Cn…

---

## [Does SCIP.jl use PaPILO for presolve by default?](https://discourse.julialang.org/t/does-scip-jl-use-papilo-for-presolve-by-default/104046)

<div class="topic-metadata">

**Author:** [@convexhull](https://discourse.julialang.org/u/convexhull)\
**Replies:** 3\
**Last updated:** [September 20, 2023, 6:20am UTC](https://discourse.julialang.org/t/does-scip-jl-use-papilo-for-presolve-by-default/104046 "2023-09-20T06:20:40Z")

</div>

I’m using SCIP and JuMP to solve a MILP and I’m interested in using PaPILO to see if it can help to strengthen my formulation. I’ve never used PaPILO before. SCIP’s solve output shows a presolve step, but I’m unsure wha…

---

## [Solving multiple similar problems in JuMP](https://discourse.julialang.org/t/solving-multiple-similar-problems-in-jump/103980)

<div class="topic-metadata">

**Author:** [@Three](https://discourse.julialang.org/u/Three)\
**Replies:** 8\
**Last updated:** [September 19, 2023, 9:13pm UTC](https://discourse.julialang.org/t/solving-multiple-similar-problems-in-jump/103980 "2023-09-19T21:13:33Z")

</div>

Hello, I’m interested in using JuMP to solve series of (all nonlinear) problems with identical constraints but different objectives. Is it possible to speed this up over the naive approach of just defining each problem …

---

## [Print all ellements of a variable-vector in once (broadcasting)](https://discourse.julialang.org/t/print-all-ellements-of-a-variable-vector-in-once-broadcasting/103884)

<div class="topic-metadata">

**Author:** [@Fabian1](https://discourse.julialang.org/u/Fabian1)\
**Replies:** 5\
**Last updated:** [September 15, 2023, 10:58pm UTC](https://discourse.julialang.org/t/print-all-ellements-of-a-variable-vector-in-once-broadcasting/103884 "2023-09-15T22:58:05Z")

</div>

Hi, I’ve just started with Julia, and I would like to print each element of a vector in one time for a variable (see line 37) in my optimization model under JuMP. It is already working for a defined parameter (D, see li…

---

## [Getting the upper bound of an objective function (MILP with HiGHS)](https://discourse.julialang.org/t/getting-the-upper-bound-of-an-objective-function-milp-with-highs/103890)

<div class="topic-metadata">

**Author:** [@cf357](https://discourse.julialang.org/u/cf357)\
**Replies:** 4\
**Last updated:** [September 15, 2023, 5:02pm UTC](https://discourse.julialang.org/t/getting-the-upper-bound-of-an-objective-function-milp-with-highs/103890 "2023-09-15T17:02:47Z")

</div>

I’m working on an assignment problem where the solver maximizes @objective(model, Max, sum(B\[u\] for u in U)) where B is a binary vector of entities satisfying some conditions in the assignment plan A\[u, f, t\], which de…

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

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