# Optimization (Mathematical)

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

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

**Page:** 98

---

## [Parallel optimization/Genetic algorithm/Genetic programming](https://discourse.julialang.org/t/parallel-optimization-genetic-algorithm-genetic-programming/36805)

<div class="topic-metadata">

**Author:** [@Neurovium](https://discourse.julialang.org/u/Neurovium)\
**Replies:** 4\
**Last updated:** [June 21, 2020, 10:18pm UTC](https://discourse.julialang.org/t/parallel-optimization-genetic-algorithm-genetic-programming/36805 "2020-06-21T22:18:41Z")

</div>

Hi, I was planning to fully port a project to Julia. Checking the evolutionary optimization packages in Julia, I came across a few. It seems that the most mature one, Wallace (GitHub - ChrisTimperley/Wallace.jl: High-pe…

---

## [Optimizing a very expensive function evaluated in C++](https://discourse.julialang.org/t/optimizing-a-very-expensive-function-evaluated-in-c/41312)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 15\
**Last updated:** [June 22, 2020, 2:40am UTC](https://discourse.julialang.org/t/optimizing-a-very-expensive-function-evaluated-in-c/41312 "2020-06-22T02:40:26Z")

</div>

I am moving to Julia. I have a function which is implemented in C++ and currently have no time to migrate it to Julia. It depends on lots of parameters. It typically takes 1 hour - 1 week to compute a single value of thi…

---

## [Is the Hessian used in non linear JuMP?](https://discourse.julialang.org/t/is-the-hessian-used-in-non-linear-jump/41804)

<div class="topic-metadata">

**Author:** [@raphaelchinchilla](https://discourse.julialang.org/u/raphaelchinchilla)\
**Replies:** 3\
**Last updated:** [June 21, 2020, 6:18am UTC](https://discourse.julialang.org/t/is-the-hessian-used-in-non-linear-jump/41804 "2020-06-21T06:18:14Z")

</div>

For non linear optimization, JuMP allows user to create their own function and either use autodiff or specify the derivatives manually: https://jump.dev/JuMP.jl/v0.21.3/nlp/#User-defined-Functions-1 However the documen…

---

## [Create empty constraint with JuMP](https://discourse.julialang.org/t/create-empty-constraint-with-jump/41777)

<div class="topic-metadata">

**Author:** [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Replies:** 11\
**Last updated:** [June 21, 2020, 1:55am UTC](https://discourse.julialang.org/t/create-empty-constraint-with-jump/41777 "2020-06-21T01:55:57Z")

</div>

I have a part of my code in which it is simpler (far less ifs and edge cases) if I add empty constraints first and then, knowing all constraints I need are present in the model, change the coefficient of some variables i…

---

## [Silence mosek solver in JuMP](https://discourse.julialang.org/t/silence-mosek-solver-in-jump/41708)

<div class="topic-metadata">

**Author:** [@stephentu](https://discourse.julialang.org/u/stephentu)\
**Replies:** 2\
**Last updated:** [June 19, 2020, 10:25am UTC](https://discourse.julialang.org/t/silence-mosek-solver-in-jump/41708 "2020-06-19T10:25:50Z")

</div>

How do you disable the output from mosek when solving JuMP problems? I tried the following: model = Model(with\_optimizer(Mosek.Optimizer, QUIET=false)) model = Model(optimizer\_with\_attributes(Mosek.Optimizer, MOI.Silen…

---

## [Getting gradients for DiffEq with single derivative](https://discourse.julialang.org/t/getting-gradients-for-diffeq-with-single-derivative/41519)

<div class="topic-metadata">

**Author:** [@Janssena](https://discourse.julialang.org/u/Janssena)\
**Replies:** 3\
**Last updated:** [June 17, 2020, 11:06am UTC](https://discourse.julialang.org/t/getting-gradients-for-diffeq-with-single-derivative/41519 "2020-06-17T11:06:52Z")

</div>

Hey All, I’ve been meaning to calculate the gradient of an ODEProblem using Zygote, OrdinaryDiffEq, and DiffEqSensitivity. I’ve been running into a wide scala of errors along the way but found a way to do it. So initia…

---

## [What would you recommend for nolinear optimization with optional gradient and hessian](https://discourse.julialang.org/t/what-would-you-recommend-for-nolinear-optimization-with-optional-gradient-and-hessian/41555)

<div class="topic-metadata">

**Author:** [@sunjin](https://discourse.julialang.org/u/sunjin)\
**Replies:** 5\
**Last updated:** [June 17, 2020, 5:40am UTC](https://discourse.julialang.org/t/what-would-you-recommend-for-nolinear-optimization-with-optional-gradient-and-hessian/41555 "2020-06-17T05:40:52Z")

</div>

Hi, I am solving a numerical box-constrained nonlinear optimization problem with hundreds of unknowns. I currently implemented only the objective function but not the gradient or hessian. However, I expect to do so in th…

---

## [Stack overflow error with @SDconstraint](https://discourse.julialang.org/t/stack-overflow-error-with-sdconstraint/41557)

<div class="topic-metadata">

**Author:** [@stephentu](https://discourse.julialang.org/u/stephentu)\
**Replies:** 3\
**Last updated:** [June 17, 2020, 12:59am UTC](https://discourse.julialang.org/t/stack-overflow-error-with-sdconstraint/41557 "2020-06-17T00:59:30Z")

</div>

I have the following simple code snippet which is causing me issues: function find\_common\_lyapunov(system::PiecewiseLinearSystem, gamma::Float64) @assert(gamma \> 0.0) dim = system\_dim(system) model = Model(M…

---

## [How to use the summation in Julia?](https://discourse.julialang.org/t/how-to-use-the-summation-in-julia/41522)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 5\
**Last updated:** [June 16, 2020, 6:07pm UTC](https://discourse.julialang.org/t/how-to-use-the-summation-in-julia/41522 "2020-06-16T18:07:52Z")

</div>

I need to put this objective function in Julia, but I don’t know how to build a sum that has 3 indexes. Can someone help me? I started doing like this using JuMP, Cbc Model1 = Model(with\_optimizer(Cbc.Optimizer)) CR …

---

## [Playing with function composition, is there a name for what I'm doing?](https://discourse.julialang.org/t/playing-with-function-composition-is-there-a-name-for-what-im-doing/41533)

<div class="topic-metadata">

**Author:** [@klaff](https://discourse.julialang.org/u/klaff)\
**Replies:** 2\
**Last updated:** [June 16, 2020, 5:06pm UTC](https://discourse.julialang.org/t/playing-with-function-composition-is-there-a-name-for-what-im-doing/41533 "2020-06-16T17:06:34Z")

</div>

For AC analysis of circuits the following is handy: using Plots ZL(L) = f -\> im\*2π\*f\*L ZC(C) = f -\> 1/(im\*2π\*f\*C) ZR(R) = f -\> R series(a,b,c...) = f -\> sum(\[x(f) for x in \[\[a,b\]; \[c...\]\]\]) parallel(a,b,c...) = f -\> 1/…

---

## [Course indication for programming in Julia](https://discourse.julialang.org/t/course-indication-for-programming-in-julia/41266)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 3\
**Last updated:** [June 15, 2020, 5:25pm UTC](https://discourse.julialang.org/t/course-indication-for-programming-in-julia/41266 "2020-06-15T17:25:00Z")

</div>

I am learning to program in Julia and I would like to indicate specific courses for building linear programming models. Thanks!

---

## [How to declare a Boolean variable?](https://discourse.julialang.org/t/how-to-declare-a-boolean-variable/41279)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 4\
**Last updated:** [June 15, 2020, 5:22pm UTC](https://discourse.julialang.org/t/how-to-declare-a-boolean-variable/41279 "2020-06-15T17:22:47Z")

</div>

I need to declare a Boolean variable but I don’t know how to use Bool. How should I do ? I need the variable “i” to assume two values (1, 0) using JuMP, Cbc Model1 = Model(with\_optimizer(Cbc.Optimizer)) @variable(Mode…

---

## [How to set @variable(m, tau\[1:N\] \>0 ) with JuMP](https://discourse.julialang.org/t/how-to-set-variable-m-tau-1-n-0-with-jump/41244)

<div class="topic-metadata">

**Author:** [@namch](https://discourse.julialang.org/u/namch)\
**Replies:** 4\
**Last updated:** [June 15, 2020, 8:10am UTC](https://discourse.julialang.org/t/how-to-set-variable-m-tau-1-n-0-with-jump/41244 "2020-06-15T08:10:45Z")

</div>

I get an error when trying to set variables larger than zero. Is there any way to over come this? ERROR: LoadError: LoadError: In @variable(m, tau\[1:N\] \> 0): Unknown sense \> Thank you

---

## [RHS and LHS inconsistency in indexing over constraints](https://discourse.julialang.org/t/rhs-and-lhs-inconsistency-in-indexing-over-constraints/41409)

<div class="topic-metadata">

**Author:** [@barguzin](https://discourse.julialang.org/u/barguzin)\
**Replies:** 2\
**Last updated:** [June 15, 2020, 1:33am UTC](https://discourse.julialang.org/t/rhs-and-lhs-inconsistency-in-indexing-over-constraints/41409 "2020-06-15T01:33:34Z")

</div>

Hi folks, This is my first time using Julia for math optimization (was previously running Xpress FICO). I am trying to run a relatively easy anti-covering model. But I am running into issue with indices (or something e…

---

## [A question about Plots](https://discourse.julialang.org/t/a-question-about-plots/41311)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 3\
**Last updated:** [June 13, 2020, 4:16am UTC](https://discourse.julialang.org/t/a-question-about-plots/41311 "2020-06-13T04:16:52Z")

</div>

The program has run ,but the scatter diagram does not show ,why? Is it too much data in my code?

---

## [Using Flux to optimize a function of the Singular Values](https://discourse.julialang.org/t/using-flux-to-optimize-a-function-of-the-singular-values/39687)

<div class="topic-metadata">

**Author:** [@rajnrao](https://discourse.julialang.org/u/rajnrao)\
**Replies:** 6\
**Last updated:** [June 11, 2020, 3:04pm UTC](https://discourse.julialang.org/t/using-flux-to-optimize-a-function-of-the-singular-values/39687 "2020-06-11T15:04:13Z")

</div>

Update – using latest Flux. I’d like to optimize a function of the singular values of a matrix. The Flux training loop barfs. Here’s my code using Flux, ForwardDiff, LinearAlgebra, GenericLinearAlgebra m = 20 X = rand…

---

## [AmplNLWriter with JuMP 0.21.2](https://discourse.julialang.org/t/amplnlwriter-with-jump-0-21-2/38545)

<div class="topic-metadata">

**Author:** [@noamgold](https://discourse.julialang.org/u/noamgold)\
**Replies:** 13\
**Last updated:** [June 11, 2020, 2:24pm UTC](https://discourse.julialang.org/t/amplnlwriter-with-jump-0-21-2/38545 "2020-06-11T14:24:26Z")

</div>

How to use Couenne (using AmplNLWriter) following the recent changes to the JuMP interface. In particular I am trying m = Model( () → AmplNLSolver(“couenne”) ) and I get the following error: ERROR: LoadError: The pro…

---

## [Construction of the objective function for a mathematical model](https://discourse.julialang.org/t/construction-of-the-objective-function-for-a-mathematical-model/40765)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 11\
**Last updated:** [June 9, 2020, 1:29pm UTC](https://discourse.julialang.org/t/construction-of-the-objective-function-for-a-mathematical-model/40765 "2020-06-09T13:29:11Z")

</div>

Could someone help me in the construction of this objective function? Every time I try to compile the same array error appears using JuMP, Cbc C1 = \[11; 11; 11; 11; 11\] C2 = \[50; 50; 50; 50; 50\] #Sets i = 80 #activiti…

---

## [Interested in Constraints Programming & Optimization, have some basic questions](https://discourse.julialang.org/t/interested-in-constraints-programming-optimization-have-some-basic-questions/36274)

<div class="topic-metadata">

**Author:** [@GavinRay](https://discourse.julialang.org/u/GavinRay)\
**Replies:** 6\
**Last updated:** [June 8, 2020, 4:56pm UTC](https://discourse.julialang.org/t/interested-in-constraints-programming-optimization-have-some-basic-questions/36274 "2020-06-08T16:56:08Z")

</div>

I apologize in advance for how likely stupid this is going to come off, but I have a few questions and was hoping someone might be kind enough to offer some insight. I became interested in Logic/Constraints programming …

---

## [Write to MPS](https://discourse.julialang.org/t/write-to-mps/40995)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 1\
**Last updated:** [June 8, 2020, 3:37pm UTC](https://discourse.julialang.org/t/write-to-mps/40995 "2020-06-08T15:37:02Z")

</div>

How does the MPS writer of Gurobi work? using JuMP, Gurobi model = Model(Gurobi.Optimizer) @variables(model, begin 0 \<= x \<= 5 0 \<= y \<= 10, Int z, Bin end) @objective(model, Max, x + 2y + 5z) @constraint…

---

## [A question about Fuzzy C-means code](https://discourse.julialang.org/t/a-question-about-fuzzy-c-means-code/40988)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 2\
**Last updated:** [June 8, 2020, 2:47pm UTC](https://discourse.julialang.org/t/a-question-about-fuzzy-c-means-code/40988 "2020-06-08T14:47:48Z")

</div>

using RDatasets, Clustering, Plots using DataFrames using CSV iris = dataset("datasets", "iris"); # load the data features = collect(Matrix(iris\[:, 1:4\])'); # features to use for clustering result = fuzzy\_cmeans(features…

---

## [Cplex.jl change parameters and display info](https://discourse.julialang.org/t/cplex-jl-change-parameters-and-display-info/40821)

<div class="topic-metadata">

**Author:** [@geoffroyleconte](https://discourse.julialang.org/u/geoffroyleconte)\
**Replies:** 4\
**Last updated:** [June 8, 2020, 9:19am UTC](https://discourse.julialang.org/t/cplex-jl-change-parameters-and-display-info/40821 "2020-06-08T09:19:04Z")

</div>

Hello, I am trying to use cplex.jl to solve linear problems without using JuMP or MOI. I want to use the barrier method without presolve and crossover/vertex, so I used these commands: CPLEX.set\_param!(env, "CPX\_PARAM…

---

## [Absolute value in JuMP](https://discourse.julialang.org/t/absolute-value-in-jump/40911)

<div class="topic-metadata">

**Author:** [@sobhan](https://discourse.julialang.org/u/sobhan)\
**Replies:** 2\
**Last updated:** [June 7, 2020, 1:52pm UTC](https://discourse.julialang.org/t/absolute-value-in-jump/40911 "2020-06-07T13:52:08Z")

</div>

I’m trying to optimize the absolute value of an affine function, for example, something like: using JuMP model = Model() @variable(model, x) @objective(model, Min, abs(x)) but i get Closest candidates are: abs(::Boo…

---

## [JuMP 0.21: how to efficiently delete non-binding constraints in an LP?](https://discourse.julialang.org/t/jump-0-21-how-to-efficiently-delete-non-binding-constraints-in-an-lp/40650)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 5\
**Last updated:** [June 5, 2020, 9:58pm UTC](https://discourse.julialang.org/t/jump-0-21-how-to-efficiently-delete-non-binding-constraints-in-an-lp/40650 "2020-06-05T21:58:46Z")

</div>

Dear folks, I like to delete non-binding constraints in an LP, i.e., constraints with zero shadow price, and then re-optimize. I tried: optimize!( model ) if has\_duals( model ) num\_cons = num\_constraints(model, Gen…

---

## [Using ANTIGONE from Julia](https://discourse.julialang.org/t/using-antigone-from-julia/10917)

<div class="topic-metadata">

**Author:** [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Replies:** 6\
**Last updated:** [June 4, 2020, 2:10pm UTC](https://discourse.julialang.org/t/using-antigone-from-julia/10917 "2020-06-04T14:10:29Z")

</div>

I’ve been investigating the various options for (globally optimal) MINLP in Julia, and ANTIGONE looks like a nice option. I’m curious if anyone has any experience using it from Julia. At first glance, it looks like this…

---

## [PATHSolver.jl error using map](https://discourse.julialang.org/t/pathsolver-jl-error-using-map/40724)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 3\
**Last updated:** [June 4, 2020, 1:36pm UTC](https://discourse.julialang.org/t/pathsolver-jl-error-using-map/40724 "2020-06-04T13:36:08Z")

</div>

I am using PATHSolver to solve linear complementarity problems. I have no problem when using it “normally”, but I get this error when I use parallel computing, as below. What seems to be problematic is the presence of t…

---

## [Contours with equal area changing system](https://discourse.julialang.org/t/contours-with-equal-area-changing-system/40644)

<div class="topic-metadata">

**Author:** [@Tamuzd](https://discourse.julialang.org/u/Tamuzd)\
**Replies:** 3\
**Last updated:** [June 3, 2020, 9:03am UTC](https://discourse.julialang.org/t/contours-with-equal-area-changing-system/40644 "2020-06-03T09:03:39Z")

</div>

Let’s say I have a system with 3 particles in 2d system a,b,c with the following positions a = \[0.1,0.0\] b = \[-0.1,0.0\] c = \[0.0,0.1\] each particle is described by Gaussian function, therefore the system function is as…

---

## [Generating equations in ModellingToolkit from infinite series](https://discourse.julialang.org/t/generating-equations-in-modellingtoolkit-from-infinite-series/40244)

<div class="topic-metadata">

**Author:** [@Bogo](https://discourse.julialang.org/u/Bogo)\
**Replies:** 5\
**Last updated:** [June 2, 2020, 7:28pm UTC](https://discourse.julialang.org/t/generating-equations-in-modellingtoolkit-from-infinite-series/40244 "2020-06-02T19:28:44Z")

</div>

Hi all! I was advised to open this issue as a follow-up of this thread: https://discourse.julialang.org/t/speeding-up-solution-to-the-large-system-of-non-linear-complex-valued-odes/39075 My issue: I am generating nonli…

---

## [JuMP conditional constraint](https://discourse.julialang.org/t/jump-conditional-constraint/40575)

<div class="topic-metadata">

**Author:** [@m.lavaiyan](https://discourse.julialang.org/u/m.lavaiyan)\
**Replies:** 9\
**Last updated:** [June 2, 2020, 2:21pm UTC](https://discourse.julialang.org/t/jump-conditional-constraint/40575 "2020-06-02T14:21:28Z")

</div>

I want to implement a conditional constraint to my model where each non-zero variable, force the next two variables to be zero. In other words, if x\[t\]=0 then x\[t+1\]=0 and x\[t+2\]=0. I tried a quadratic constrain as belo…

---

## [Performance of lp\_rhs\_perturbation\_range](https://discourse.julialang.org/t/performance-of-lp-rhs-perturbation-range/40551)

<div class="topic-metadata">

**Author:** [@gleyland](https://discourse.julialang.org/u/gleyland)\
**Replies:** 4\
**Last updated:** [June 1, 2020, 10:01pm UTC](https://discourse.julialang.org/t/performance-of-lp-rhs-perturbation-range/40551 "2020-06-01T22:01:13Z")

</div>

Hi, I have a JuMP model (an LP, currently solved with GLPK) for which I query shadow prices and perturbation ranges of a number of (a few thousand in a large-ish problem) constraints. Solving the LP takes a couple of s…

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

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