# Optimization (Mathematical)

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

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

**Page:** 36

---

## [Time to find the first feasible integer solution with JuMP](https://discourse.julialang.org/t/time-to-find-the-first-feasible-integer-solution-with-jump/106693)

<div class="topic-metadata">

**Author:** [@baprata](https://discourse.julialang.org/u/baprata)\
**Replies:** 2\
**Last updated:** [November 24, 2023, 11:05pm UTC](https://discourse.julialang.org/t/time-to-find-the-first-feasible-integer-solution-with-jump/106693 "2023-11-24T23:05:10Z")

</div>

I am solving a mixed-integer linear programming model with JuMP and CPLEX. How could I measure the time required to find the first feasible integer solution? Best regards, Bruno

---

## [Converting non-linear optimization with fmincom from Matlab to Julia](https://discourse.julialang.org/t/converting-non-linear-optimization-with-fmincom-from-matlab-to-julia/106536)

<div class="topic-metadata">

**Author:** [@Alfespo97](https://discourse.julialang.org/u/Alfespo97)\
**Replies:** 12\
**Last updated:** [November 23, 2023, 5:23pm UTC](https://discourse.julialang.org/t/converting-non-linear-optimization-with-fmincom-from-matlab-to-julia/106536 "2023-11-23T17:23:11Z")

</div>

Hi, I’m new to Julia language and I’m trying to replicate an optimization function created in Matlab using fmincom in Julia in order to improve the computation time that is quite huge in Matlab. I’ve used the JuMP mode…

---

## [Optimization ADType](https://discourse.julialang.org/t/optimization-adtype/106587)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 2\
**Last updated:** [November 22, 2023, 6:55pm UTC](https://discourse.julialang.org/t/optimization-adtype/106587 "2023-11-22T18:55:37Z")

</div>

What do I do wrong julia\> import Pkg julia\> Pkg.activate(;temp=true) Activating new project at \`C:\\Users\\LOCAL\_~4\\Temp\\jl\_cF3P4l\` (jl\_cF3P4l) pkg\> add Optimization, ForwardDiff ... \[f6369f11\] + ForwardDiff v0.10.36…

---

## [Unexpected array VariableRef\[c\[1\] c\[2\] c\[3\]\] in nonlinear expression](https://discourse.julialang.org/t/unexpected-array-variableref-c-1-c-2-c-3-in-nonlinear-expression/106419)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 6\
**Last updated:** [November 19, 2023, 8:55pm UTC](https://discourse.julialang.org/t/unexpected-array-variableref-c-1-c-2-c-3-in-nonlinear-expression/106419 "2023-11-19T20:55:29Z")

</div>

Code: function b̂ₜfunc( x̂ₜ₊₁::AbstractVector, Σ̂ₜ₊₁::AbstractMatrix, γ::AbstractFloat, ξ::AbstractFloat, b̂ₜ::AbstractVector ) n\_assets = length(x̂ₜ₊₁) model = Model(optimizer\_with\_attributes(Ipopt.Optimi…

---

## [Minimizing a untidy multiparam function](https://discourse.julialang.org/t/minimizing-a-untidy-multiparam-function/106132)

<div class="topic-metadata">

**Author:** [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Replies:** 6\
**Last updated:** [November 14, 2023, 3:43am UTC](https://discourse.julialang.org/t/minimizing-a-untidy-multiparam-function/106132 "2023-11-14T03:43:31Z")

</div>

I have an untidy objective function that takes 4 vectors (34, 120, 120, 120 floats) and evaluates to a float, and an slow update function (~2 secs) that takes the same 4 vectors, alters and returns them. There is little …

---

## [Interpolation](https://discourse.julialang.org/t/interpolation/106382)

<div class="topic-metadata">

**Author:** [@Sorooshsa](https://discourse.julialang.org/u/Sorooshsa)\
**Replies:** 7\
**Last updated:** [November 18, 2023, 6:47am UTC](https://discourse.julialang.org/t/interpolation/106382 "2023-11-18T06:47:53Z")

</div>

Hi, I am suing simple interpolation within a optimization problem by interpolation.jl I have a 3\*3 grid value matrix Val\_grid. Then I implemented this simple code: i\_values = \[1.0, 1.2, 1.3\] j\_values = \[1.0, 1.2, 1.3…

---

## [How to call Gurobi solver?](https://discourse.julialang.org/t/how-to-call-gurobi-solver/106351)

<div class="topic-metadata">

**Author:** [@Kaiming\_Zhang](https://discourse.julialang.org/u/Kaiming_Zhang)\
**Replies:** 1\
**Last updated:** [November 17, 2023, 8:23am UTC](https://discourse.julialang.org/t/how-to-call-gurobi-solver/106351 "2023-11-17T08:23:22Z")

</div>

When I called Gurobi (v1.1.0) with the following code, m\_cvx = Model(optimizer\_with\_attributes(Gurobi.Optimizer,GRB\_ENV,“OutputFlag”=\>0)) it fails with methoderror. MethodError: no method matching optimizer\_with\_att…

---

## [SOS constraints in LP file throwing \`Malformed SOS constraint\` error](https://discourse.julialang.org/t/sos-constraints-in-lp-file-throwing-malformed-sos-constraint-error/106324)

<div class="topic-metadata">

**Author:** [@hdavid16](https://discourse.julialang.org/u/hdavid16)\
**Replies:** 3\
**Last updated:** [November 16, 2023, 7:13pm UTC](https://discourse.julialang.org/t/sos-constraints-in-lp-file-throwing-malformed-sos-constraint-error/106324 "2023-11-16T19:13:29Z")

</div>

I have a large .lp file exported from CPLEX that I want to read into JuMP with read\_from\_file. However, the SOS constraints are defined in 2 lines each: s3: S1 :: x : 1 y : 2 As a result, the parsing doesn’…

---

## [JuMP with Pajarito/Pavito for a simple MINLP fails with solver does not support MathOptInterface.ScalarNonlinearFunction](https://discourse.julialang.org/t/jump-with-pajarito-pavito-for-a-simple-minlp-fails-with-solver-does-not-support-mathoptinterface-scalarnonlinearfunction/106314)

<div class="topic-metadata">

**Author:** [@stephanmg](https://discourse.julialang.org/u/stephanmg)\
**Replies:** 5\
**Last updated:** [November 16, 2023, 7:05pm UTC](https://discourse.julialang.org/t/jump-with-pajarito-pavito-for-a-simple-minlp-fails-with-solver-does-not-support-mathoptinterface-scalarnonlinearfunction/106314 "2023-11-16T19:05:39Z")

</div>

Dear all, trying to set up a simple MINLP somehow fails for me with: MathOptInterface.ScalarNonlinearFunction Code: using JuMP using HiGHS using Pavito, Pajarito, Hypatia using LinearAlgebra import Ipopt, GLPK vector…

---

## [Using logical constraints with gurobi](https://discourse.julialang.org/t/using-logical-constraints-with-gurobi/106311)

<div class="topic-metadata">

**Author:** [@raian](https://discourse.julialang.org/u/raian)\
**Replies:** 3\
**Last updated:** [November 16, 2023, 6:57pm UTC](https://discourse.julialang.org/t/using-logical-constraints-with-gurobi/106311 "2023-11-16T18:57:35Z")

</div>

Hi, I’m trying to use logical constraints on JuMP, ex: x5 = x1 AND x3 AND x4 In the doc of gurobi, there is a function that directly construct this constraint without having to linearize it manually : model.addGenCon…

---

## [Julia suddenly stopped when using JuMP with Gurobi to solve](https://discourse.julialang.org/t/julia-suddenly-stopped-when-using-jump-with-gurobi-to-solve/106315)

<div class="topic-metadata">

**Author:** [@Z\_M](https://discourse.julialang.org/u/Z_M)\
**Replies:** 6\
**Last updated:** [November 16, 2023, 1:30pm UTC](https://discourse.julialang.org/t/julia-suddenly-stopped-when-using-jump-with-gurobi-to-solve/106315 "2023-11-16T13:30:59Z")

</div>

Hello! I have an optimization problem and I am using Gurobi solver through JuMP in Julia. In the process of solving this problem, it is necessary to constantly judge the solution add constraints, and then solve. Howeve…

---

## [When I upgrade one package, another package will be downgraded. How to solve this problem?](https://discourse.julialang.org/t/when-i-upgrade-one-package-another-package-will-be-downgraded-how-to-solve-this-problem/106292)

<div class="topic-metadata">

**Author:** [@wang\_ruoxu](https://discourse.julialang.org/u/wang_ruoxu)\
**Replies:** 2\
**Last updated:** [November 16, 2023, 6:19am UTC](https://discourse.julialang.org/t/when-i-upgrade-one-package-another-package-will-be-downgraded-how-to-solve-this-problem/106292 "2023-11-16T06:19:32Z")

</div>

When I upgrade SDDP@1.6.6,the will degrade ScenTrees@0.1.1，When I upgrade ScenTrees@0.3.3,the will degrade SDDP@0.4.6.What can I do to make both versions exist at the same time? I need to use these two packages at the s…

---

## [OutOfMemoryError() on large multicommodity flow model](https://discourse.julialang.org/t/outofmemoryerror-on-large-multicommodity-flow-model/106286)

<div class="topic-metadata">

**Author:** [@nemoincognito](https://discourse.julialang.org/u/nemoincognito)\
**Replies:** 3\
**Last updated:** [November 16, 2023, 1:30am UTC](https://discourse.julialang.org/t/outofmemoryerror-on-large-multicommodity-flow-model/106286 "2023-11-16T01:30:40Z")

</div>

I ran the code below: model = Model(HiGHS.Optimizer) # Generate a flow variable for each item in df\_flowslist1 which is ~500k items df\_flowslist1.x\_flow = @variable(model, x\[1:size(df\_flowslist1, 1)\] \>= 0) #generate a…

---

## [Unsatisfiable requirements detected: MultiObjectiveAlgorithms package](https://discourse.julialang.org/t/unsatisfiable-requirements-detected-multiobjectivealgorithms-package/106284)

<div class="topic-metadata">

**Author:** [@kiki](https://discourse.julialang.org/u/kiki)\
**Replies:** 3\
**Last updated:** [November 16, 2023, 12:48am UTC](https://discourse.julialang.org/t/unsatisfiable-requirements-detected-multiobjectivealgorithms-package/106284 "2023-11-16T00:48:15Z")

</div>

Hi, can you help me with the next question? I have tried to install import Pkg; Pkg.add(“MultiObjectiveAlgorithms”) But it doesn’t work, I get the message : (Before I have installed JuMP) Unsatisfiable requirements …

---

## [Info: GAMS has launched a new language (library and API) for python](https://discourse.julialang.org/t/info-gams-has-launched-a-new-language-library-and-api-for-python/106266)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [November 15, 2023, 7:41pm UTC](https://discourse.julialang.org/t/info-gams-has-launched-a-new-language-library-and-api-for-python/106266 "2023-11-15T19:41:06Z")

</div>

Just to share the news with you, it seems GAMS has reinvented itself today, throwing away its archaic and odd language with the launch of GAMSpy, a library (and API) to write and solve mathematical optimization models di…

---

## [Optim maximization](https://discourse.julialang.org/t/optim-maximization/106274)

<div class="topic-metadata">

**Author:** [@Longblackcoffee](https://discourse.julialang.org/u/Longblackcoffee)\
**Replies:** 1\
**Last updated:** [November 15, 2023, 6:49pm UTC](https://discourse.julialang.org/t/optim-maximization/106274 "2023-11-15T18:49:58Z")

</div>

Hi everyone, I want to find the maximum of a function with the Optim.jl package, but I keep getting a DomainError. (I think Optim is trying to evaluate the log of a negative number) using Optim, Interpolations α = 0.4…

---

## [Cache results between function calls in Optimization.jl](https://discourse.julialang.org/t/cache-results-between-function-calls-in-optimization-jl/94964)

<div class="topic-metadata">

**Author:** [@verflieger](https://discourse.julialang.org/u/verflieger)\
**Replies:** 11\
**Last updated:** [May 1, 2023, 8:26pm UTC](https://discourse.julialang.org/t/cache-results-between-function-calls-in-optimization-jl/94964 "2023-05-01T20:26:28Z")

</div>

I want to use a cost function and constraints depending on the solution of an ODE. This is costly to evaluate and hence I’d like to cache the result for function calls with the same parameters. For that, I wanted to use …

---

## [Optim.jl not honoring convergence criteria](https://discourse.julialang.org/t/optim-jl-not-honoring-convergence-criteria/105723)

<div class="topic-metadata">

**Author:** [@Gbenga\_Fabusola](https://discourse.julialang.org/u/Gbenga_Fabusola)\
**Replies:** 6\
**Last updated:** [November 15, 2023, 11:18am UTC](https://discourse.julialang.org/t/optim-jl-not-honoring-convergence-criteria/105723 "2023-11-15T11:18:41Z")

</div>

I am trying to incorporate an early stopping to my code using Optim.jl but the specifications are not followed and I was hoping someone might know why. I have an example of this here. function toy(X) x, y = X cost = …

---

## [NLsolve problem](https://discourse.julialang.org/t/nlsolve-problem/106222)

<div class="topic-metadata">

**Author:** [@GianmarcoPreso](https://discourse.julialang.org/u/GianmarcoPreso)\
**Replies:** 5\
**Last updated:** [November 15, 2023, 9:53am UTC](https://discourse.julialang.org/t/nlsolve-problem/106222 "2023-11-15T09:53:57Z")

</div>

Hi all! I’m new in Julia. I have to solve a non-linear equation, and I have found the NLsolve package. function coolebrok(fric\_fact) 1 ./sqrt(fric\_fact\[:\]) + 2\*log10(epsilon./. (3.7.\*DD) + 2.51./(sqrt(fric\_fact\[:\]).\*m…

---

## [PaPILO for JuMP Presolver](https://discourse.julialang.org/t/papilo-for-jump-presolver/106169)

<div class="topic-metadata">

**Author:** [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Replies:** 1\
**Last updated:** [November 14, 2023, 1:09am UTC](https://discourse.julialang.org/t/papilo-for-jump-presolver/106169 "2023-11-14T01:09:01Z")

</div>

Are there plans to add PaPILO as a LP/MILP presolver for JuMP? Since PaPILO is sometimes able to detect infeasibility, it may also be viewed as a partial LP & MILP solver.

---

## [JuMP: User defined functions with vector inputs and outputs](https://discourse.julialang.org/t/jump-user-defined-functions-with-vector-inputs-and-outputs/106025)

<div class="topic-metadata">

**Author:** [@A\_C](https://discourse.julialang.org/u/A_C)\
**Replies:** 5\
**Last updated:** [November 13, 2023, 4:10am UTC](https://discourse.julialang.org/t/jump-user-defined-functions-with-vector-inputs-and-outputs/106025 "2023-11-13T04:10:13Z")

</div>

In the JuMP documentation it is mentioned that functions with vector inputs and outputs require a workaround. However the following example works: MWEusing JuMP import Ipopt mwe = Model(Ipopt.Optimizer) @variable(mwe,…

---

## [Warm start using Dualization with JuMP and COSMO](https://discourse.julialang.org/t/warm-start-using-dualization-with-jump-and-cosmo/106006)

<div class="topic-metadata">

**Author:** [@akirakyle](https://discourse.julialang.org/u/akirakyle)\
**Replies:** 5\
**Last updated:** [November 12, 2023, 10:25am UTC](https://discourse.julialang.org/t/warm-start-using-dualization-with-jump-and-cosmo/106006 "2023-11-12T10:25:56Z")

</div>

I’m using the same example here as in my previous question about warm starting of HermitianPSDCone: using JuMP, LinearAlgebra, COSMO, Dualization function set\_hermitian\_start(x, start) for j in 1:size(x, 2), i in 1…

---

## [Expressions vs Variables+Constraints in JuMP models](https://discourse.julialang.org/t/expressions-vs-variables-constraints-in-jump-models/105979)

<div class="topic-metadata">

**Author:** [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Replies:** 6\
**Last updated:** [November 10, 2023, 8:24pm UTC](https://discourse.julialang.org/t/expressions-vs-variables-constraints-in-jump-models/105979 "2023-11-10T20:24:14Z")

</div>

Hello, and sorry for the naive question (optimization is not my primary field of expertise). And sorry if this is already discussed in the documentation; I didn’t see it. It seems to me that “expressions” in JuMP could …

---

## [Objective function value mysteriously negative with StochasticPrograms.jl](https://discourse.julialang.org/t/objective-function-value-mysteriously-negative-with-stochasticprograms-jl/106016)

<div class="topic-metadata">

**Author:** [@matt\_w](https://discourse.julialang.org/u/matt_w)\
**Replies:** 3\
**Last updated:** [November 9, 2023, 10:10pm UTC](https://discourse.julialang.org/t/objective-function-value-mysteriously-negative-with-stochasticprograms-jl/106016 "2023-11-09T22:10:28Z")

</div>

I am trying out Julia to model a stochastic network interdiction problem with the code below, where the objective of the first stage is to minimize the expected value of the second stage. However, I’ve encountered two (p…

---

## [Tons of nodes in the Policy Graph, SDDP.jl package](https://discourse.julialang.org/t/tons-of-nodes-in-the-policy-graph-sddp-jl-package/103426)

<div class="topic-metadata">

**Author:** [@Sorooshsa](https://discourse.julialang.org/u/Sorooshsa)\
**Replies:** 20\
**Last updated:** [November 8, 2023, 1:33am UTC](https://discourse.julialang.org/t/tons-of-nodes-in-the-policy-graph-sddp-jl-package/103426 "2023-11-08T01:33:24Z")

</div>

Hello everyone, Lately, I’ve been working on a hydropower expansion problem using the SDDP method and the SDDP.jl tools. Here are the most important things to understand about this problem: The horizon plan is for 5 …

---

## [Multiple solve, same script](https://discourse.julialang.org/t/multiple-solve-same-script/105874)

<div class="topic-metadata">

**Author:** [@martina.gherardi](https://discourse.julialang.org/u/martina.gherardi)\
**Replies:** 10\
**Last updated:** [November 7, 2023, 1:56pm UTC](https://discourse.julialang.org/t/multiple-solve-same-script/105874 "2023-11-07T13:56:47Z")

</div>

Hi, I would like to ask a question about the JuMP’s internal procedure for solving similar problems in the same script. I follow these steps: Write a model called MyMod Call optimize!(MyMod) to solve it Add some cons…

---

## [Piecewise function as a constraint on Julia JuMP](https://discourse.julialang.org/t/piecewise-function-as-a-constraint-on-julia-jump/105854)

<div class="topic-metadata">

**Author:** [@Jesper](https://discourse.julialang.org/u/Jesper)\
**Replies:** 1\
**Last updated:** [November 6, 2023, 8:56pm UTC](https://discourse.julialang.org/t/piecewise-function-as-a-constraint-on-julia-jump/105854 "2023-11-06T20:56:39Z")

</div>

I have an optimization model to which I need to add the following piecewise function as a constraint: C\_{i,k} = { PR\_{i} \* HSE\_{k} i∈Ω, k = 1,…,M , 1 i∈Ω, k = 1,…,M (otherwise) I read PR and HSE from excel cells ¿Is …

---

## [Writting runge-kutta stages as an array of expression](https://discourse.julialang.org/t/writting-runge-kutta-stages-as-an-array-of-expression/105817)

<div class="topic-metadata">

**Author:** [@lieskjur](https://discourse.julialang.org/u/lieskjur)\
**Replies:** 2\
**Last updated:** [November 5, 2023, 7:24pm UTC](https://discourse.julialang.org/t/writting-runge-kutta-stages-as-an-array-of-expression/105817 "2023-11-05T19:24:39Z")

</div>

Hi, I am writting a trajectory optimization scheme and for very specific reasons I want to constrain the change from state x\_j to x\_{j+1} to be a step of a runge-kutta method (I know multi-step methods would be more suit…

---

## [Multi-objective MINLP problem in JuMP](https://discourse.julialang.org/t/multi-objective-minlp-problem-in-jump/103117)

<div class="topic-metadata">

**Author:** [@ashefa](https://discourse.julialang.org/u/ashefa)\
**Replies:** 38\
**Last updated:** [November 4, 2023, 8:44am UTC](https://discourse.julialang.org/t/multi-objective-minlp-problem-in-jump/103117 "2023-11-04T08:44:23Z")

</div>

In the continuation of this comment and this post, I was wondering about the implementation of a multi-objective MINLP problem in JuMP using MOA. Since @Arpit\_Bhatia used MOA for a nonlinear multi-objective portfolio op…

---

## [Looking for an Exact LP Solver](https://discourse.julialang.org/t/looking-for-an-exact-lp-solver/105696)

<div class="topic-metadata">

**Author:** [@isaac.rubberducky](https://discourse.julialang.org/u/isaac.rubberducky)\
**Replies:** 8\
**Last updated:** [November 3, 2023, 1:48pm UTC](https://discourse.julialang.org/t/looking-for-an-exact-lp-solver/105696 "2023-11-03T13:48:36Z")

</div>

I have an algorithm that iteratively runs an LP until a stability condition is met. It is guaranteed to stabilize in theory, and in practice it almost always does as well. However, sometimes the rounding error generated …

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

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