# Optimization (Mathematical)

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

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

**Page:** 28

---

## [How to get a feasible point of an arbitrary optimization model?](https://discourse.julialang.org/t/how-to-get-a-feasible-point-of-an-arbitrary-optimization-model/112513)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 8\
**Last updated:** [April 18, 2024, 7:44pm UTC](https://discourse.julialang.org/t/how-to-get-a-feasible-point-of-an-arbitrary-optimization-model/112513 "2024-04-18T19:44:10Z")

</div>

How to get a feasible point if the optimization model is not infeasible? If the model has no objective, I can do this by: using JuMP, HiGHS m = Model(HiGHS.Optimizer) @variable(m, x \<= 1) optimize!(m) value(x) But if …

---

## [There are currently 0 solution(s) in the model](https://discourse.julialang.org/t/there-are-currently-0-solution-s-in-the-model/113072)

<div class="topic-metadata">

**Author:** [@IgorESMelo](https://discourse.julialang.org/u/IgorESMelo)\
**Replies:** 1\
**Last updated:** [April 17, 2024, 9:11pm UTC](https://discourse.julialang.org/t/there-are-currently-0-solution-s-in-the-model/113072 "2024-04-17T21:11:47Z")

</div>

Hy everyone, I’m trying to solve an allocation problem. I have two objectives: (i) maximize the shift resiliences on a planning horizon and (ii) minimize the resilience variance across the shifts. So I coded the model …

---

## [\`HiGHS.jl\` gives strange results](https://discourse.julialang.org/t/highs-jl-gives-strange-results/112995)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 3\
**Last updated:** [April 16, 2024, 10:02pm UTC](https://discourse.julialang.org/t/highs-jl-gives-strange-results/112995 "2024-04-16T22:02:02Z")

</div>

using JuMP, HiGHS ## Case-1 M1 = Model(HiGHS.Optimizer) @variable(M1, d\[1:2\]) g1 = @expression(M1, (1/100) \* (d\[1\] - 1)) g2 = @expression(M1, (1/100) \* (d\[2\] - 2)) @constraint(M1, 0 \<= g1 \<= 1) @constraint(M1, 0 \<= g2 \<=…

---

## [Speed up JuMP.jl Estimation When Jacobian and Hessian of Constraints are Sparse](https://discourse.julialang.org/t/speed-up-jump-jl-estimation-when-jacobian-and-hessian-of-constraints-are-sparse/112981)

<div class="topic-metadata">

**Author:** [@Strange\_Xue](https://discourse.julialang.org/u/Strange_Xue)\
**Replies:** 6\
**Last updated:** [April 16, 2024, 11:08am UTC](https://discourse.julialang.org/t/speed-up-jump-jl-estimation-when-jacobian-and-hessian-of-constraints-are-sparse/112981 "2024-04-16T11:08:20Z")

</div>

Hi guys, in last questions (link is shown below), I asked how to supply gradient of objective and jacobian of constraints in nonlinear optimization. But @odow told me I dont have to do that because JuMP.jl will automatic…

---

## [Error when using MKLDirectSolver in SCS](https://discourse.julialang.org/t/error-when-using-mkldirectsolver-in-scs/112982)

<div class="topic-metadata">

**Author:** [@charshaw](https://discourse.julialang.org/u/charshaw)\
**Replies:** 2\
**Last updated:** [April 15, 2024, 11:20pm UTC](https://discourse.julialang.org/t/error-when-using-mkldirectsolver-in-scs/112982 "2024-04-15T23:20:59Z")

</div>

I am using JuMP and calling SCS as a solver. I want to use SCS.MKLDirectSolver, as discussed in an earlier thread. As discussed on the SCS.jl README page, this requires using the package SCS\_MKL\_jll. But, I’m getting an…

---

## [JuMP.jl: Supplying gradient of objective and jacobian of constraints in Nonlinear Optimization](https://discourse.julialang.org/t/jump-jl-supplying-gradient-of-objective-and-jacobian-of-constraints-in-nonlinear-optimization/106940)

<div class="topic-metadata">

**Author:** [@Strange\_Xue](https://discourse.julialang.org/u/Strange_Xue)\
**Replies:** 12\
**Last updated:** [April 15, 2024, 9:14pm UTC](https://discourse.julialang.org/t/jump-jl-supplying-gradient-of-objective-and-jacobian-of-constraints-in-nonlinear-optimization/106940 "2024-04-15T21:14:31Z")

</div>

Hi, I am faced with a troublesome optimization problem. As shown below, the non-linear optimization problem is easy to model and solve via Ipopt with JuMP.jl as interface. However, the objective function and constraints…

---

## [Optimization with LBFGS gives DimensionMismatch("dimensions must match")](https://discourse.julialang.org/t/optimization-with-lbfgs-gives-dimensionmismatch-dimensions-must-match/22167)

<div class="topic-metadata">

**Author:** [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)\
**Replies:** 9\
**Last updated:** [April 14, 2024, 7:39pm UTC](https://discourse.julialang.org/t/optimization-with-lbfgs-gives-dimensionmismatch-dimensions-must-match/22167 "2024-04-14T19:39:36Z")

</div>

My objective function has to solve an ODE. When I use the gradient-free algorithm (e.g NelderMead) to do optimization, everything is OK. But with gradient-based (e.g. LBFGS) I get the error: DimensionMismatch(“dimension…

---

## [Using \`bboptimize\` with a function containing \`JuMP\` calls](https://discourse.julialang.org/t/using-bboptimize-with-a-function-containing-jump-calls/112846)

<div class="topic-metadata">

**Author:** [@Rick](https://discourse.julialang.org/u/Rick)\
**Replies:** 2\
**Last updated:** [April 14, 2024, 6:52am UTC](https://discourse.julialang.org/t/using-bboptimize-with-a-function-containing-jump-calls/112846 "2024-04-14T06:52:53Z")

</div>

Hi everyone, I am trying blackbox optimization with a function that contains JuMP functions. So, this is like a nested optimization where the “inner problem” is evaluated using JuMP functions and the “outer problem” is …

---

## [Optimization, from MATLAB to Julia](https://discourse.julialang.org/t/optimization-from-matlab-to-julia/111212)

<div class="topic-metadata">

**Author:** [@cu2mauro](https://discourse.julialang.org/u/cu2mauro)\
**Replies:** 10\
**Last updated:** [April 13, 2024, 11:43am UTC](https://discourse.julialang.org/t/optimization-from-matlab-to-julia/111212 "2024-04-13T11:43:23Z")

</div>

Hi there! I am fairly new to Julia, I was converted after seeing some awesome performance compared to MATLAB, which I currently use. I tried rewriting in Julia an optimization problem that I had in MATLAB, and everythin…

---

## [ExaModels.jl and MadNLP.jl on GPUs](https://discourse.julialang.org/t/examodels-jl-and-madnlp-jl-on-gpus/111377)

<div class="topic-metadata">

**Author:** [@sshin23](https://discourse.julialang.org/u/sshin23)\
**Replies:** 0\
**Last updated:** [March 8, 2024, 8:09pm UTC](https://discourse.julialang.org/t/examodels-jl-and-madnlp-jl-on-gpus/111377 "2024-03-08T20:09:16Z")

</div>

ExaModels and MadNLP: Solving Large-Scale Nonlinear Programs on GPUs We are pleased to announce that ExaModels v0.6 and MadNLP v0.8 now have full support for solving large, sparse, constrained nonlinear programs on NVIDI…

---

## [Calculating duals with SOS2 constraints](https://discourse.julialang.org/t/calculating-duals-with-sos2-constraints/112831)

<div class="topic-metadata">

**Author:** [@RuaridhMacd](https://discourse.julialang.org/u/RuaridhMacd)\
**Replies:** 2\
**Last updated:** [April 12, 2024, 2:24am UTC](https://discourse.julialang.org/t/calculating-duals-with-sos2-constraints/112831 "2024-04-12T02:24:51Z")

</div>

Hi, I am working with a model in JuMP and Gurobi which is usually a LP or MILP. I have added a set of SOS2 constraints to create a piecewise linear function. Gurobi successfully reformulates the constraints to avoid nee…

---

## [Count Binary Variables in JuMP Model](https://discourse.julialang.org/t/count-binary-variables-in-jump-model/87232)

<div class="topic-metadata">

**Author:** [@chelseas](https://discourse.julialang.org/u/chelseas)\
**Replies:** 4\
**Last updated:** [April 12, 2024, 12:30am UTC](https://discourse.julialang.org/t/count-binary-variables-in-jump-model/87232 "2024-04-12T00:30:24Z")

</div>

What is the proper way to count binary variables in my jump model? I have been using: MathOptInterface = MOI const\_types = list\_of\_constraint\_types(model) n\_bin = 0 n\_lin = 0 for i = 1:length(const\_typ…

---

## [JuMP, large expression, and hessian "limited-memory" option in Ipopt](https://discourse.julialang.org/t/jump-large-expression-and-hessian-limited-memory-option-in-ipopt/112609)

<div class="topic-metadata">

**Author:** [@niro](https://discourse.julialang.org/u/niro)\
**Replies:** 8\
**Last updated:** [April 9, 2024, 10:04pm UTC](https://discourse.julialang.org/t/jump-large-expression-and-hessian-limited-memory-option-in-ipopt/112609 "2024-04-09T22:04:09Z")

</div>

Hi all, I have a question regarding JuMP, which I try to use to solve an optimal control problem. For this problem, I have to generate a quite complicated function using symbolic computations. Then, I build a nonlinear @…

---

## [Custom recorder on stages with different constraints](https://discourse.julialang.org/t/custom-recorder-on-stages-with-different-constraints/112718)

<div class="topic-metadata">

**Author:** [@FelixSchmidt](https://discourse.julialang.org/u/FelixSchmidt)\
**Replies:** 2\
**Last updated:** [April 9, 2024, 9:19pm UTC](https://discourse.julialang.org/t/custom-recorder-on-stages-with-different-constraints/112718 "2024-04-09T21:19:59Z")

</div>

Hi Oscar, I’ve been having issues with creating a custom recorder in SDDP.simulate. I have a capacity expansion problem where stage 1 covers the investment decision and stages 2,…T are monthly dispatch problems at hourl…

---

## [Accessing dual variables](https://discourse.julialang.org/t/accessing-dual-variables/112719)

<div class="topic-metadata">

**Author:** [@heiwie](https://discourse.julialang.org/u/heiwie)\
**Replies:** 2\
**Last updated:** [April 9, 2024, 7:44pm UTC](https://discourse.julialang.org/t/accessing-dual-variables/112719 "2024-04-09T19:44:54Z")

</div>

I am wondering how I can name constraints I define in a for-loop so I later could access the dual variables. My code is the following: for (m, parentnode) in enumerate(lattice\_edges\[2\]) for (n, childnode) in enumera…

---

## [Problem with JuMP + Gurobi.jl](https://discourse.julialang.org/t/problem-with-jump-gurobi-jl/111505)

<div class="topic-metadata">

**Author:** [@njozefow](https://discourse.julialang.org/u/njozefow)\
**Replies:** 7\
**Last updated:** [April 9, 2024, 1:36pm UTC](https://discourse.julialang.org/t/problem-with-jump-gurobi-jl/111505 "2024-04-09T13:36:03Z")

</div>

Hello, In continuation of the thread : Poor time performance in modifying parameters of JuMP models when using Gurobi - #10 by odow Here is a code that show the behavior (it emulates the behavior of a column generation…

---

## [SumOfSquares on a variety, inspecting the multipliers](https://discourse.julialang.org/t/sumofsquares-on-a-variety-inspecting-the-multipliers/112574)

<div class="topic-metadata">

**Author:** [@votroto](https://discourse.julialang.org/u/votroto)\
**Replies:** 6\
**Last updated:** [April 9, 2024, 12:54pm UTC](https://discourse.julialang.org/t/sumofsquares-on-a-variety-inspecting-the-multipliers/112574 "2024-04-09T12:54:30Z")

</div>

Is it possible with SumOfSquares to inspect the multipliers of the polynomial decomposition? Let’s say I have a poly p and I wish to maximize it over a variety F defined by polys f\_i,..,f\_n. I assume internally the cons…

---

## [SoPlex from JuMP ? (available through SCIP ?)](https://discourse.julialang.org/t/soplex-from-jump-available-through-scip/112117)

<div class="topic-metadata">

**Author:** [@JonT](https://discourse.julialang.org/u/JonT)\
**Replies:** 3\
**Last updated:** [April 9, 2024, 7:08am UTC](https://discourse.julialang.org/t/soplex-from-jump-available-through-scip/112117 "2024-04-09T07:08:09Z")

</div>

I have a problem for which there is a recursive branch and bound algorithm using exact arithmetic in a simplex solver (QSopt\_ex). It is very slow even for small problems, and I was hoping to explore a heuristic to improv…

---

## [Have an strange error creating optimization subproblems on Julia](https://discourse.julialang.org/t/have-an-strange-error-creating-optimization-subproblems-on-julia/112692)

<div class="topic-metadata">

**Author:** [@benjamin.nunez](https://discourse.julialang.org/u/benjamin.nunez)\
**Replies:** 5\
**Last updated:** [April 9, 2024, 5:27am UTC](https://discourse.julialang.org/t/have-an-strange-error-creating-optimization-subproblems-on-julia/112692 "2024-04-09T05:27:53Z")

</div>

Hello! I’m experiencing a rather strange problem in Julia when creating optimization subproblems. Basically I have a function called “build\_subproblem(s)” which depends on a scenario “s” and formulates an optimization p…

---

## [PEtab with MethodOfLines](https://discourse.julialang.org/t/petab-with-methodoflines/112647)

<div class="topic-metadata">

**Author:** [@kkakosim](https://discourse.julialang.org/u/kkakosim)\
**Replies:** 4\
**Last updated:** [April 8, 2024, 4:23am UTC](https://discourse.julialang.org/t/petab-with-methodoflines/112647 "2024-04-08T04:23:47Z")

</div>

Any examples utilizing PEtab.jl for parameter fitting with MethodOfLines.jl? If not, then could an ODESystem be (re)constructed from an ODEProblem or a PDESystem?

---

## [Understanding variable orders in \`\`MOI.VariableIndex\`\` in JuMP](https://discourse.julialang.org/t/understanding-variable-orders-in-moi-variableindex-in-jump/112594)

<div class="topic-metadata">

**Author:** [@Maybe](https://discourse.julialang.org/u/Maybe)\
**Replies:** 1\
**Last updated:** [April 6, 2024, 5:37am UTC](https://discourse.julialang.org/t/understanding-variable-orders-in-moi-variableindex-in-jump/112594 "2024-04-06T05:37:06Z")

</div>

I am trying to understand the variable orders in MOI.VariableIndex. For example, in the following model m = Model() @variable(m, 0 \<= x\[i=1:2\] \<= 2 ) @variable(m, z) @variable(m, 0 \<= y\[i=1:3\] \<= 1) The outcome of …

---

## [Set\_normalized\_coefficient in JuMP.jl is slow](https://discourse.julialang.org/t/set-normalized-coefficient-in-jump-jl-is-slow/112533)

<div class="topic-metadata">

**Author:** [@PaterPen](https://discourse.julialang.org/u/PaterPen)\
**Replies:** 6\
**Last updated:** [April 5, 2024, 9:29pm UTC](https://discourse.julialang.org/t/set-normalized-coefficient-in-jump-jl-is-slow/112533 "2024-04-05T21:29:01Z")

</div>

Hi, I wonder why set\_normalized\_coefficient takes about as long as the actual optimization in my MWE: using JuMP, HiGHS function create\_solver(solver, l, C, d, lb) model = direct\_model(optimizer\_with\_attributes(sol…

---

## [MUMPS returned INFO(1) = -9 and requires more memory, reallocating](https://discourse.julialang.org/t/mumps-returned-info-1-9-and-requires-more-memory-reallocating/112466)

<div class="topic-metadata">

**Author:** [@Jack21](https://discourse.julialang.org/u/Jack21)\
**Replies:** 3\
**Last updated:** [April 3, 2024, 9:06pm UTC](https://discourse.julialang.org/t/mumps-returned-info-1-9-and-requires-more-memory-reallocating/112466 "2024-04-03T21:06:43Z")

</div>

Hello everyone! I have recently run into this message when using JuMP with the Ipopt solver. From what I can tell, it is due to MUMPS reaching its memory limit, and it changes a variable, which then slows down every ite…

---

## [Correct way to define vectorized variables and constraints with JuMP](https://discourse.julialang.org/t/correct-way-to-define-vectorized-variables-and-constraints-with-jump/112401)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 1\
**Last updated:** [April 2, 2024, 7:03pm UTC](https://discourse.julialang.org/t/correct-way-to-define-vectorized-variables-and-constraints-with-jump/112401 "2024-04-02T19:03:24Z")

</div>

using JuMP # Block1 M = Model() @variable(M, x\[1:3\] \>= 1) # Block2 M = Model() @variable(M, x\[1:3\] .\>= 1) # Block3 M = Model() @variable(M, x\[1:3\]) @constraint(M, x\[1:3\] \>= 1) # Block4 M = Model() @variable(M, x\[…

---

## [Unsatisfiable requirements error when adding Clarabel.jl thru package manager](https://discourse.julialang.org/t/unsatisfiable-requirements-error-when-adding-clarabel-jl-thru-package-manager/112431)

<div class="topic-metadata">

**Author:** [@charshaw](https://discourse.julialang.org/u/charshaw)\
**Replies:** 4\
**Last updated:** [April 2, 2024, 6:29pm UTC](https://discourse.julialang.org/t/unsatisfiable-requirements-error-when-adding-clarabel-jl-thru-package-manager/112431 "2024-04-02T18:29:08Z")

</div>

I went to add Clarabel.jl thru the package manager and received the following error message ERROR: Unsatisfiable requirements detected for package Clarabel \[61c947e1\]: Clarabel \[61c947e1\] log: ├─possible versions are:…

---

## [Infinite Loop Issue with HiGHS Solver in Julia-JuMP During Sensitivity Analysis](https://discourse.julialang.org/t/infinite-loop-issue-with-highs-solver-in-julia-jump-during-sensitivity-analysis/110470)

<div class="topic-metadata">

**Author:** [@vicente\_zehnder](https://discourse.julialang.org/u/vicente_zehnder)\
**Replies:** 16\
**Last updated:** [April 2, 2024, 12:10pm UTC](https://discourse.julialang.org/t/infinite-loop-issue-with-highs-solver-in-julia-jump-during-sensitivity-analysis/110470 "2024-04-02T12:10:54Z")

</div>

I’m encountering a problem while running a sensitivity analysis for an optimization problem in Julia using JuMP and the HiGHS solver. Initially, the model execution time varies between 5 to 20 minutes for different input…

---

## [How can I use NonlinearSolve.jl with matrix functions?](https://discourse.julialang.org/t/how-can-i-use-nonlinearsolve-jl-with-matrix-functions/112379)

<div class="topic-metadata">

**Author:** [@homocomputeris](https://discourse.julialang.org/u/homocomputeris)\
**Replies:** 8\
**Last updated:** [April 2, 2024, 11:06am UTC](https://discourse.julialang.org/t/how-can-i-use-nonlinearsolve-jl-with-matrix-functions/112379 "2024-04-02T11:06:52Z")

</div>

I want to use NonlinearSolve.jl with matrix functions, something like: using NonlinearSolve using LinearAlgebra dim = 2 function f(u, p) return exp(u) - Matrix{Float64}(I(dim)) end u0 = rand(dim, dim) \* 0.01 p = n…

---

## [SDDP with Quasi Monte Carlo sampling](https://discourse.julialang.org/t/sddp-with-quasi-monte-carlo-sampling/112370)

<div class="topic-metadata">

**Author:** [@FelixSchmidt](https://discourse.julialang.org/u/FelixSchmidt)\
**Replies:** 2\
**Last updated:** [April 2, 2024, 9:03am UTC](https://discourse.julialang.org/t/sddp-with-quasi-monte-carlo-sampling/112370 "2024-04-02T09:03:31Z")

</div>

Hi Oscar (@odow), I am working on a SDDP implementation of a capacity expansion problem using SDDP.jl. I suspect that convergence could be improved by using a type of stratified sampling scheme in the forward pass, such…

---

## [Resolving Almost Optimal solution in Clarabel (Tulip does well)](https://discourse.julialang.org/t/resolving-almost-optimal-solution-in-clarabel-tulip-does-well/112319)

<div class="topic-metadata">

**Author:** [@J\_T](https://discourse.julialang.org/u/J_T)\
**Replies:** 3\
**Last updated:** [April 2, 2024, 8:32am UTC](https://discourse.julialang.org/t/resolving-almost-optimal-solution-in-clarabel-tulip-does-well/112319 "2024-04-02T08:32:18Z")

</div>

I have a (for the moment) linear minimisation problem, but there is a related non-linear problem I wish to solve. Its a branch and bound problem, and the range of values is quite plausibly going to cause numerical probl…

---

## [On the solution of an unbounded optimization problem](https://discourse.julialang.org/t/on-the-solution-of-an-unbounded-optimization-problem/112373)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 2\
**Last updated:** [April 2, 2024, 1:38am UTC](https://discourse.julialang.org/t/on-the-solution-of-an-unbounded-optimization-problem/112373 "2024-04-02T01:38:19Z")

</div>

using JuMP, HiGHS M = Model(HiGHS.Optimizer) @variable(M, y, Bin) @variable(M, η) @objective(M, Min, y + η) optimize!(M) The result: Running HiGHS 1.7.0 (git hash: 50670fd4c): Copyright (c) 2024 HiGHS under MIT licenc…

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

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