# Optimization (Mathematical)

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

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

**Page:** 63

---

## [Lasso Regression of Matrix of Vectors](https://discourse.julialang.org/t/lasso-regression-of-matrix-of-vectors/81470)

<div class="topic-metadata">

**Author:** [@Alexander\_Scott](https://discourse.julialang.org/u/Alexander_Scott)\
**Replies:** 2\
**Last updated:** [May 22, 2022, 8:30pm UTC](https://discourse.julialang.org/t/lasso-regression-of-matrix-of-vectors/81470 "2022-05-22T20:30:02Z")

</div>

Hi all, I’m currently using Convex.jl as one of the packages to solve an optimisation problem. I was wondering if anyone may able to offer any insight into the issue I’m facing. Currently, I am trying to perform a Lass…

---

## [\[sparse modelling\] Does JuMP automatically remove "uninfluent" variables from constraints/objective?](https://discourse.julialang.org/t/sparse-modelling-does-jump-automatically-remove-uninfluent-variables-from-constraints-objective/81366)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 6\
**Last updated:** [May 22, 2022, 12:13am UTC](https://discourse.julialang.org/t/sparse-modelling-does-jump-automatically-remove-uninfluent-variables-from-constraints-objective/81366 "2022-05-22T00:13:02Z")

</div>

Hello, I am designing a non-linear model where some quantities depend from many variables, but only a few of them actually have a parameter that allow the dependent variable to play. The actual implementation is: quant…

---

## [JuMP turning off/on a constraint](https://discourse.julialang.org/t/jump-turning-off-on-a-constraint/81268)

<div class="topic-metadata">

**Author:** [@jvaes](https://discourse.julialang.org/u/jvaes)\
**Replies:** 6\
**Last updated:** [May 19, 2022, 10:19pm UTC](https://discourse.julialang.org/t/jump-turning-off-on-a-constraint/81268 "2022-05-19T22:19:38Z")

</div>

Hi there, I was wondering if JuMP has a way to turn off/on a constraint. According to the documentation, I can delete a constraint using the function delete (and then unregister if I want) but I cannot find a way to tu…

---

## [Is there a way to stop optimization process when feasible solution is found?](https://discourse.julialang.org/t/is-there-a-way-to-stop-optimization-process-when-feasible-solution-is-found/81025)

<div class="topic-metadata">

**Author:** [@afazevedo](https://discourse.julialang.org/u/afazevedo)\
**Replies:** 4\
**Last updated:** [May 19, 2022, 2:44pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-stop-optimization-process-when-feasible-solution-is-found/81025 "2022-05-19T14:44:23Z")

</div>

Hey there. I am solving a problem with lazy constraints using MOI callback interface. I want to know if there is a way to stop the branch-and-bound process when finding a new incumbent solution that is feasible? I don’t…

---

## [User cuts for BilevelJuMP model](https://discourse.julialang.org/t/user-cuts-for-bileveljump-model/81299)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 3\
**Last updated:** [May 19, 2022, 2:30pm UTC](https://discourse.julialang.org/t/user-cuts-for-bileveljump-model/81299 "2022-05-19T14:30:15Z")

</div>

How do I add cuts during the solve process when using BilevelJuMP.jl. My upper-level objective is a sum of binary variables and thus I know that my solution (optimal objective value) is eventually going to be an integer …

---

## [Fixing the value of some variables when defining it, not in the constraints](https://discourse.julialang.org/t/fixing-the-value-of-some-variables-when-defining-it-not-in-the-constraints/81218)

<div class="topic-metadata">

**Author:** [@CactusHamster](https://discourse.julialang.org/u/CactusHamster)\
**Replies:** 2\
**Last updated:** [May 17, 2022, 11:07pm UTC](https://discourse.julialang.org/t/fixing-the-value-of-some-variables-when-defining-it-not-in-the-constraints/81218 "2022-05-17T23:07:22Z")

</div>

I’m very new to JuMP so this might be a trivial question. We have a binary variable x\_{ij}. We would like to set x\_{ij} to be zero for some i and some j. So for example, nodes 1:10 cannot be assigned to nodes 1:5. So he…

---

## [How to add a linear constraint to optimize() using optim.jl?](https://discourse.julialang.org/t/how-to-add-a-linear-constraint-to-optimize-using-optim-jl/81176)

<div class="topic-metadata">

**Author:** [@jfanecon](https://discourse.julialang.org/u/jfanecon)\
**Replies:** 2\
**Last updated:** [May 17, 2022, 4:44am UTC](https://discourse.julialang.org/t/how-to-add-a-linear-constraint-to-optimize-using-optim-jl/81176 "2022-05-17T04:44:14Z")

</div>

Hi, I wanted to add a linear constraint to a maximization problem using optim.jl. It is a linear constraint and cannot be done by box constrain. As for algorithms, I will use both gradient free and Gradient required met…

---

## [Setting start values for only some indicies of a BilevelJuMP variable](https://discourse.julialang.org/t/setting-start-values-for-only-some-indicies-of-a-bileveljump-variable/81160)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 3\
**Last updated:** [May 17, 2022, 2:17am UTC](https://discourse.julialang.org/t/setting-start-values-for-only-some-indicies-of-a-bileveljump-variable/81160 "2022-05-17T02:17:00Z")

</div>

For the following BilevelJumP model, I want to set the start value for variable x 's even indices: using JuMP, BilevelJuMP, Gurobi a = \[1.0, 0.0, 1.0, 1.0, 0.0, 0.0\] model = BilevelModel(Gurobi.Optimizer, mode = Bilev…

---

## [Get results from CBC solver for optimization](https://discourse.julialang.org/t/get-results-from-cbc-solver-for-optimization/81135)

<div class="topic-metadata">

**Author:** [@ayodyas](https://discourse.julialang.org/u/ayodyas)\
**Replies:** 4\
**Last updated:** [May 16, 2022, 11:43am UTC](https://discourse.julialang.org/t/get-results-from-cbc-solver-for-optimization/81135 "2022-05-16T11:43:43Z")

</div>

I would like to know how to access the results (constraints value, variable value) from the model created using Cbc and Jump model in Julia

---

## [How to use ForwardDiff with NLopt?](https://discourse.julialang.org/t/how-to-use-forwarddiff-with-nlopt/53368)

<div class="topic-metadata">

**Author:** [@Michael\_Barmann](https://discourse.julialang.org/u/Michael_Barmann)\
**Replies:** 9\
**Last updated:** [May 15, 2022, 9:06pm UTC](https://discourse.julialang.org/t/how-to-use-forwarddiff-with-nlopt/53368 "2022-05-15T21:06:14Z")

</div>

I’m working on an optimization problem, and I’m trying to make use of the gradient-based algorithms in the NLopt library (specifically LD\_SLSQP). The objective function which I am trying to minimize does not have an anal…

---

## [Nested task error: AssertionError](https://discourse.julialang.org/t/nested-task-error-assertionerror/81041)

<div class="topic-metadata">

**Author:** [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Replies:** 2\
**Last updated:** [May 15, 2022, 2:37pm UTC](https://discourse.julialang.org/t/nested-task-error-assertionerror/81041 "2022-05-15T14:37:56Z")

</div>

recently i updated Julia to 1.7.2 which means that i had to update all the used packages, i am getting an assertion error, that is not clear to me knowing that the same exact code was running fine in Julia 1.5 using Plo…

---

## [Using eigenvalue in JuMP constraint](https://discourse.julialang.org/t/using-eigenvalue-in-jump-constraint/81076)

<div class="topic-metadata">

**Author:** [@Tri](https://discourse.julialang.org/u/Tri)\
**Replies:** 4\
**Last updated:** [May 15, 2022, 12:01pm UTC](https://discourse.julialang.org/t/using-eigenvalue-in-jump-constraint/81076 "2022-05-15T12:01:09Z")

</div>

I want to use the eigenvalues of the matrix Z in a constraint (e.g their sum or product) as in the following: using JuMP using LinearAlgebra model = Model() @variable(model, X\[1:2, 1:2\] \>= 0) @variable(model, c\[1:2\] \>= …

---

## [Turning a convex hull into a set of constraints](https://discourse.julialang.org/t/turning-a-convex-hull-into-a-set-of-constraints/80887)

<div class="topic-metadata">

**Author:** [@gobs](https://discourse.julialang.org/u/gobs)\
**Replies:** 13\
**Last updated:** [May 13, 2022, 5:21pm UTC](https://discourse.julialang.org/t/turning-a-convex-hull-into-a-set-of-constraints/80887 "2022-05-13T17:21:20Z")

</div>

I would like to turn the output of a convex hull into a set of constraints. I’m sure I could figure this out in a reasonable amount of time, but I was wondering if anyone had done this already. Otherwise I will post my s…

---

## [Does BilevelJuMP linearize terms (if possible) after reformulation?](https://discourse.julialang.org/t/does-bileveljump-linearize-terms-if-possible-after-reformulation/80981)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 2\
**Last updated:** [May 12, 2022, 11:20pm UTC](https://discourse.julialang.org/t/does-bileveljump-linearize-terms-if-possible-after-reformulation/80981 "2022-05-12T23:20:20Z")

</div>

How does BilevelJuMP.jl deal with non-linear terms in the complementarity conditions arising from the product of dual variables and the upper-level variables, especially when the upper-level variables are binary? For ex…

---

## [Convex.jl and Icnn](https://discourse.julialang.org/t/convex-jl-and-icnn/80942)

<div class="topic-metadata">

**Author:** [@bienpierre](https://discourse.julialang.org/u/bienpierre)\
**Replies:** 4\
**Last updated:** [May 12, 2022, 1:59pm UTC](https://discourse.julialang.org/t/convex-jl-and-icnn/80942 "2022-05-12T13:59:14Z")

</div>

Dear all, I would like to implement an Input Convex Neural Networks ICNN with the awesome convex.jl tool. The purpose to minimize a cost function. However, in order to get convexity with Icnn, weighting matrices are non…

---

## [How to modify JuMP model in-place to improve performance?](https://discourse.julialang.org/t/how-to-modify-jump-model-in-place-to-improve-performance/80563)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 14\
**Last updated:** [May 12, 2022, 1:28pm UTC](https://discourse.julialang.org/t/how-to-modify-jump-model-in-place-to-improve-performance/80563 "2022-05-12T13:28:47Z")

</div>

Hi all, I have a problem with improving the optimization speed of the JuMP model. My optimization problem is defined as follows: Below are some constants and assistant functions: using Distributions, LinearAlgebra us…

---

## [How to create Data.mat file for Convex.jl to solve optimal power flow using Matpower?](https://discourse.julialang.org/t/how-to-create-data-mat-file-for-convex-jl-to-solve-optimal-power-flow-using-matpower/80924)

<div class="topic-metadata">

**Author:** [@biswajit216](https://discourse.julialang.org/u/biswajit216)\
**Replies:** 1\
**Last updated:** [May 12, 2022, 2:47am UTC](https://discourse.julialang.org/t/how-to-create-data-mat-file-for-convex-jl-to-solve-optimal-power-flow-using-matpower/80924 "2022-05-12T02:47:29Z")

</div>

Hi, I’m a newbie learning Julia for optimal power flow formulation using convex optimization. I came across an example from Convex.jl documentation in here https://jump.dev/Convex.jl/stable/examples/optimization\_with\_c…

---

## [Problem with LogDetConeSquare](https://discourse.julialang.org/t/problem-with-logdetconesquare/80915)

<div class="topic-metadata">

**Author:** [@Zheming\_Wang](https://discourse.julialang.org/u/Zheming_Wang)\
**Replies:** 2\
**Last updated:** [May 11, 2022, 9:23pm UTC](https://discourse.julialang.org/t/problem-with-logdetconesquare/80915 "2022-05-11T21:23:58Z")

</div>

I’m trying to use LogDetConeSquare with Mosek. I got the following error: julia\> solver = optimizer\_with\_attributes(Mosek.Optimizer, MOI.Silent() =\> false) MathOptInterface.OptimizerWithAttributes(Mosek.Optimizer, Pair{…

---

## [Deleting upper and lower bounds JuMP@0.22.3 Clp@0.9.1](https://discourse.julialang.org/t/deleting-upper-and-lower-bounds-jump-0-22-3-clp-0-9-1/80842)

<div class="topic-metadata">

**Author:** [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Replies:** 3\
**Last updated:** [May 11, 2022, 11:38am UTC](https://discourse.julialang.org/t/deleting-upper-and-lower-bounds-jump-0-22-3-clp-0-9-1/80842 "2022-05-11T11:38:27Z")

</div>

It’s been quite some time since last time i used JuMP now i came back to it and changed some of old syntax of this code: using JuMP using Clp function scan\_maker(A) m = Model(Clp.Optimizer) JuMP.set\_optimizer\_a…

---

## [Parametron conflicts with Gurobi](https://discourse.julialang.org/t/parametron-conflicts-with-gurobi/80812)

<div class="topic-metadata">

**Author:** [@Vscinz](https://discourse.julialang.org/u/Vscinz)\
**Replies:** 3\
**Last updated:** [May 10, 2022, 7:02pm UTC](https://discourse.julialang.org/t/parametron-conflicts-with-gurobi/80812 "2022-05-10T19:02:25Z")

</div>

Hi, I tried to use Parametron.jl to solve a “parameterized family” of optimization problems (please see below) However, the inclusion of the package Parametron on Julia (v. 1.7.2) creates a problem with the package …

---

## [SCIP Concurrency (Multi-threading)](https://discourse.julialang.org/t/scip-concurrency-multi-threading/80814)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 1\
**Last updated:** [May 10, 2022, 2:44pm UTC](https://discourse.julialang.org/t/scip-concurrency-multi-threading/80814 "2022-05-10T14:44:12Z")

</div>

As of version 4 SCIP supports concurrency. It mentions here that the option "parallel/maxnthreads" must be set as appropriate, it also mentions that SCIP must be compiled differently to leverage this functionality and th…

---

## [Couple JuMP with the simulator](https://discourse.julialang.org/t/couple-jump-with-the-simulator/80792)

<div class="topic-metadata">

**Author:** [@Jack\_Tang](https://discourse.julialang.org/u/Jack_Tang)\
**Replies:** 4\
**Last updated:** [May 10, 2022, 8:42am UTC](https://discourse.julialang.org/t/couple-jump-with-the-simulator/80792 "2022-05-10T08:42:24Z")

</div>

Hi I am working on a project about multi-reservoir control optimization problem and the objective function is calculated by Telemac simulator. Do you have some examples or best practices for such integration? I have r…

---

## [JuMP Gurobi.jl CPLEX.jl Solution Pool](https://discourse.julialang.org/t/jump-gurobi-jl-cplex-jl-solution-pool/71604)

<div class="topic-metadata">

**Author:** [@davide-f](https://discourse.julialang.org/u/davide-f)\
**Replies:** 6\
**Last updated:** [May 9, 2022, 10:20pm UTC](https://discourse.julialang.org/t/jump-gurobi-jl-cplex-jl-solution-pool/71604 "2022-05-09T22:20:02Z")

</div>

Hi community, I was interested in setting and obtaining a solution pool for a MILP problem using a solver like CPLEX or Gurobi that support that capability. Do you know how I can proceed or suggestions? Thank you

---

## [System of NonLinear Equations with Inequality and Equality Constraints](https://discourse.julialang.org/t/system-of-nonlinear-equations-with-inequality-and-equality-constraints/80690)

<div class="topic-metadata">

**Author:** [@tugberk21](https://discourse.julialang.org/u/tugberk21)\
**Replies:** 4\
**Last updated:** [May 9, 2022, 3:47pm UTC](https://discourse.julialang.org/t/system-of-nonlinear-equations-with-inequality-and-equality-constraints/80690 "2022-05-09T15:47:08Z")

</div>

Hi All! I’m trying to switch Julia from MATLAB. I’m using MATLAB more specifically fmincon to solve system of nonlinear equations with inequality and equality constraints. Fmincon is great function for me which accepts …

---

## [Nonlinear expressions may contain only scalar](https://discourse.julialang.org/t/nonlinear-expressions-may-contain-only-scalar/80721)

<div class="topic-metadata">

**Author:** [@Tri](https://discourse.julialang.org/u/Tri)\
**Replies:** 5\
**Last updated:** [May 9, 2022, 10:16am UTC](https://discourse.julialang.org/t/nonlinear-expressions-may-contain-only-scalar/80721 "2022-05-09T10:16:08Z")

</div>

Totally new to Julia. I tried to look up a solution to this error message but couldn’t find a helpful answer “Nonlinear expressions may contain only scalar expressions” What exactly should I do to circumvent this error…

---

## [Optim.jl : first-order (and second-order) optimization without providing an objective function](https://discourse.julialang.org/t/optim-jl-first-order-and-second-order-optimization-without-providing-an-objective-function/80677)

<div class="topic-metadata">

**Author:** [@Rodrigue](https://discourse.julialang.org/u/Rodrigue)\
**Replies:** 13\
**Last updated:** [May 9, 2022, 6:24am UTC](https://discourse.julialang.org/t/optim-jl-first-order-and-second-order-optimization-without-providing-an-objective-function/80677 "2022-05-09T06:24:53Z")

</div>

Hi — I want to use the Optim.jl package to minimize some function. Say the gradient of my objective is “easy” to approximate using some additional procedure. Now, when appealing to first-order methods like gradient desce…

---

## [Too much time when i solve MISOCP with Gurobi](https://discourse.julialang.org/t/too-much-time-when-i-solve-misocp-with-gurobi/80644)

<div class="topic-metadata">

**Author:** [@mahon](https://discourse.julialang.org/u/mahon)\
**Replies:** 4\
**Last updated:** [May 7, 2022, 3:40am UTC](https://discourse.julialang.org/t/too-much-time-when-i-solve-misocp-with-gurobi/80644 "2022-05-07T03:40:22Z")

</div>

this is my model julia\> model A JuMP Model Minimization problem with: Variables: 8915 Objective function type: AffExpr \`AffExpr\`-in-\`MathOptInterface.EqualTo{Float64}\`: 2716 constraints \`AffExpr\`-in-\`MathOptInterface.Gr…

---

## [A question about write\_to\_file in JuMP](https://discourse.julialang.org/t/a-question-about-write-to-file-in-jump/80643)

<div class="topic-metadata">

**Author:** [@mahon](https://discourse.julialang.org/u/mahon)\
**Replies:** 1\
**Last updated:** [May 7, 2022, 3:25am UTC](https://discourse.julialang.org/t/a-question-about-write-to-file-in-jump/80643 "2022-05-07T03:25:12Z")

</div>

My model is a MISOCP model with Gurobi, if i want to solve it directly with Gurobi, how to code it? julia\> write\_to\_file(model, "model.lp") ERROR: MathOptInterface.UnsupportedConstraint{MathOptInterface.VectorAffineFunc…

---

## [Branching solution accepted although it violates presently added lazy constraints](https://discourse.julialang.org/t/branching-solution-accepted-although-it-violates-presently-added-lazy-constraints/80622)

<div class="topic-metadata">

**Author:** [@K5Julien](https://discourse.julialang.org/u/K5Julien)\
**Replies:** 5\
**Last updated:** [May 7, 2022, 1:03am UTC](https://discourse.julialang.org/t/branching-solution-accepted-although-it-violates-presently-added-lazy-constraints/80622 "2022-05-07T01:03:15Z")

</div>

I can not produce a MWE because the code is too big so I am going to describe. I have a JuMP model and Gurobi optimizer. I launch a callback where cb\_where is MIP\_SOL and all my variables are integer. On this callback, …

---

## [Optimization of large ODE/DAE system](https://discourse.julialang.org/t/optimization-of-large-ode-dae-system/80557)

<div class="topic-metadata">

**Author:** [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)\
**Replies:** 8\
**Last updated:** [May 6, 2022, 7:11pm UTC](https://discourse.julialang.org/t/optimization-of-large-ode-dae-system/80557 "2022-05-06T19:11:44Z")

</div>

Hi All, A big picture question about optimization of large ODE/DAE system. Suppose I have a big DAE system (number of equations ~ 100-200, number of parameters to optimize ~ 10-20) Julia has a bunch of optimization t…

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

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