# Optimization (Mathematical)

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

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

**Page:** 53

---

## [How to express an objective with L1-norm in JuMP.jl?](https://discourse.julialang.org/t/how-to-express-an-objective-with-l1-norm-in-jump-jl/91387)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 7\
**Last updated:** [December 13, 2022, 10:42pm UTC](https://discourse.julialang.org/t/how-to-express-an-objective-with-l1-norm-in-jump-jl/91387 "2022-12-13T22:42:06Z")

</div>

I learned about the NormOneCone, which can be used to add L1 constraints to a model. How to minimize the L1 norm of a vector of residuals? Tried @objective(model, Min, sum(abs.(x))) but it is not recognized by JuMP.jl.

---

## [Solve problems starting from corresponding .nl files](https://discourse.julialang.org/t/solve-problems-starting-from-corresponding-nl-files/91306)

<div class="topic-metadata">

**Author:** [@Luca](https://discourse.julialang.org/u/Luca)\
**Replies:** 7\
**Last updated:** [December 13, 2022, 10:03am UTC](https://discourse.julialang.org/t/solve-problems-starting-from-corresponding-nl-files/91306 "2022-12-13T10:03:15Z")

</div>

Dear all, I want to solve a bunch of nonlinear optimization problems, whose nl. files are available. Hence I would like to charge the .nl files directly in Julia and solve the corresponding problem with a nonlinear solv…

---

## [Read a csv tabular data to use in a p median model](https://discourse.julialang.org/t/read-a-csv-tabular-data-to-use-in-a-p-median-model/91515)

<div class="topic-metadata">

**Author:** [@aninha](https://discourse.julialang.org/u/aninha)\
**Replies:** 2\
**Last updated:** [December 11, 2022, 7:55pm UTC](https://discourse.julialang.org/t/read-a-csv-tabular-data-to-use-in-a-p-median-model/91515 "2022-12-11T19:55:16Z")

</div>

Can u help me to to print an objective function? @objective(m, Min, sum(custo\[j,i\]\*x\[i,j\] for i in destino, j in origem))

---

## [JuMP: Constrain with quadratic equation](https://discourse.julialang.org/t/jump-constrain-with-quadratic-equation/91432)

<div class="topic-metadata">

**Author:** [@Gabsxk](https://discourse.julialang.org/u/Gabsxk)\
**Replies:** 3\
**Last updated:** [December 8, 2022, 6:36pm UTC](https://discourse.julialang.org/t/jump-constrain-with-quadratic-equation/91432 "2022-12-08T18:36:52Z")

</div>

How to solve a quadratic equation using JuMP? I was following the documentation, but the quadratic equations are not working.

---

## [The final position of Nonlinear optimization of trajectory is not on the desired position](https://discourse.julialang.org/t/the-final-position-of-nonlinear-optimization-of-trajectory-is-not-on-the-desired-position/90782)

<div class="topic-metadata">

**Author:** [@elliot000319](https://discourse.julialang.org/u/elliot000319)\
**Replies:** 6\
**Last updated:** [December 7, 2022, 7:40pm UTC](https://discourse.julialang.org/t/the-final-position-of-nonlinear-optimization-of-trajectory-is-not-on-the-desired-position/90782 "2022-12-07T19:40:22Z")

</div>

The starting position is set as \[1.0, 0.0\], and the desired position is \[-1,0\]. However, the object stops short before touching the desired position. The x coordinate gets close enough, but the issue is with the y coor…

---

## [Gurobi with Log constranints](https://discourse.julialang.org/t/gurobi-with-log-constranints/91316)

<div class="topic-metadata">

**Author:** [@mreguant](https://discourse.julialang.org/u/mreguant)\
**Replies:** 7\
**Last updated:** [December 6, 2022, 11:10pm UTC](https://discourse.julialang.org/t/gurobi-with-log-constranints/91316 "2022-12-06T23:10:23Z")

</div>

Hello, I am trying to make the log constraints work with Gurobi.jl and JuMP.jl. However, I don’t seem to be able to successfully use the C call function. Anyone who has managed to use them? I paste a simple example bel…

---

## [Making LBFGS in \`Optim.jl\` as fast as in \`NLopt.jl\`](https://discourse.julialang.org/t/making-lbfgs-in-optim-jl-as-fast-as-in-nlopt-jl/91259)

<div class="topic-metadata">

**Author:** [@jlbosse](https://discourse.julialang.org/u/jlbosse)\
**Replies:** 13\
**Last updated:** [December 6, 2022, 5:18pm UTC](https://discourse.julialang.org/t/making-lbfgs-in-optim-jl-as-fast-as-in-nlopt-jl/91259 "2022-12-06T17:18:12Z")

</div>

I have a (somewhat expensive to calculate) loss function f(x) for which I can compute exact gradients using Zygote.jl and wish to minimise it. So far I have been using the LBFGS implementation in NLopt.jl to do that, bu…

---

## [MethodError: no method matching getrf! when I try to use GPU to training a universal differential equation with ForwardDiff.jl](https://discourse.julialang.org/t/methoderror-no-method-matching-getrf-when-i-try-to-use-gpu-to-training-a-universal-differential-equation-with-forwarddiff-jl/91062)

<div class="topic-metadata">

**Author:** [@Ronaldo\_Nogueira](https://discourse.julialang.org/u/Ronaldo_Nogueira)\
**Replies:** 5\
**Last updated:** [December 6, 2022, 3:50pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-getrf-when-i-try-to-use-gpu-to-training-a-universal-differential-equation-with-forwarddiff-jl/91062 "2022-12-06T15:50:07Z")

</div>

Hi, thank you for your attention. So, I’m trying to make use of GPU to train a universal differential equation but, when I run the code to make the optimization with Optimization.jl I got this error below. I already trie…

---

## [Solving nonconvex problems using Gurobi](https://discourse.julialang.org/t/solving-nonconvex-problems-using-gurobi/91283)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 1\
**Last updated:** [December 5, 2022, 10:39pm UTC](https://discourse.julialang.org/t/solving-nonconvex-problems-using-gurobi/91283 "2022-12-05T22:39:47Z")

</div>

I just wanted to confirm if this is the right way to solve a nonconvex problem with bilinear terms (continuous times continuous variables) using Gurobi. I assumed to define a nonlinear constraint or objective, I should b…

---

## [Evaluate a nonlinear expression at a point](https://discourse.julialang.org/t/evaluate-a-nonlinear-expression-at-a-point/91279)

<div class="topic-metadata">

**Author:** [@Mitch\_Phillipson](https://discourse.julialang.org/u/Mitch_Phillipson)\
**Replies:** 4\
**Last updated:** [December 5, 2022, 10:04pm UTC](https://discourse.julialang.org/t/evaluate-a-nonlinear-expression-at-a-point/91279 "2022-12-05T22:04:22Z")

</div>

I have a model with many nonlinear expressions and I would like to evaluate these to test my model. For example I have something like this using JuMP m = Model() @variable(m,x) @NLexpression(m,T,x^2) #What is T(x=2)…

---

## [Bug In Detecting Changed Constant in Objective Function](https://discourse.julialang.org/t/bug-in-detecting-changed-constant-in-objective-function/91235)

<div class="topic-metadata">

**Author:** [@elipivo](https://discourse.julialang.org/u/elipivo)\
**Replies:** 3\
**Last updated:** [December 5, 2022, 2:55pm UTC](https://discourse.julialang.org/t/bug-in-detecting-changed-constant-in-objective-function/91235 "2022-12-05T14:55:16Z")

</div>

I’m experiencing a bug where it appears the constant in the objective function doesn’t get updated using Gurobi, here is a quick example: model = Model(() -\> Gurobi.Optimizer(env)) @variable(model, x\[1:2\]) @constraint(m…

---

## [Is Julia Optimization fit for me?](https://discourse.julialang.org/t/is-julia-optimization-fit-for-me/90114)

<div class="topic-metadata">

**Author:** [@dhathri](https://discourse.julialang.org/u/dhathri)\
**Replies:** 6\
**Last updated:** [December 5, 2022, 4:51am UTC](https://discourse.julialang.org/t/is-julia-optimization-fit-for-me/90114 "2022-12-05T04:51:44Z")

</div>

Hello, I am new to Julia but not to optimization. I have implemented a large direct collocation constrained optimization NLP problem in MATLAB, it works but is a bit slow for my taste (takes about 5 minutes on average). …

---

## [L0 norm in JuMp?](https://discourse.julialang.org/t/l0-norm-in-jump/91222)

<div class="topic-metadata">

**Author:** [@Gaulex](https://discourse.julialang.org/u/Gaulex)\
**Replies:** 4\
**Last updated:** [December 4, 2022, 9:05pm UTC](https://discourse.julialang.org/t/l0-norm-in-jump/91222 "2022-12-04T21:05:23Z")

</div>

Hello, I would like to minimize the L0-norm of a vector (i.e. the number of non-zero element) using JuMp, but I really struggle to achieve it. I tried to define a function to represent the L0-norm: count\_nonzero(x) = s…

---

## [Errors using JuMP with Ipopt or HiGHS: UndefVarError: libipopt not defined and UndefVarError: libhighs not defined](https://discourse.julialang.org/t/errors-using-jump-with-ipopt-or-highs-undefvarerror-libipopt-not-defined-and-undefvarerror-libhighs-not-defined/78539)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 4\
**Last updated:** [December 4, 2022, 7:48pm UTC](https://discourse.julialang.org/t/errors-using-jump-with-ipopt-or-highs-undefvarerror-libipopt-not-defined-and-undefvarerror-libhighs-not-defined/78539 "2022-12-04T19:48:00Z")

</div>

I have Ipopt, OSQPand HiGHS installed. In Jupiter, when running the following script, n = size(Sigma,1) # Sigma is a 30x30 covariance matrix m = Model(Ipopt.Optimizer) @variable(m, w\[1:n\]) @objective(m, Min, w' …

---

## [Cannot convert QuadExpr - error in Julia v1.7 but not v.1.8 with PSDCone()](https://discourse.julialang.org/t/cannot-convert-quadexpr-error-in-julia-v1-7-but-not-v-1-8-with-psdcone/91202)

<div class="topic-metadata">

**Author:** [@malmassa](https://discourse.julialang.org/u/malmassa)\
**Replies:** 1\
**Last updated:** [December 4, 2022, 7:40pm UTC](https://discourse.julialang.org/t/cannot-convert-quadexpr-error-in-julia-v1-7-but-not-v-1-8-with-psdcone/91202 "2022-12-04T19:40:05Z")

</div>

Hi all, I teach a course on convex optimization and use Julia/JuMP (along with Matlab/CVX) to introduce students to implementation aspects – however, I am not a super-user of Julia/JuMP and may be missing something obvi…

---

## [JuMP, GLPK integer decision variable value tolerance](https://discourse.julialang.org/t/jump-glpk-integer-decision-variable-value-tolerance/91218)

<div class="topic-metadata">

**Author:** [@Gokhan\_Kof](https://discourse.julialang.org/u/Gokhan_Kof)\
**Replies:** 2\
**Last updated:** [December 4, 2022, 7:32pm UTC](https://discourse.julialang.org/t/jump-glpk-integer-decision-variable-value-tolerance/91218 "2022-12-04T19:32:56Z")

</div>

Hi, I was using GLPK within JuMP to solve an integer linear program. The value of the decision variables are close to integer values. I can just round them if they are within an accepted tolerance. However, GLPK optimi…

---

## [Monomials with variable of a model](https://discourse.julialang.org/t/monomials-with-variable-of-a-model/91048)

<div class="topic-metadata">

**Author:** [@irezvyakova](https://discourse.julialang.org/u/irezvyakova)\
**Replies:** 3\
**Last updated:** [December 3, 2022, 3:13am UTC](https://discourse.julialang.org/t/monomials-with-variable-of-a-model/91048 "2022-12-03T03:13:38Z")

</div>

Does there exist a nice way to use a certain variable of a model (say, model = Model(COSMO.Optimizer) @variable(model, u) @variable(model, t) ) to get a vector of monomials of \[u,t\] up to certain degree (say, 10) wi…

---

## [Optimization taking too long](https://discourse.julialang.org/t/optimization-taking-too-long/91159)

<div class="topic-metadata">

**Author:** [@mb96](https://discourse.julialang.org/u/mb96)\
**Replies:** 5\
**Last updated:** [December 3, 2022, 3:00am UTC](https://discourse.julialang.org/t/optimization-taking-too-long/91159 "2022-12-03T03:00:27Z")

</div>

Hi everyone, I am solving an optimization problem with a lot of variables through JuMP with Ipopt solver. The convergence time is extremely sensitive to one of my constraints: for example if I use a linear functional f…

---

## [Out of memory error in Juniper.jl](https://discourse.julialang.org/t/out-of-memory-error-in-juniper-jl/91094)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 7\
**Last updated:** [December 2, 2022, 10:19am UTC](https://discourse.julialang.org/t/out-of-memory-error-in-juniper-jl/91094 "2022-12-02T10:19:02Z")

</div>

Unfortunately I cannot practically create a MWE for this issue. I build a rather large MINLP model, it has 33,331 variables (2,218 binary), 157,260 constraints, 7,818 non linear constraints. When optimising, after 10 min…

---

## [Installing Pardiso on Julia (Mac)](https://discourse.julialang.org/t/installing-pardiso-on-julia-mac/91014)

<div class="topic-metadata">

**Author:** [@mb96](https://discourse.julialang.org/u/mb96)\
**Replies:** 18\
**Last updated:** [December 1, 2022, 10:18pm UTC](https://discourse.julialang.org/t/installing-pardiso-on-julia-mac/91014 "2022-12-01T22:18:33Z")

</div>

Hi everyone, I am trying to install Pardiso on Mac to be used through JuMP but I am a bit lost. I downloaded Pardison from the webpage and I have my academic license key but the file downloaded is “libpardiso600-MACOS-X…

---

## [How to convert \`x\[1\] = 1.0\` as $x\_1$ = 1.0 in Jupyter notebook?](https://discourse.julialang.org/t/how-to-convert-x-1-1-0-as-x-1-1-0-in-jupyter-notebook/91025)

<div class="topic-metadata">

**Author:** [@pppoe5](https://discourse.julialang.org/u/pppoe5)\
**Replies:** 2\
**Last updated:** [November 30, 2022, 3:07am UTC](https://discourse.julialang.org/t/how-to-convert-x-1-1-0-as-x-1-1-0-in-jupyter-notebook/91025 "2022-11-30T03:07:40Z")

</div>

MWE: using JuMP, GLPK model = Model(GLPK.Optimizer) @variable(model, x\[i=1:4\]\>= 0.5, Int) @objective(model, Min, sum(x)) optimize!(model) for x in all\_variables(model) println("$(name(x)) = $(value(x))") end As yo…

---

## [Get feasible solution from Couenne after time limit (JuMP)](https://discourse.julialang.org/t/get-feasible-solution-from-couenne-after-time-limit-jump/90999)

<div class="topic-metadata">

**Author:** [@Luca](https://discourse.julialang.org/u/Luca)\
**Replies:** 1\
**Last updated:** [November 29, 2022, 7:48pm UTC](https://discourse.julialang.org/t/get-feasible-solution-from-couenne-after-time-limit-jump/90999 "2022-11-29T19:48:40Z")

</div>

Dear all, I am solving a non-convex MINLP model with couenne with a time limit, let’s say 20 seconds. After 20 seconds, I obtain the following output: Couenne 0.5.8 -- an Open-Source solver for Mixed Integer Nonlinear …

---

## [Performance issue when using kronecker product with ForwardDiff.Dual type](https://discourse.julialang.org/t/performance-issue-when-using-kronecker-product-with-forwarddiff-dual-type/90299)

<div class="topic-metadata">

**Author:** [@mnavarrosudy](https://discourse.julialang.org/u/mnavarrosudy)\
**Replies:** 9\
**Last updated:** [November 27, 2022, 8:19am UTC](https://discourse.julialang.org/t/performance-issue-when-using-kronecker-product-with-forwarddiff-dual-type/90299 "2022-11-27T08:19:13Z")

</div>

Hello! I’m new to Julia, and I’m working on a constrained optimization problem using JuMP. I’m having a performance issue when calculating a kronecker product in a function that receives the type ForwardDiff.Dual. In p…

---

## [Scheduling and Capacity constraints with variable durations](https://discourse.julialang.org/t/scheduling-and-capacity-constraints-with-variable-durations/90845)

<div class="topic-metadata">

**Author:** [@JNSDVD](https://discourse.julialang.org/u/JNSDVD)\
**Replies:** 2\
**Last updated:** [November 27, 2022, 6:14pm UTC](https://discourse.julialang.org/t/scheduling-and-capacity-constraints-with-variable-durations/90845 "2022-11-27T18:14:31Z")

</div>

Hey people! I do have variable starting points (S) and variable Durations (D) per task. The former results from the predecessor relationships (see below), the latter from the allocation of resources to the task (j). @c…

---

## [JuMP semidefinite programming - formulating via constraints versus variables](https://discourse.julialang.org/t/jump-semidefinite-programming-formulating-via-constraints-versus-variables/90832)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 4\
**Last updated:** [November 26, 2022, 11:45pm UTC](https://discourse.julialang.org/t/jump-semidefinite-programming-formulating-via-constraints-versus-variables/90832 "2022-11-26T23:45:00Z")

</div>

I have the following two model definitions in JuMP. They are formally equivalent. Will one of them be more efficient than the other? Version 1: a = \[1.0 0.0; 0.0 1.0\] b = \[1.0 0.0; 0.0 -1.0\] @variable(model, x) @constr…

---

## [EAGO does not identify infeasbility of constraints in "easy" problem](https://discourse.julialang.org/t/eago-does-not-identify-infeasbility-of-constraints-in-easy-problem/90820)

<div class="topic-metadata">

**Author:** [@recallme](https://discourse.julialang.org/u/recallme)\
**Replies:** 2\
**Last updated:** [November 26, 2022, 1:37pm UTC](https://discourse.julialang.org/t/eago-does-not-identify-infeasbility-of-constraints-in-easy-problem/90820 "2022-11-26T13:37:40Z")

</div>

Hi, in the below problem I defined two constraints for which it is trivial to show analytically that they cannot be satisfied at the same time. However, the code takes lots of time and does not give back a clear unfeasi…

---

## [Abs in JuMP](https://discourse.julialang.org/t/abs-in-jump/90811)

<div class="topic-metadata">

**Author:** [@Salvador\_Catsis](https://discourse.julialang.org/u/Salvador_Catsis)\
**Replies:** 2\
**Last updated:** [November 26, 2022, 4:51am UTC](https://discourse.julialang.org/t/abs-in-jump/90811 "2022-11-26T04:51:02Z")

</div>

Hi, I’m fairly new to Julia and new to JuMP. I am trying to implement a simple optimisation problem. I haven’t asked many programming questions before so please forgive the formatting if it’s not appropriate. I have de…

---

## [Mosek does not give the optimal value derived by simplex methods](https://discourse.julialang.org/t/mosek-does-not-give-the-optimal-value-derived-by-simplex-methods/90727)

<div class="topic-metadata">

**Author:** [@Khashayar-Neshat](https://discourse.julialang.org/u/Khashayar-Neshat)\
**Replies:** 10\
**Last updated:** [November 25, 2022, 1:34pm UTC](https://discourse.julialang.org/t/mosek-does-not-give-the-optimal-value-derived-by-simplex-methods/90727 "2022-11-25T13:34:54Z")

</div>

I have a linear Polynomial Optimization problem (DSOS) programming, and I want to solve it with Mosek. Mosek first does the interior point method (IPM) and then switches to simplex method and reoptimizes it with simplex …

---

## [Warm start Mosek in a linear polynomial optimization problem](https://discourse.julialang.org/t/warm-start-mosek-in-a-linear-polynomial-optimization-problem/90478)

<div class="topic-metadata">

**Author:** [@Khashayar-Neshat](https://discourse.julialang.org/u/Khashayar-Neshat)\
**Replies:** 2\
**Last updated:** [November 25, 2022, 8:27am UTC](https://discourse.julialang.org/t/warm-start-mosek-in-a-linear-polynomial-optimization-problem/90478 "2022-11-25T08:27:02Z")

</div>

Hi, I have a polynomial optimization which is a linear programming (DSOS programming) and I want to use Mosek with warm start. In the following, I have two optimizations “m” and “m1”. I want to use the answer of Optimiz…

---

## [How to turn a dot into simple scaler expressions for nonlinear optimization using JUMP](https://discourse.julialang.org/t/how-to-turn-a-dot-into-simple-scaler-expressions-for-nonlinear-optimization-using-jump/90776)

<div class="topic-metadata">

**Author:** [@elliot000319](https://discourse.julialang.org/u/elliot000319)\
**Replies:** 1\
**Last updated:** [November 24, 2022, 8:40pm UTC](https://discourse.julialang.org/t/how-to-turn-a-dot-into-simple-scaler-expressions-for-nonlinear-optimization-using-jump/90776 "2022-11-24T20:40:31Z")

</div>

I want to turn the dot notation in this code to simple scaler operations for NLconstraint. I’ve checked the examples in JUMP’s documentation, but I could not get it to work. The following is the part that’s causing the…

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

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