# Optimization (Mathematical)

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

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

**Page:** 59

---

## [How to solve the problem of julia loading Moesk?](https://discourse.julialang.org/t/how-to-solve-the-problem-of-julia-loading-moesk/85467)

<div class="topic-metadata">

**Author:** [@sand\_feifsndali](https://discourse.julialang.org/u/sand_feifsndali)\
**Replies:** 2\
**Last updated:** [August 12, 2022, 3:13am UTC](https://discourse.julialang.org/t/how-to-solve-the-problem-of-julia-loading-moesk/85467 "2022-08-12T03:13:23Z")

</div>

Downloaded a MosekTools, but when using MosekTools, it will ask to build (“Mosek”), and there are various problems when building, as shown in the figure How to solve this problem, do I need to download a moesk softwa…

---

## [IloIfThen constraints for CPLEX in Julia](https://discourse.julialang.org/t/iloifthen-constraints-for-cplex-in-julia/85619)

<div class="topic-metadata">

**Author:** [@Deoch](https://discourse.julialang.org/u/Deoch)\
**Replies:** 3\
**Last updated:** [August 11, 2022, 11:58pm UTC](https://discourse.julialang.org/t/iloifthen-constraints-for-cplex-in-julia/85619 "2022-08-11T23:58:19Z")

</div>

Hello, I need to use the conditional constraints for a JuMP model with CPLEX, that would be IloIfThen in C++. Like if I have three variables x, y and z, a constraint like: If (x \>= 1) && (y \<= 2) then z == 1 I am usin…

---

## [Each successive run of JuMP in VS Code gets slower](https://discourse.julialang.org/t/each-successive-run-of-jump-in-vs-code-gets-slower/85497)

<div class="topic-metadata">

**Author:** [@Anjinsan](https://discourse.julialang.org/u/Anjinsan)\
**Replies:** 2\
**Last updated:** [August 11, 2022, 1:16am UTC](https://discourse.julialang.org/t/each-successive-run-of-jump-in-vs-code-gets-slower/85497 "2022-08-11T01:16:57Z")

</div>

While using VS Code to run a Julia (JuMP) optimization model (using Gurobi for the optimization), I’ve noticed that each subsequent run I do of the program (even if I make no changes in it) takes longer. The run times f…

---

## [How can lazy constraints be written in a \*.lp file?](https://discourse.julialang.org/t/how-can-lazy-constraints-be-written-in-a-lp-file/85324)

<div class="topic-metadata">

**Author:** [@Somayeh\_Esmaeili](https://discourse.julialang.org/u/Somayeh_Esmaeili)\
**Replies:** 9\
**Last updated:** [August 10, 2022, 2:21pm UTC](https://discourse.julialang.org/t/how-can-lazy-constraints-be-written-in-a-lp-file/85324 "2022-08-10T14:21:17Z")

</div>

I need to convert the codes in \*.lp file. But the lazy constraints can not be converted. Would you please help me? Thanks very much using JuMP,CPLEX T=Model(solver=CplexSolver()); #Sets----------------------------------…

---

## [Access variables in vector using Symbols](https://discourse.julialang.org/t/access-variables-in-vector-using-symbols/85432)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 7\
**Last updated:** [August 10, 2022, 9:17am UTC](https://discourse.julialang.org/t/access-variables-in-vector-using-symbols/85432 "2022-08-10T09:17:44Z")

</div>

I have a model with variables defined as a is below, I need to be able to access the models variables in a model agnostic way. For this I use Symbols as model\[:b\] will get me b for any model which has a variable b. How …

---

## [What is the best way to separate out indices of a variable?](https://discourse.julialang.org/t/what-is-the-best-way-to-separate-out-indices-of-a-variable/85317)

<div class="topic-metadata">

**Author:** [@A\_Green\_Leave](https://discourse.julialang.org/u/A_Green_Leave)\
**Replies:** 3\
**Last updated:** [August 10, 2022, 7:07am UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-separate-out-indices-of-a-variable/85317 "2022-08-10T07:07:22Z")

</div>

Hi guys, What do you recommend to do in this situation? I have a set M consisting of three separate sets of vectors of various size. In other words M = \[m\_1, m\_2, m\_3\] where m\_i are vectors of different sizes. For ins…

---

## [Genetic algorithms support for optimization with julia](https://discourse.julialang.org/t/genetic-algorithms-support-for-optimization-with-julia/85512)

<div class="topic-metadata">

**Author:** [@chenr86](https://discourse.julialang.org/u/chenr86)\
**Replies:** 6\
**Last updated:** [August 9, 2022, 12:09pm UTC](https://discourse.julialang.org/t/genetic-algorithms-support-for-optimization-with-julia/85512 "2022-08-09T12:09:36Z")

</div>

Hello, I’m dealing with multi-objective optimization problem. I wonder if there is any support of genetic algorithm with Julia. Besides, compared with other solvers, does GA perform well solving MOO? For example, it cos…

---

## [PowerModels/PowerModelsDistribution lack of documentation for storage models](https://discourse.julialang.org/t/powermodels-powermodelsdistribution-lack-of-documentation-for-storage-models/85358)

<div class="topic-metadata">

**Author:** [@apigott](https://discourse.julialang.org/u/apigott)\
**Replies:** 3\
**Last updated:** [August 8, 2022, 4:58pm UTC](https://discourse.julialang.org/t/powermodels-powermodelsdistribution-lack-of-documentation-for-storage-models/85358 "2022-08-08T16:58:32Z")

</div>

Hi! New to PM/PMD and currently trying to figure out the OPF with a storage model, unfortunately I’m getting pretty stumped by the results dictionary. I attempted adding storage with the following: case\_file = "../Powe…

---

## [How to use elements of a N\*M elements Vector of Vector for a constraint](https://discourse.julialang.org/t/how-to-use-elements-of-a-n-m-elements-vector-of-vector-for-a-constraint/85295)

<div class="topic-metadata">

**Author:** [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Replies:** 5\
**Last updated:** [August 7, 2022, 12:28pm UTC](https://discourse.julialang.org/t/how-to-use-elements-of-a-n-m-elements-vector-of-vector-for-a-constraint/85295 "2022-08-07T12:28:50Z")

</div>

Hi, We have two sets A = \[1,2,...,N\] and B = \[1,2,...,M\]. There are two other sets SA, SB associated with A and Bwhich are N-elements and M-elemets vector of vector. A = \[1:N\] B = \[1:M\] SA = \[ \[some stuff for 1\] , \[s…

---

## [Regarding use of Max in Jump code](https://discourse.julialang.org/t/regarding-use-of-max-in-jump-code/84837)

<div class="topic-metadata">

**Author:** [@Ali9266](https://discourse.julialang.org/u/Ali9266)\
**Replies:** 30\
**Last updated:** [August 5, 2022, 11:57pm UTC](https://discourse.julialang.org/t/regarding-use-of-max-in-jump-code/84837 "2022-08-05T23:57:31Z")

</div>

Objective function is to minimize Z(i) =T(i)+E(i) ; i = 1:n where T(i) = max\[ x(i) - y(i), 0\] and E = max\[ y(i) - x(i), 0\] Please help Also , how can we take absolute values in Jump

---

## [\[ANN\] Clarabel.jl: New convex optimization solver](https://discourse.julialang.org/t/ann-clarabel-jl-new-convex-optimization-solver/83915)

<div class="topic-metadata">

**Author:** [@pgoulart](https://discourse.julialang.org/u/pgoulart)\
**Replies:** 20\
**Last updated:** [August 4, 2022, 4:39pm UTC](https://discourse.julialang.org/t/ann-clarabel-jl-new-convex-optimization-solver/83915 "2022-08-04T16:39:29Z")

</div>

Dear Julia Optimizers, We are happy to announce the release of Clarabel.jl v0.1.0, a new interior point code for conic optimization written entirely in Julia. The code currently supports LP/QP/SOCP/SDP problems and can…

---

## [MOSEK fatal error stopenv](https://discourse.julialang.org/t/mosek-fatal-error-stopenv/51590)

<div class="topic-metadata">

**Author:** [@cyanzhao42](https://discourse.julialang.org/u/cyanzhao42)\
**Replies:** 5\
**Last updated:** [August 4, 2022, 9:24am UTC](https://discourse.julialang.org/t/mosek-fatal-error-stopenv/51590 "2022-08-04T09:24:13Z")

</div>

Hi all, I try to use JuMP with MOSEK. After formulated the problem, and start solving the problem, I have received this error message. Any suggestions on what going on here or how I can figure this out? Thanks! MOSEK f…

---

## [Optim.jl - get the hessian matrix from maximum likelihood estimation](https://discourse.julialang.org/t/optim-jl-get-the-hessian-matrix-from-maximum-likelihood-estimation/70615)

<div class="topic-metadata">

**Author:** [@Strange\_Xue](https://discourse.julialang.org/u/Strange_Xue)\
**Replies:** 6\
**Last updated:** [August 3, 2022, 7:13pm UTC](https://discourse.julialang.org/t/optim-jl-get-the-hessian-matrix-from-maximum-likelihood-estimation/70615 "2022-08-03T19:13:11Z")

</div>

There exists an example at Optim.jl’s tutorial, I copy the code here. using Optim, NLSolversBase, Random using LinearAlgebra: diag Random.seed!(0); # Fix random seed generator for reproducibil…

---

## [Mixed-Integer Multi-objective Constrained Optimization Problem Solving](https://discourse.julialang.org/t/mixed-integer-multi-objective-constrained-optimization-problem-solving/83030)

<div class="topic-metadata">

**Author:** [@Magy](https://discourse.julialang.org/u/Magy)\
**Replies:** 4\
**Last updated:** [July 31, 2022, 11:43pm UTC](https://discourse.julialang.org/t/mixed-integer-multi-objective-constrained-optimization-problem-solving/83030 "2022-07-31T23:43:51Z")

</div>

Dear All, I wonder if there is a direct package that can be used to solve a mixed-integer multi-objective constrained problem. I tried to use “Metaheuristics.jl” but failed to represent my model’s mixed-integer variable…

---

## [Nonlinear curve fitting in Julia](https://discourse.julialang.org/t/nonlinear-curve-fitting-in-julia/84999)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 4\
**Last updated:** [July 29, 2022, 9:20pm UTC](https://discourse.julialang.org/t/nonlinear-curve-fitting-in-julia/84999 "2022-07-29T21:20:33Z")

</div>

Hi all, My question is to do a nonlinear curve fitting task (bounded) for estimating 10 parameters from several give data points, presented as follows: using Optim # my data points I = \[100.254, 94.261, 88.224, 82.193,…

---

## [JuMP 2-d array Decision Variable computationally expensive](https://discourse.julialang.org/t/jump-2-d-array-decision-variable-computationally-expensive/84987)

<div class="topic-metadata">

**Author:** [@sophiepavia](https://discourse.julialang.org/u/sophiepavia)\
**Replies:** 1\
**Last updated:** [July 29, 2022, 6:37pm UTC](https://discourse.julialang.org/t/jump-2-d-array-decision-variable-computationally-expensive/84987 "2022-07-29T18:37:00Z")

</div>

I am creating a decision variable that is a 2-d array of size 25122 x 25122. (length of arcs and od are both 25122) Is there a more efficient way to initialize a multi-dimensional array as a decision variable? I have ch…

---

## [Matrix Completion](https://discourse.julialang.org/t/matrix-completion/84879)

<div class="topic-metadata">

**Author:** [@Fadi\_Hamad](https://discourse.julialang.org/u/Fadi_Hamad)\
**Replies:** 4\
**Last updated:** [July 28, 2022, 2:01pm UTC](https://discourse.julialang.org/t/matrix-completion/84879 "2022-07-28T14:01:11Z")

</div>

Hello, I am trying to formulate (unconstrained form) the Matrix completion problem in JuMP. I am trying this formulation based on minimizing the square loss and the Frobenius norm, but this formulation always leads to …

---

## [Number of points in Pareto front](https://discourse.julialang.org/t/number-of-points-in-pareto-front/84741)

<div class="topic-metadata">

**Author:** [@chenr86](https://discourse.julialang.org/u/chenr86)\
**Replies:** 5\
**Last updated:** [July 28, 2022, 8:56am UTC](https://discourse.julialang.org/t/number-of-points-in-pareto-front/84741 "2022-07-28T08:56:11Z")

</div>

Hello, I’m using MultiJuMP.jl to solve a MOO problem with 2 objectives, f1 and f2. Here, f1 is a continuous function to minimize, f2 is an integer function to maximize. When I post model.pointsperdim = 10, I got a pare…

---

## [Easier Solver Callback for JuMP.lj + Gurobi](https://discourse.julialang.org/t/easier-solver-callback-for-jump-lj-gurobi/84889)

<div class="topic-metadata">

**Author:** [@chelseas](https://discourse.julialang.org/u/chelseas)\
**Replies:** 2\
**Last updated:** [July 28, 2022, 5:45am UTC](https://discourse.julialang.org/t/easier-solver-callback-for-jump-lj-gurobi/84889 "2022-07-28T05:45:49Z")

</div>

I would like to write a callback function that does something similar to this: (gurobipy) but it seems much more complicated to do this in JuMP :frowning\_face:. see and here \[ANN\] Upcoming breaking changes to CPLE…

---

## [Parameter optimization of MethodOfLines PDE](https://discourse.julialang.org/t/parameter-optimization-of-methodoflines-pde/84647)

<div class="topic-metadata">

**Author:** [@thompsonmj](https://discourse.julialang.org/u/thompsonmj)\
**Replies:** 10\
**Last updated:** [July 27, 2022, 2:35pm UTC](https://discourse.julialang.org/t/parameter-optimization-of-methodoflines-pde/84647 "2022-07-27T14:35:07Z")

</div>

I’d like to optimize parameters in the MOL example shown here with an RMSD cost function to minimize. Following a WIP example here to build the OptimizationFunction, I have the following, but the results come back predi…

---

## [Question on allowing user to specify the optimization sense](https://discourse.julialang.org/t/question-on-allowing-user-to-specify-the-optimization-sense/84836)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 2\
**Last updated:** [July 27, 2022, 2:53am UTC](https://discourse.julialang.org/t/question-on-allowing-user-to-specify-the-optimization-sense/84836 "2022-07-27T02:53:49Z")

</div>

I have a small package in which I solve an optimization model. The sense of the objective function is to be specified by the user. Now, I export MAX\_SENSE and MIN\_SENSE for the user to use them. A small example: module …

---

## [How to gain access variables as soons as they are assigned a value?](https://discourse.julialang.org/t/how-to-gain-access-variables-as-soons-as-they-are-assigned-a-value/84747)

<div class="topic-metadata">

**Author:** [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Replies:** 5\
**Last updated:** [July 25, 2022, 7:55pm UTC](https://discourse.julialang.org/t/how-to-gain-access-variables-as-soons-as-they-are-assigned-a-value/84747 "2022-07-25T19:55:47Z")

</div>

I was wondering whether in JuMP is possible to be aware of the value of variables while the model is still running?? I mean, suppose we have a set of binary variables x(i,j) i,j in \[1,2,3,...,n\]. Is there any possiblit…

---

## [Does MultiJuMP.jl have multithreading or multi-core support?](https://discourse.julialang.org/t/does-multijump-jl-have-multithreading-or-multi-core-support/84739)

<div class="topic-metadata">

**Author:** [@chenr86](https://discourse.julialang.org/u/chenr86)\
**Replies:** 1\
**Last updated:** [July 25, 2022, 8:40am UTC](https://discourse.julialang.org/t/does-multijump-jl-have-multithreading-or-multi-core-support/84739 "2022-07-25T08:40:43Z")

</div>

Hello, I’m using MultiJuMP.jl and Juniper to solve an MINLP problem. It takes more than 2 hours to optimize the problem using one core. I wonder how can I accelerate the calculation process. Can I run my code with multi…

---

## [NLopt return flag: is there a simple way to check for success?](https://discourse.julialang.org/t/nlopt-return-flag-is-there-a-simple-way-to-check-for-success/84637)

<div class="topic-metadata">

**Author:** [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Replies:** 2\
**Last updated:** [July 23, 2022, 4:35am UTC](https://discourse.julialang.org/t/nlopt-return-flag-is-there-a-simple-way-to-check-for-success/84637 "2022-07-23T04:35:50Z")

</div>

NLopt.optimize returns a tuple (objvalue, xopt, flag), and flag is a symbol that can hold strings such as FTOL\_REACHED or SUCCESS. The C API mentions that positive return values indicate success. Is there a similar way t…

---

## [Pass information between optimization iteration](https://discourse.julialang.org/t/pass-information-between-optimization-iteration/84598)

<div class="topic-metadata">

**Author:** [@emurrayl](https://discourse.julialang.org/u/emurrayl)\
**Replies:** 2\
**Last updated:** [July 21, 2022, 7:06pm UTC](https://discourse.julialang.org/t/pass-information-between-optimization-iteration/84598 "2022-07-21T19:06:32Z")

</div>

Hi everyone, I am trying to optimize a likelihood function. However, for each guess of the parameter value, I need to solve a value function iteration (VFI) problem to compute the likelihood. To speed up the process, I …

---

## [Error accessing elements within constraint matrix](https://discourse.julialang.org/t/error-accessing-elements-within-constraint-matrix/84565)

<div class="topic-metadata">

**Author:** [@brett\_d](https://discourse.julialang.org/u/brett_d)\
**Replies:** 2\
**Last updated:** [July 21, 2022, 10:55am UTC](https://discourse.julialang.org/t/error-accessing-elements-within-constraint-matrix/84565 "2022-07-21T10:55:54Z")

</div>

I am trying to write a constraint that sums the process times for each row of a matrix, Z\[a,p\] where Z is a binary decision variable = 1 if a is assigned p; = 0 otherwise. I am trying to multiply the 1’s in the row by t…

---

## [Calculate the number of values greater than a certain value](https://discourse.julialang.org/t/calculate-the-number-of-values-greater-than-a-certain-value/84578)

<div class="topic-metadata">

**Author:** [@chenr86](https://discourse.julialang.org/u/chenr86)\
**Replies:** 2\
**Last updated:** [July 21, 2022, 7:57am UTC](https://discourse.julialang.org/t/calculate-the-number-of-values-greater-than-a-certain-value/84578 "2022-07-21T07:57:36Z")

</div>

Hello, I’m solving a MINLP problem. In my case, there is an objective function max(sum(time60\[time\_slice\])) indicating the number of time slices in which the expression Q\[time\_slice\] is greater than 60. That is to say: …

---

## [Constraint seems linear but the compiler determined it was quadratic. Not sure why or how to fix](https://discourse.julialang.org/t/constraint-seems-linear-but-the-compiler-determined-it-was-quadratic-not-sure-why-or-how-to-fix/84426)

<div class="topic-metadata">

**Author:** [@johnabs](https://discourse.julialang.org/u/johnabs)\
**Replies:** 10\
**Last updated:** [July 20, 2022, 1:52am UTC](https://discourse.julialang.org/t/constraint-seems-linear-but-the-compiler-determined-it-was-quadratic-not-sure-why-or-how-to-fix/84426 "2022-07-20T01:52:39Z")

</div>

Hi all, I’m doing some optimization on weighted graphs, and one of my constraints is showing up as quadratic for some reason, and JuMP says it’s can’t convert it to Affine, even though the docs say this is possible. (“B…

---

## [Why does Julia 1.6.5 and 1.7.1 generate differnent random values using the same seed?](https://discourse.julialang.org/t/why-does-julia-1-6-5-and-1-7-1-generate-differnent-random-values-using-the-same-seed/84482)

<div class="topic-metadata">

**Author:** [@etorkia](https://discourse.julialang.org/u/etorkia)\
**Replies:** 4\
**Last updated:** [July 19, 2022, 9:02pm UTC](https://discourse.julialang.org/t/why-does-julia-1-6-5-and-1-7-1-generate-differnent-random-values-using-the-same-seed/84482 "2022-07-19T21:02:11Z")

</div>

I found that if you start a fresh session in both 1.6.5. and 1.7.1 you get different results. I found this glitch while running doctests… and I will never be able to run Documenter.jl with this kind of craziness. using …

---

## [Convert Non-linear objective function from Maximization to Minimization](https://discourse.julialang.org/t/convert-non-linear-objective-function-from-maximization-to-minimization/84478)

<div class="topic-metadata">

**Author:** [@sophiepavia](https://discourse.julialang.org/u/sophiepavia)\
**Replies:** 3\
**Last updated:** [July 19, 2022, 8:31pm UTC](https://discourse.julialang.org/t/convert-non-linear-objective-function-from-maximization-to-minimization/84478 "2022-07-19T20:31:26Z")

</div>

Hello! I have the following non linear objective function. How can I convert this maximization objective function to a minimization problem? I have read conflicting material online, some say to multiple the problem by …

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

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