# Optimization (Mathematical)

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

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

**Page:** 19

---

## [How to get the gradient of a constraint of an optimization problem at a fixed point](https://discourse.julialang.org/t/how-to-get-the-gradient-of-a-constraint-of-an-optimization-problem-at-a-fixed-point/121249)

<div class="topic-metadata">

**Author:** [@VPBML](https://discourse.julialang.org/u/VPBML)\
**Replies:** 6\
**Last updated:** [October 20, 2024, 8:22pm UTC](https://discourse.julialang.org/t/how-to-get-the-gradient-of-a-constraint-of-an-optimization-problem-at-a-fixed-point/121249 "2024-10-20T20:22:39Z")

</div>

Hi, I wonder how I can get the value of the gradient of a constraint at some fixed point using JuMP. For example, in the following optimization problem, how can I get the gradient of the constraint with name Temp with r…

---

## [Using NonlinearSolve with autodiff](https://discourse.julialang.org/t/using-nonlinearsolve-with-autodiff/121333)

<div class="topic-metadata">

**Author:** [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Replies:** 9\
**Last updated:** [October 17, 2024, 9:18pm UTC](https://discourse.julialang.org/t/using-nonlinearsolve-with-autodiff/121333 "2024-10-17T21:18:38Z")

</div>

Hello, I was trying to test NonlinearSolve.jl with automatic differentiation like Enzyme.jl or Zygote.jl. But the following simple code fails f(x, p) = p.a \* x^2 - p.b prob = NonlinearProblem(f, 0.0, (a=1.0, b=2.0)) so…

---

## [Maximize the maximum of expressions](https://discourse.julialang.org/t/maximize-the-maximum-of-expressions/118295)

<div class="topic-metadata">

**Author:** [@janneshb](https://discourse.julialang.org/u/janneshb)\
**Replies:** 10\
**Last updated:** [October 17, 2024, 12:25pm UTC](https://discourse.julialang.org/t/maximize-the-maximum-of-expressions/118295 "2024-10-17T12:25:18Z")

</div>

Hey everyone, I would like to maximize the maximum of a vector that is a function of my optimization variables. Basically, I want to do the following, but in a “JuMP way”. @objective(model, Max, max(my\_vec...)) On th…

---

## [Matrix of Floats and JuMP Variables mixed](https://discourse.julialang.org/t/matrix-of-floats-and-jump-variables-mixed/121380)

<div class="topic-metadata">

**Author:** [@HSt](https://discourse.julialang.org/u/HSt)\
**Replies:** 2\
**Last updated:** [October 17, 2024, 1:34pm UTC](https://discourse.julialang.org/t/matrix-of-floats-and-jump-variables-mixed/121380 "2024-10-17T13:34:53Z")

</div>

Hi, I started with functions to build matrices from blocks / components like function build\_A(a::AbstractMatrix, b::AbstractMatrix, c::AbstractVector) T = promote\_type(eltype(a), eltype(b), eltype(c)) x = \[a diagm(…

---

## [Julia JuMP model scope](https://discourse.julialang.org/t/julia-jump-model-scope/121400)

<div class="topic-metadata">

**Author:** [@cby](https://discourse.julialang.org/u/cby)\
**Replies:** 2\
**Last updated:** [October 16, 2024, 11:29pm UTC](https://discourse.julialang.org/t/julia-jump-model-scope/121400 "2024-10-16T23:29:43Z")

</div>

I want to define a function that creates a JuMP model that then calls a function to add a set of additional constraints to that model. That set of constraints would be the same across a number of different models. The f…

---

## [Gurobi fails to precompile](https://discourse.julialang.org/t/gurobi-fails-to-precompile/121198)

<div class="topic-metadata">

**Author:** [@bjhamli](https://discourse.julialang.org/u/bjhamli)\
**Replies:** 5\
**Last updated:** [October 16, 2024, 1:45pm UTC](https://discourse.julialang.org/t/gurobi-fails-to-precompile/121198 "2024-10-16T13:45:18Z")

</div>

I am trying to run a file, but when I try to run the code Gurobi fails to precompile. The error output is at the end of the post. I have tried the suggested fix in the output: using Pkg; Pkg.instantiate() but I still r…

---

## [SDP constraints in nonlinear programm](https://discourse.julialang.org/t/sdp-constraints-in-nonlinear-programm/121283)

<div class="topic-metadata">

**Author:** [@Tbr2](https://discourse.julialang.org/u/Tbr2)\
**Replies:** 11\
**Last updated:** [October 16, 2024, 7:55am UTC](https://discourse.julialang.org/t/sdp-constraints-in-nonlinear-programm/121283 "2024-10-16T07:55:09Z")

</div>

Hello, I have quite experience with Yalmip, cvxpy, casadi, GAMS, etc and I am now thinking about moving towards Julia and JuMP. I have an important question for me, that I could not find in the documentation where I jus…

---

## [How to solving SOCP and SDP by AmplNLWriter with these two solvers GUROBI 11.0.3 and Lindoapi 15?](https://discourse.julialang.org/t/how-to-solving-socp-and-sdp-by-amplnlwriter-with-these-two-solvers-gurobi-11-0-3-and-lindoapi-15/121322)

<div class="topic-metadata">

**Author:** [@wjulia](https://discourse.julialang.org/u/wjulia)\
**Replies:** 2\
**Last updated:** [October 16, 2024, 2:58am UTC](https://discourse.julialang.org/t/how-to-solving-socp-and-sdp-by-amplnlwriter-with-these-two-solvers-gurobi-11-0-3-and-lindoapi-15/121322 "2024-10-16T02:58:28Z")

</div>

hello, everyone, what is wrong with the following code of using JuMP using AmplNLWriter using LinearAlgebra using SCS using MathOptInterface # import MathOptInterface as MOI model = Model(() -\> AmplNLWriter.Optimizer…

---

## [Question about Nonlinear expressions in jump](https://discourse.julialang.org/t/question-about-nonlinear-expressions-in-jump/121353)

<div class="topic-metadata">

**Author:** [@lukebhan](https://discourse.julialang.org/u/lukebhan)\
**Replies:** 5\
**Last updated:** [October 15, 2024, 11:17pm UTC](https://discourse.julialang.org/t/question-about-nonlinear-expressions-in-jump/121353 "2024-10-15T23:17:21Z")

</div>

Hi, I am trying to use Jump (v 1.23.2) with Julia (1.11.0) with nonlinear constraints where I essential invert a constructed matrix depending on the variable x. Namely, something like m = Model(optimizer\_with\_attribute…

---

## [I use Solver of AmplNLWriter with some errors](https://discourse.julialang.org/t/i-use-solver-of-amplnlwriter-with-some-errors/119585)

<div class="topic-metadata">

**Author:** [@wjulia](https://discourse.julialang.org/u/wjulia)\
**Replies:** 3\
**Last updated:** [October 15, 2024, 9:52am UTC](https://discourse.julialang.org/t/i-use-solver-of-amplnlwriter-with-some-errors/119585 "2024-10-15T09:52:10Z")

</div>

The following is my code : using JuMP, AmplNLWriter m = Model(() -\> AmplNLWriter.Optimizer("Your\_Path\\\\lindoapi\\\\bin\\\\win64\\\\runlindo.exe")) @variable(m, -2 \<= x1 \<= 2,Int) @variable(m, -2 \<= x2 \<= 2) @constraint(m,…

---

## [Can I consider variables as Float32 or Float16 in JuMP](https://discourse.julialang.org/t/can-i-consider-variables-as-float32-or-float16-in-jump/121216)

<div class="topic-metadata">

**Author:** [@Anassis\_b](https://discourse.julialang.org/u/Anassis_b)\
**Replies:** 2\
**Last updated:** [October 12, 2024, 10:00pm UTC](https://discourse.julialang.org/t/can-i-consider-variables-as-float32-or-float16-in-jump/121216 "2024-10-12T22:00:45Z")

</div>

Hi all, I’m working on an optimization problem using JuMP with IPOPT, and I noticed that by default, variables are declared as Float64. I would like to explore using Float32 and Float16 for my variables instead. Additio…

---

## [Can LinearSolve.jl be used for non-square matrices?](https://discourse.julialang.org/t/can-linearsolve-jl-be-used-for-non-square-matrices/121217)

<div class="topic-metadata">

**Author:** [@l8l](https://discourse.julialang.org/u/l8l)\
**Replies:** 4\
**Last updated:** [October 12, 2024, 7:19pm UTC](https://discourse.julialang.org/t/can-linearsolve-jl-be-used-for-non-square-matrices/121217 "2024-10-12T19:19:07Z")

</div>

This might be a naive question, and the title basically says it already: I am trying to use LinearSolve.jl but get an error for non-square matrices: Assume I have matrix A of dimension n\\times p and vector b of dimension…

---

## [Pre-processing time and Mosek Solve inordinately long](https://discourse.julialang.org/t/pre-processing-time-and-mosek-solve-inordinately-long/119783)

<div class="topic-metadata">

**Author:** [@ilovemath](https://discourse.julialang.org/u/ilovemath)\
**Replies:** 13\
**Last updated:** [October 10, 2024, 4:44pm UTC](https://discourse.julialang.org/t/pre-processing-time-and-mosek-solve-inordinately-long/119783 "2024-10-10T16:44:28Z")

</div>

I have converted a YALMIP sum-of-squares optimization code to a Julia sum-of-squares optimization code. The base level of the code, from which I want to expand, seems to produce similar-sized problems in Julia and YALMI…

---

## [Simplex tableau from Gurobi](https://discourse.julialang.org/t/simplex-tableau-from-gurobi/121080)

<div class="topic-metadata">

**Author:** [@wahadhasan](https://discourse.julialang.org/u/wahadhasan)\
**Replies:** 1\
**Last updated:** [October 9, 2024, 4:33am UTC](https://discourse.julialang.org/t/simplex-tableau-from-gurobi/121080 "2024-10-09T04:33:23Z")

</div>

Hi there, is there anyway to get the optimal simplex tableau from Gurobi? I checked this link (CPLEX) but unfortunately could not reach to the tableau it supposed to be. Any suggestions will be of great help. Gather Opt…

---

## [How to use KNITRO on Ubuntu?](https://discourse.julialang.org/t/how-to-use-knitro-on-ubuntu/120968)

<div class="topic-metadata">

**Author:** [@kevinqiao](https://discourse.julialang.org/u/kevinqiao)\
**Replies:** 5\
**Last updated:** [October 10, 2024, 12:08pm UTC](https://discourse.julialang.org/t/how-to-use-knitro-on-ubuntu/120968 "2024-10-10T12:08:58Z")

</div>

I’m using JuMP and KNITRO on Ubuntu (Remote), the solver KNITRO has been installed successfully, and KNITRO.jl is installed as well, the env command KNITRODIR and LD\_LIBRARY\_PATH are set, building KNITRO is successful, b…

---

## [Error when compiling linear integer programming problem](https://discourse.julialang.org/t/error-when-compiling-linear-integer-programming-problem/71121)

<div class="topic-metadata">

**Author:** [@jyscao](https://discourse.julialang.org/u/jyscao)\
**Replies:** 11\
**Last updated:** [October 10, 2024, 7:24am UTC](https://discourse.julialang.org/t/error-when-compiling-linear-integer-programming-problem/71121 "2024-10-10T07:24:25Z")

</div>

I’m trying to solve an optimization problem described in the following Stats SE question: https://stats.stackexchange.com/questions/544065/how-to-fit-data-to-a-discrete-linear-model Currently I’m using the COSMO.jl sol…

---

## [Expectation-Maximization for Kalman Filter with Continuous State Variables](https://discourse.julialang.org/t/expectation-maximization-for-kalman-filter-with-continuous-state-variables/120983)

<div class="topic-metadata">

**Author:** [@adannenberg](https://discourse.julialang.org/u/adannenberg)\
**Replies:** 3\
**Last updated:** [October 8, 2024, 6:54am UTC](https://discourse.julialang.org/t/expectation-maximization-for-kalman-filter-with-continuous-state-variables/120983 "2024-10-08T06:54:33Z")

</div>

I would like to use a Kalman Filter + the EM algorithm to fit model parameters for a Hidden Markov Model with continuous hidden state variables, and then use the Kalman filter for prediction using the fitted parameters. …

---

## [Reformulating optimization problem with normalization constraints](https://discourse.julialang.org/t/reformulating-optimization-problem-with-normalization-constraints/121017)

<div class="topic-metadata">

**Author:** [@legio](https://discourse.julialang.org/u/legio)\
**Replies:** 3\
**Last updated:** [October 7, 2024, 6:27pm UTC](https://discourse.julialang.org/t/reformulating-optimization-problem-with-normalization-constraints/121017 "2024-10-07T18:27:37Z")

</div>

Hi! I’m pretty new to julia and optimization, and I’m trying to set up a optimization problem over a decision variable X \\in \\mathbb{R}^{m \\times n} that would semantically capture assignment of “targets” in the rows of …

---

## [Initialize a SDP solver with Convex](https://discourse.julialang.org/t/initialize-a-sdp-solver-with-convex/115339)

<div class="topic-metadata">

**Author:** [@gustave\_Robichon](https://discourse.julialang.org/u/gustave_Robichon)\
**Replies:** 6\
**Last updated:** [October 7, 2024, 2:38pm UTC](https://discourse.julialang.org/t/initialize-a-sdp-solver-with-convex/115339 "2024-10-07T14:38:35Z")

</div>

hello there :slight\_smile: I am using julia to solve some Semi-definite Problem. I use Convex to define the problem and the constraints, then I use Hypatia to solve it : M = HermitianSemidefinite(N) problem = minimize…

---

## [Examodels: using constraint as empty object for constraint!](https://discourse.julialang.org/t/examodels-using-constraint-as-empty-object-for-constraint/120911)

<div class="topic-metadata">

**Author:** [@KSepetanc](https://discourse.julialang.org/u/KSepetanc)\
**Replies:** 4\
**Last updated:** [October 7, 2024, 2:09pm UTC](https://discourse.julialang.org/t/examodels-using-constraint-as-empty-object-for-constraint/120911 "2024-10-07T14:09:38Z")

</div>

I am trying to implement control neutrality constraint. That is, a constraint that requires that if some generator increased power that others decrease (sum is zero). In this demo test case there are only two variables …

---

## [Warning displayed after running](https://discourse.julialang.org/t/warning-displayed-after-running/120947)

<div class="topic-metadata">

**Author:** [@Jimery](https://discourse.julialang.org/u/Jimery)\
**Replies:** 2\
**Last updated:** [October 7, 2024, 2:00am UTC](https://discourse.julialang.org/t/warning-displayed-after-running/120947 "2024-10-07T02:00:25Z")

</div>

┌ Warning: The model has been modified since the last call to optimize! (or optimize! has not been called yet). If you are iteratively querying solution information and modifying a model, query all the results first, the…

---

## [Why are Mixed integer programming solvers focused on finding cuts and not so much on search?](https://discourse.julialang.org/t/why-are-mixed-integer-programming-solvers-focused-on-finding-cuts-and-not-so-much-on-search/120945)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 4\
**Last updated:** [October 7, 2024, 1:58am UTC](https://discourse.julialang.org/t/why-are-mixed-integer-programming-solvers-focused-on-finding-cuts-and-not-so-much-on-search/120945 "2024-10-07T01:58:04Z")

</div>

Hi. I’ve written many mixed-integer programming problems and sent them to solvers (HiGHS and Gurobi). The solvers seem to follow this pattern. Adding cuts at the root node (Gomory cut among other cuts) Doing a branch a…

---

## [TIMES.jl prototype](https://discourse.julialang.org/t/times-jl-prototype/120932)

<div class="topic-metadata">

**Author:** [@olejandro](https://discourse.julialang.org/u/olejandro)\
**Replies:** 3\
**Last updated:** [October 5, 2024, 1:02am UTC](https://discourse.julialang.org/t/times-jl-prototype/120932 "2024-10-05T01:02:30Z")

</div>

Dear all, Together with other members of the TIMES community, I’ve been working on a small TIMES.jl prototype translating a small number of TIMES equations formulated in GAMS to Julia. Basically, this is a continuation…

---

## [How does Dualization.jl solve a SOS but not compute it?](https://discourse.julialang.org/t/how-does-dualization-jl-solve-a-sos-but-not-compute-it/119966)

<div class="topic-metadata">

**Author:** [@ashefa](https://discourse.julialang.org/u/ashefa)\
**Replies:** 2\
**Last updated:** [October 4, 2024, 6:24am UTC](https://discourse.julialang.org/t/how-does-dualization-jl-solve-a-sos-but-not-compute-it/119966 "2024-10-04T06:24:43Z")

</div>

Hi, While solving a conic optimization problem, I needed to compute its dual, so I used Dualization.jl. However, it does not support the constraints modeled by SumOfSquares.jl, resulting in the following error: Constra…

---

## [Benders Subproblem Infeasibility](https://discourse.julialang.org/t/benders-subproblem-infeasibility/102622)

<div class="topic-metadata">

**Author:** [@bcoulier](https://discourse.julialang.org/u/bcoulier)\
**Replies:** 6\
**Last updated:** [October 1, 2024, 9:46pm UTC](https://discourse.julialang.org/t/benders-subproblem-infeasibility/102622 "2024-10-01T21:46:49Z")

</div>

Hello everyone, I’m currently working on an optimization problem where I’m using Benders decomposition to determine the placement of EV charging stations. The master problem determines the placement of charging stations…

---

## [CheckGradient In Manopt.jl](https://discourse.julialang.org/t/checkgradient-in-manopt-jl/120743)

<div class="topic-metadata">

**Author:** [@fimiller](https://discourse.julialang.org/u/fimiller)\
**Replies:** 0\
**Last updated:** [September 30, 2024, 11:25pm UTC](https://discourse.julialang.org/t/checkgradient-in-manopt-jl/120743 "2024-09-30T23:25:08Z")

</div>

I am performing an optimization problem and wish to make sure that the gradient I have is correct. When using the check\_gradient function, I find that the gradient is only correct some of the time, (about 90% of the tim…

---

## [Benders decomposition](https://discourse.julialang.org/t/benders-decomposition/120734)

<div class="topic-metadata">

**Author:** [@wahadhasan](https://discourse.julialang.org/u/wahadhasan)\
**Replies:** 1\
**Last updated:** [September 30, 2024, 8:21pm UTC](https://discourse.julialang.org/t/benders-decomposition/120734 "2024-09-30T20:21:28Z")

</div>

Hi there, can anybody tell me how to take the sub-gradient here in case of an (==) constraint or (\>=) constraint instead of standard format (\<=)? Is it the same procedure or need to convert it into standard format first? …

---

## [Using Juniper with Convex.jl](https://discourse.julialang.org/t/using-juniper-with-convex-jl/119974)

<div class="topic-metadata">

**Author:** [@CaG21](https://discourse.julialang.org/u/CaG21)\
**Replies:** 2\
**Last updated:** [September 27, 2024, 9:45pm UTC](https://discourse.julialang.org/t/using-juniper-with-convex-jl/119974 "2024-09-27T21:45:23Z")

</div>

I am trying to solve a MISOCP, modeled using Convex.jl, and I thought that trying to solve it with Juniper would be great since it is one of the non-commercial solvers that can handle this problem. However, when I call s…

---

## [EAGO unbounded variables](https://discourse.julialang.org/t/eago-unbounded-variables/119865)

<div class="topic-metadata">

**Author:** [@kiki\_Van\_Elsen](https://discourse.julialang.org/u/kiki_Van_Elsen)\
**Replies:** 3\
**Last updated:** [September 27, 2024, 7:52am UTC](https://discourse.julialang.org/t/eago-unbounded-variables/119865 "2024-09-27T07:52:39Z")

</div>

Hello! I want to run the following code: function bivariate(solver, type) try #choose which solver you want to use m = Model(solver.Optimizer) #function we want to Optimize f(x1,x2)…

---

## [Building a custom "variable in set" constraint](https://discourse.julialang.org/t/building-a-custom-variable-in-set-constraint/119927)

<div class="topic-metadata">

**Author:** [@janneshb](https://discourse.julialang.org/u/janneshb)\
**Replies:** 9\
**Last updated:** [September 26, 2024, 11:02pm UTC](https://discourse.julialang.org/t/building-a-custom-variable-in-set-constraint/119927 "2024-09-26T23:02:14Z")

</div>

Hi, I implemented my own type of sets (let’s call it MySetType) and now I want to override Julia’s in functionality, similar to what is already supported for SecondOrderCones. So, I would like to make this work with Ju…

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

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