# Optimization (Mathematical)

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

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

**Page:** 16

---

## [Set-indexed SparseArrays](https://discourse.julialang.org/t/set-indexed-sparsearrays/124545)

<div class="topic-metadata">

**Author:** [@maxminn](https://discourse.julialang.org/u/maxminn)\
**Replies:** 5\
**Last updated:** [January 8, 2025, 7:21pm UTC](https://discourse.julialang.org/t/set-indexed-sparsearrays/124545 "2025-01-08T19:21:19Z")

</div>

Any discussion of support for set-indexed sparse arrays? I really want Julia to replace GAMS for my general modeling needs, but the data storage can’t compete.

---

## [Type stability in Optimization.jl](https://discourse.julialang.org/t/type-stability-in-optimization-jl/124522)

<div class="topic-metadata">

**Author:** [@Addison](https://discourse.julialang.org/u/Addison)\
**Replies:** 4\
**Last updated:** [January 8, 2025, 5:32pm UTC](https://discourse.julialang.org/t/type-stability-in-optimization-jl/124522 "2025-01-08T17:32:00Z")

</div>

I’ve got some code that solves several optimization problems using Optimization.jl. When checking for type stability with JET’s report\_opt function, it outputs all sorts of errors around the call to OptimizationFunction.…

---

## [Using MathOptInterface.AbstractOptimizer in parametric type declaration](https://discourse.julialang.org/t/using-mathoptinterface-abstractoptimizer-in-parametric-type-declaration/124486)

<div class="topic-metadata">

**Author:** [@danrib07](https://discourse.julialang.org/u/danrib07)\
**Replies:** 1\
**Last updated:** [January 6, 2025, 11:40pm UTC](https://discourse.julialang.org/t/using-mathoptinterface-abstractoptimizer-in-parametric-type-declaration/124486 "2025-01-06T23:40:06Z")

</div>

Hi all, I have a question regarding using the MathOptInterface.AbstractOptimizer for parametric type declaration when defining a composite type. For example, take the type definition below: using JuMP # JuMP reexports …

---

## [How to define vector-valued @operator in JuMP](https://discourse.julialang.org/t/how-to-define-vector-valued-operator-in-jump/124438)

<div class="topic-metadata">

**Author:** [@Rick](https://discourse.julialang.org/u/Rick)\
**Replies:** 4\
**Last updated:** [January 5, 2025, 4:43am UTC](https://discourse.julialang.org/t/how-to-define-vector-valued-operator-in-jump/124438 "2025-01-05T04:43:07Z")

</div>

Hi, I am trying to solve a nonlinear model using JuMP. Part of the constraints come from the gradient of a nonlinear function. I am trying to compute it using ForwardDiff. As such, I need to define an operator and then …

---

## [Iterating through a continuous decision variable and retrieving its values](https://discourse.julialang.org/t/iterating-through-a-continuous-decision-variable-and-retrieving-its-values/124412)

<div class="topic-metadata">

**Author:** [@rolim.gustavo](https://discourse.julialang.org/u/rolim.gustavo)\
**Replies:** 4\
**Last updated:** [January 3, 2025, 5:29pm UTC](https://discourse.julialang.org/t/iterating-through-a-continuous-decision-variable-and-retrieving-its-values/124412 "2025-01-03T17:29:45Z")

</div>

Dear colleagues, I am implementing a branch-and-check procedure in JuMP that requires to extract some variable values. For instance, I have to retrieve the values of decision variable X, that is defined as follows: @va…

---

## [Using Knitro with ForwardDiff and JuMP](https://discourse.julialang.org/t/using-knitro-with-forwarddiff-and-jump/124396)

<div class="topic-metadata">

**Author:** [@Rick](https://discourse.julialang.org/u/Rick)\
**Replies:** 2\
**Last updated:** [January 3, 2025, 6:22am UTC](https://discourse.julialang.org/t/using-knitro-with-forwarddiff-and-jump/124396 "2025-01-03T06:22:22Z")

</div>

Hi, I am trying to use Knitro with JuMP which contains a constraint that imposes the gradient of a function to be 0. I want to compute the gradient using ForwardDiff. I found this can be done using Ipopt, but I cannot …

---

## [Unable to construct \`ADNLPModel\` with a matrix of linear constraints](https://discourse.julialang.org/t/unable-to-construct-adnlpmodel-with-a-matrix-of-linear-constraints/124361)

<div class="topic-metadata">

**Author:** [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Replies:** 3\
**Last updated:** [January 2, 2025, 1:14pm UTC](https://discourse.julialang.org/t/unable-to-construct-adnlpmodel-with-a-matrix-of-linear-constraints/124361 "2025-01-02T13:14:04Z")

</div>

The documentation of ADNLPModels.ADNLPModel suggests that there are methods that accept a matrix A to signify linear constraints: ADNLPModel(f, x0, A, lcon, ucon) ADNLPModel(f, x0, lvar, uvar, A, lcon, ucon) These cons…

---

## [PowerModelsDistribution.jl defining new objective](https://discourse.julialang.org/t/powermodelsdistribution-jl-defining-new-objective/124269)

<div class="topic-metadata">

**Author:** [@Glon](https://discourse.julialang.org/u/Glon)\
**Replies:** 4\
**Last updated:** [January 1, 2025, 9:42pm UTC](https://discourse.julialang.org/t/powermodelsdistribution-jl-defining-new-objective/124269 "2025-01-01T21:42:50Z")

</div>

Hello all, What if I want to define a new objective for running OPF in PowerModelsDistribution.jl? How can I do this? If someone can share me an example, I would really appreciate it. Thank you!

---

## [SOCP and SDP solver errors in PowerModelsDistribution.jl](https://discourse.julialang.org/t/socp-and-sdp-solver-errors-in-powermodelsdistribution-jl/123945)

<div class="topic-metadata">

**Author:** [@Glon](https://discourse.julialang.org/u/Glon)\
**Replies:** 5\
**Last updated:** [January 1, 2025, 7:39pm UTC](https://discourse.julialang.org/t/socp-and-sdp-solver-errors-in-powermodelsdistribution-jl/123945 "2025-01-01T19:39:22Z")

</div>

Hello all, I am trying to use PowerModelsDistribution to solve a SDP and SOCP formulation. Below is my code. using PowerModelsDistribution using SCS Test\_Case = parse\_file(“C:/ACOPF/Julia/case3balancedbattery.dss”) …

---

## [Equivalence to add\_nonlinear\_constraint in new JuMP version](https://discourse.julialang.org/t/equivalence-to-add-nonlinear-constraint-in-new-jump-version/122901)

<div class="topic-metadata">

**Author:** [@VPBML](https://discourse.julialang.org/u/VPBML)\
**Replies:** 10\
**Last updated:** [December 31, 2024, 9:22pm UTC](https://discourse.julialang.org/t/equivalence-to-add-nonlinear-constraint-in-new-jump-version/122901 "2024-12-31T21:22:54Z")

</div>

Hi, I have used the functions add\_nonlinear\_constraint/ add\_nonlinear\_expression/ add\_nonlinear\_objective in the old version of JuMP to add programmatically-generated Expr objects to models. I wonder if these functions …

---

## [Clp: 0 dependencies successfully precompiled in 4 seconds. 107 already precompiled](https://discourse.julialang.org/t/clp-0-dependencies-successfully-precompiled-in-4-seconds-107-already-precompiled/124148)

<div class="topic-metadata">

**Author:** [@anonymous\_user](https://discourse.julialang.org/u/anonymous_user)\
**Replies:** 8\
**Last updated:** [December 29, 2024, 11:09pm UTC](https://discourse.julialang.org/t/clp-0-dependencies-successfully-precompiled-in-4-seconds-107-already-precompiled/124148 "2024-12-29T23:09:39Z")

</div>

Help I cannot fix this on my Macbook julia\> Pkg.add(“Clp”) Resolving package versions… No Changes to ~/.julia/environments/v1.11/Project.toml No Changes to ~/.julia/environments/v1.11/Manifest.toml Precompiling proj…

---

## [PATHSolver.jl not working on ARM Linux](https://discourse.julialang.org/t/pathsolver-jl-not-working-on-arm-linux/124203)

<div class="topic-metadata">

**Author:** [@nealhughes](https://discourse.julialang.org/u/nealhughes)\
**Replies:** 13\
**Last updated:** [December 29, 2024, 2:35am UTC](https://discourse.julialang.org/t/pathsolver-jl-not-working-on-arm-linux/124203 "2024-12-29T02:35:53Z")

</div>

I have a JuMP MCP model using PATHSolver.jl which works fine on Windows x86. I am trying to get it working on an ARM laptop in WSL (Ubuntu). All packages have installed fine out of the box except PATHSolver.jl, which gi…

---

## [How to use time-dependant parameters in InfiniteOpt](https://discourse.julialang.org/t/how-to-use-time-dependant-parameters-in-infiniteopt/124092)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 8\
**Last updated:** [December 26, 2024, 5:16pm UTC](https://discourse.julialang.org/t/how-to-use-time-dependant-parameters-in-infiniteopt/124092 "2024-12-26T17:16:24Z")

</div>

I am using InfiniteOpt and I would like to have a parameter time-dependent. For example, in their “eating the cake” optimal consumption model, I would like to define the utility function with a multiplier that change wi…

---

## [Gurobi Error 10005: Unable to retrieve attribute 'Pi'](https://discourse.julialang.org/t/gurobi-error-10005-unable-to-retrieve-attribute-pi/53691)

<div class="topic-metadata">

**Author:** [@rezabayani](https://discourse.julialang.org/u/rezabayani)\
**Replies:** 8\
**Last updated:** [December 22, 2024, 10:08am UTC](https://discourse.julialang.org/t/gurobi-error-10005-unable-to-retrieve-attribute-pi/53691 "2024-12-22T10:08:55Z")

</div>

I am trying to retrieve some Gurobi attributes for through MOI.get() function with direct\_model() enabled. Everything seems to be working but when I try to get “Pi” (dual value for a constraint), I encounter the error: G…

---

## [JuMP: the other implication for indicator constraints](https://discourse.julialang.org/t/jump-the-other-implication-for-indicator-constraints/124048)

<div class="topic-metadata">

**Author:** [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Replies:** 3\
**Last updated:** [December 21, 2024, 4:20pm UTC](https://discourse.julialang.org/t/jump-the-other-implication-for-indicator-constraints/124048 "2024-12-21T16:20:53Z")

</div>

In JuMP there is some support for indicator constraints. The documentation reads Indicator constraints consist of a binary variable and a linear constraint. The constraint holds when the binary variable takes the value…

---

## [JuMP Unable to register the function](https://discourse.julialang.org/t/jump-unable-to-register-the-function/124006)

<div class="topic-metadata">

**Author:** [@jgr](https://discourse.julialang.org/u/jgr)\
**Replies:** 1\
**Last updated:** [December 21, 2024, 12:01am UTC](https://discourse.julialang.org/t/jump-unable-to-register-the-function/124006 "2024-12-21T00:01:30Z")

</div>

The function I want to maximize is function L(params::Vector{Real}, df::DataFrame, mm::MMParams) θ1, α1, β1, D1, N1, ϵ1, θ2, α2, β2, D2, N2, ϵ2, ρ, pA, pF, σ, constant = params Π = mm.Π y\_star\_1 = y\_start((…

---

## [JuMP design question](https://discourse.julialang.org/t/jump-design-question/123927)

<div class="topic-metadata">

**Author:** [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Replies:** 7\
**Last updated:** [December 19, 2024, 6:03pm UTC](https://discourse.julialang.org/t/jump-design-question/123927 "2024-12-19T18:03:30Z")

</div>

Hi, I am building a model which is made up of smaller models. The smaller model definition can be found here: JuMP: which solver should I use for my problem? For context, the model linked above is a heat pump h which c…

---

## [Build combined model from individual jump models](https://discourse.julialang.org/t/build-combined-model-from-individual-jump-models/123975)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 2\
**Last updated:** [December 19, 2024, 2:32am UTC](https://discourse.julialang.org/t/build-combined-model-from-individual-jump-models/123975 "2024-12-19T02:32:10Z")

</div>

Suppose I have a two stage problem where I expect the user to provide (1) a first-stage model written in JuMP and (2) a function to evaluate the recourse. If the user’s recourse function evaluates subproblems also writte…

---

## [How to get constraints from one JuMP model and use them in another JuMP model](https://discourse.julialang.org/t/how-to-get-constraints-from-one-jump-model-and-use-them-in-another-jump-model/20729)

<div class="topic-metadata">

**Author:** [@Mahbubar06](https://discourse.julialang.org/u/Mahbubar06)\
**Replies:** 8\
**Last updated:** [December 19, 2024, 1:30am UTC](https://discourse.julialang.org/t/how-to-get-constraints-from-one-jump-model-and-use-them-in-another-jump-model/20729 "2024-12-19T01:30:53Z")

</div>

Hello, I have two JuMP model like following: m1=Model(solver=ClpSolver()) @variable(m1, x\[1:3\]\>=0) @constraint(m1, sum(x\[i\] for i in 1:3)\>=0) @constraint(m1, sum(x\[i\] for i in \[1,3\])\>=0) @constraint(m1, sum(x\[i\] for i …

---

## [Jump model SCS Optimizer](https://discourse.julialang.org/t/jump-model-scs-optimizer/123946)

<div class="topic-metadata">

**Author:** [@zhenweilin](https://discourse.julialang.org/u/zhenweilin)\
**Replies:** 3\
**Last updated:** [December 19, 2024, 12:19am UTC](https://discourse.julialang.org/t/jump-model-scs-optimizer/123946 "2024-12-19T00:19:49Z")

</div>

Hello, julia community. Recently, I aim to solve a large scale optimization problem, which contains 10M exp cone. When I try to model it by using JUMP, it is too slow. @constraint(jump\_model, con\[i=1:m\], \[x\[m\*n + 2\*i - …

---

## [Too many nonzeroes for NLP in JuMP and Examodels](https://discourse.julialang.org/t/too-many-nonzeroes-for-nlp-in-jump-and-examodels/123901)

<div class="topic-metadata">

**Author:** [@KSepetanc](https://discourse.julialang.org/u/KSepetanc)\
**Replies:** 8\
**Last updated:** [December 18, 2024, 7:53pm UTC](https://discourse.julialang.org/t/too-many-nonzeroes-for-nlp-in-jump-and-examodels/123901 "2024-12-18T19:53:07Z")

</div>

Creating a topic as suggested by @odow and mentioned in topic. The issue is that JuMP creates Jacobian and Hessian matrices with nonzeroes for derivatives that are fixed zero. Consider the following two example constra…

---

## [Help reviewing PowerModels pull request wanted (PSSE)](https://discourse.julialang.org/t/help-reviewing-powermodels-pull-request-wanted-psse/123958)

<div class="topic-metadata">

**Author:** [@KSepetanc](https://discourse.julialang.org/u/KSepetanc)\
**Replies:** 2\
**Last updated:** [December 18, 2024, 7:24pm UTC](https://discourse.julialang.org/t/help-reviewing-powermodels-pull-request-wanted-psse/123958 "2024-12-18T19:24:57Z")

</div>

PowerModels currently remarks all load buses to generation buses if there is active generator located at the bus. That is different from the behavior that the PSSE does for the same raw file. As observed by my self, the …

---

## [Updating to MosekToolsv0.15.3 breaks many JuMP SDP codes](https://discourse.julialang.org/t/updating-to-mosektoolsv0-15-3-breaks-many-jump-sdp-codes/123893)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 5\
**Last updated:** [December 17, 2024, 1:09pm UTC](https://discourse.julialang.org/t/updating-to-mosektoolsv0-15-3-breaks-many-jump-sdp-codes/123893 "2024-12-17T13:09:37Z")

</div>

I updated MosekTools to v0.15.3 today (from 0.15.1) and it breaks my existing SDP codes with the following error when calling optimize!: MSK\_RES\_ERR\_SYM\_MAT\_INVALID\_ROW\_INDEX): The row index 11 specified for sparse symm…

---

## [Debugging a JuMP model's infeasibility](https://discourse.julialang.org/t/debugging-a-jump-models-infeasibility/123895)

<div class="topic-metadata">

**Author:** [@BMI\_OR](https://discourse.julialang.org/u/BMI_OR)\
**Replies:** 2\
**Last updated:** [December 17, 2024, 11:20am UTC](https://discourse.julialang.org/t/debugging-a-jump-models-infeasibility/123895 "2024-12-17T11:20:31Z")

</div>

I have implemented a Benders decomposition algorithm in which the Benders subproblem (BSP) is solved using column generation. The BSP is a conventional linear JuMP model and I use Gurobi as a solver. After some iterati…

---

## [Is it possible to resume a Gurobi optimization model after a timeout?](https://discourse.julialang.org/t/is-it-possible-to-resume-a-gurobi-optimization-model-after-a-timeout/123686)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 3\
**Last updated:** [December 17, 2024, 5:10am UTC](https://discourse.julialang.org/t/is-it-possible-to-resume-a-gurobi-optimization-model-after-a-timeout/123686 "2024-12-17T05:10:25Z")

</div>

There’s an optimization-type contest, I’m participating using MathOptInterface.jl and Gurobi.jl. Seeing as I don’t feel I’ll be able to improve the program formulation any more, I think the only way to further improve my…

---

## [Julia Tools for Large-Scale SMT/SAT problems?](https://discourse.julialang.org/t/julia-tools-for-large-scale-smt-sat-problems/123744)

<div class="topic-metadata">

**Author:** [@Fe-r-oz](https://discourse.julialang.org/u/Fe-r-oz)\
**Replies:** 1\
**Last updated:** [December 16, 2024, 9:17pm UTC](https://discourse.julialang.org/t/julia-tools-for-large-scale-smt-sat-problems/123744 "2024-12-16T21:17:21Z")

</div>

Hi, Everyone, I’m exploring options for working with SAT/SMT solvers in Julia. So far, I’ve come across Z3.jl and Satisfiability.jl, and I really appreciate the JuMP-like idiomatic interface of Satisfiability.jl, Are th…

---

## [Handling nonlinear objective involving the inverse of a matrix](https://discourse.julialang.org/t/handling-nonlinear-objective-involving-the-inverse-of-a-matrix/123726)

<div class="topic-metadata">

**Author:** [@Cory\_Simon](https://discourse.julialang.org/u/Cory_Simon)\
**Replies:** 2\
**Last updated:** [December 11, 2024, 8:55pm UTC](https://discourse.julialang.org/t/handling-nonlinear-objective-involving-the-inverse-of-a-matrix/123726 "2024-12-11T20:55:40Z")

</div>

so the output of: MOI.get(Ipopt.Optimizer(), MOI.ListOfSupportedNonlinearOperators()) includes inv, so I thought it should handle the inverse of a matrix. however, in my minimal example, it does not: n = 5 model =…

---

## [Write expressions in JuMP model based on condition](https://discourse.julialang.org/t/write-expressions-in-jump-model-based-on-condition/123696)

<div class="topic-metadata">

**Author:** [@mast-lfl](https://discourse.julialang.org/u/mast-lfl)\
**Replies:** 1\
**Last updated:** [December 11, 2024, 8:37pm UTC](https://discourse.julialang.org/t/write-expressions-in-jump-model-based-on-condition/123696 "2024-12-11T20:37:42Z")

</div>

I want to add serval named expressions in a JuMP model that are conditional on the indices p (set P) and t (set T). X and I are the decision variable and set P consists of two subsets, P\_1, P\_2. I want the expressions to…

---

## [Nelder Mead requires derivatives?](https://discourse.julialang.org/t/nelder-mead-requires-derivatives/123697)

<div class="topic-metadata">

**Author:** [@aris](https://discourse.julialang.org/u/aris)\
**Replies:** 6\
**Last updated:** [December 11, 2024, 3:59pm UTC](https://discourse.julialang.org/t/nelder-mead-requires-derivatives/123697 "2024-12-11T15:59:44Z")

</div>

Hello everyone I was playing around with optimizing a problem using some code that looks as follows: using Optimization using OptimizationOptimJL function cost(u,p) # define the cost function here end prob = Opti…

---

## [Nonlinear program with JuMP not following all constraints](https://discourse.julialang.org/t/nonlinear-program-with-jump-not-following-all-constraints/123691)

<div class="topic-metadata">

**Author:** [@Yuricst](https://discourse.julialang.org/u/Yuricst)\
**Replies:** 2\
**Last updated:** [December 11, 2024, 3:09pm UTC](https://discourse.julialang.org/t/nonlinear-program-with-jump-not-following-all-constraints/123691 "2024-12-11T15:09:20Z")

</div>

Hello! I am trying to solve a nonlinear nonconvex NLP using JuMP. More specifically, I would like to write a wrapper that accepts a somewhat generic objective/constraint evaluation function f\_fitness and generates a JuM…

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

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