# Optimization (Mathematical)

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

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

**Page:** 57

---

## [Result index of attribute](https://discourse.julialang.org/t/result-index-of-attribute/87891)

<div class="topic-metadata">

**Author:** [@Zizilabg](https://discourse.julialang.org/u/Zizilabg)\
**Replies:** 1\
**Last updated:** [September 27, 2022, 11:41pm UTC](https://discourse.julialang.org/t/result-index-of-attribute/87891 "2022-09-27T23:41:01Z")

</div>

Hello, I wrote a model about Julia which contains 3 constraints. If I test one constraint at a time, each one works. But if I run the whole program, I get the following error message: Has anyone had this problem bef…

---

## [What is a Model fingerprint?](https://discourse.julialang.org/t/what-is-a-model-fingerprint/87851)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 1\
**Last updated:** [September 27, 2022, 2:50am UTC](https://discourse.julialang.org/t/what-is-a-model-fingerprint/87851 "2022-09-27T02:50:21Z")

</div>

What is a Model fingerprint? What is it used for? Does the same model have the same Model fingerprint in different machines?

---

## [Using JuMP and Ipopt I cannot get a simple Euler constrained optimisation problem to output correct answers](https://discourse.julialang.org/t/using-jump-and-ipopt-i-cannot-get-a-simple-euler-constrained-optimisation-problem-to-output-correct-answers/83726)

<div class="topic-metadata">

**Author:** [@sumant28](https://discourse.julialang.org/u/sumant28)\
**Replies:** 7\
**Last updated:** [September 23, 2022, 8:26pm UTC](https://discourse.julialang.org/t/using-jump-and-ipopt-i-cannot-get-a-simple-euler-constrained-optimisation-problem-to-output-correct-answers/83726 "2022-09-23T20:26:03Z")

</div>

Here is the code using JuMP using Ipopt function Euler(x...) beta = 0.9 t = 2 x = \[i for i in x\] logx = log.(x) answer = -(beta .^ ((transpose(1:1:t) .- 1) \* logx)) return answer\[1\] end m = Model(Ipopt.Op…

---

## [Error in the Sparsity section of the SumofSquare package](https://discourse.julialang.org/t/error-in-the-sparsity-section-of-the-sumofsquare-package/87597)

<div class="topic-metadata">

**Author:** [@Khashayar-Neshat](https://discourse.julialang.org/u/Khashayar-Neshat)\
**Replies:** 12\
**Last updated:** [September 23, 2022, 1:36am UTC](https://discourse.julialang.org/t/error-in-the-sparsity-section-of-the-sumofsquare-package/87597 "2022-09-23T01:36:17Z")

</div>

Hi, I am using Julia 1.8.0 in windows 10, and I have updated all my packages. I want to implement the example in the sparsity section of the SumofSquare package (Term sparsity · SumOfSquares). when I run the following …

---

## [Call back with matrix](https://discourse.julialang.org/t/call-back-with-matrix/87584)

<div class="topic-metadata">

**Author:** [@Fabrizio](https://discourse.julialang.org/u/Fabrizio)\
**Replies:** 4\
**Last updated:** [September 22, 2022, 4:28pm UTC](https://discourse.julialang.org/t/call-back-with-matrix/87584 "2022-09-22T16:28:05Z")

</div>

Hi, the following code fom Jump manual works a scalar value, x and x\_val x\_val = callback\_value(cb\_data, x) status = MOI.submit( model, MOI.HeuristicSolution(cb\_data), \[x\], \[floor(Int, x\_val)\] ) how about submit …

---

## [Trouble Defining Variable](https://discourse.julialang.org/t/trouble-defining-variable/87603)

<div class="topic-metadata">

**Author:** [@mhbw](https://discourse.julialang.org/u/mhbw)\
**Replies:** 5\
**Last updated:** [September 22, 2022, 1:21pm UTC](https://discourse.julialang.org/t/trouble-defining-variable/87603 "2022-09-22T13:21:18Z")

</div>

I’ve been working to create an updated version of this repo, which uses JuMP, GLPK and Julia to perform a linear optimization. I think I’ve correctly updated the bulk of it (replacing @setObjective with objective type th…

---

## [Parallel bzip2 ang gzip: pbzip2 and pigz](https://discourse.julialang.org/t/parallel-bzip2-ang-gzip-pbzip2-and-pigz/87096)

<div class="topic-metadata">

**Author:** [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Replies:** 11\
**Last updated:** [September 20, 2022, 3:35am UTC](https://discourse.julialang.org/t/parallel-bzip2-ang-gzip-pbzip2-and-pigz/87096 "2022-09-20T03:35:22Z")

</div>

Do JuMP’s write\_to\_file and read\_from\_file use pbzip2 and pigz, parallel implementations of bzip2 and gzip, when writing or reading models stored in .bz2 and .gz compressed files? https://jump.dev/JuMP.jl/stable/referen…

---

## [ERROR: cannot document the following expression: using PATHSolver](https://discourse.julialang.org/t/error-cannot-document-the-following-expression-using-pathsolver/87496)

<div class="topic-metadata">

**Author:** [@Muhammad\_Nadeem](https://discourse.julialang.org/u/Muhammad_Nadeem)\
**Replies:** 10\
**Last updated:** [September 19, 2022, 10:50pm UTC](https://discourse.julialang.org/t/error-cannot-document-the-following-expression-using-pathsolver/87496 "2022-09-19T22:50:59Z")

</div>

Hello all, I am new to Julia, I am trying to run a simple optimization problem using PathSolver. I have installed the PathSolver, but it is giving me this error ERROR: cannot document the following expression: using P…

---

## [Why isn't JuMP.register named register!](https://discourse.julialang.org/t/why-isnt-jump-register-named-register/87456)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 3\
**Last updated:** [September 19, 2022, 5:57am UTC](https://discourse.julialang.org/t/why-isnt-jump-register-named-register/87456 "2022-09-19T05:57:17Z")

</div>

register modifies its argument model, so the function would normally end in !. Why isn’t this function named register!?

---

## [How to concisely define a recursive constraint？](https://discourse.julialang.org/t/how-to-concisely-define-a-recursive-constraint/87411)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 4\
**Last updated:** [September 18, 2022, 1:55am UTC](https://discourse.julialang.org/t/how-to-concisely-define-a-recursive-constraint/87411 "2022-09-18T01:55:31Z")

</div>

How to concisely define a recursive constraint with JuMP, for example: x\_{t}-x\_{t-1}\\geqslant 1\\quad\\forall t = 1,\\cdots,T, where x\_0=0 but I don’t want to define an extra variable for it. In another words, I want to …

---

## [MathOptInterface.OTHER\_ERROR when trying to use ISRES of NLopt through JuMP](https://discourse.julialang.org/t/mathoptinterface-other-error-when-trying-to-use-isres-of-nlopt-through-jump/87420)

<div class="topic-metadata">

**Author:** [@knkn1711](https://discourse.julialang.org/u/knkn1711)\
**Replies:** 1\
**Last updated:** [September 17, 2022, 11:41pm UTC](https://discourse.julialang.org/t/mathoptinterface-other-error-when-trying-to-use-isres-of-nlopt-through-jump/87420 "2022-09-17T23:41:49Z")

</div>

I am trying to minimize a nonlinear function with nonlinear inequality constraints with NLopt and JuMP. In my test code below, I am minimizing a function with a known global minima. Local optimizers such as LD\_MMA fail…

---

## [Multivariate nonlinear constrained optimization using JuMP and ForwardDiff (Automatic Differentiation)](https://discourse.julialang.org/t/multivariate-nonlinear-constrained-optimization-using-jump-and-forwarddiff-automatic-differentiation/87338)

<div class="topic-metadata">

**Author:** [@dhathri](https://discourse.julialang.org/u/dhathri)\
**Replies:** 1\
**Last updated:** [September 15, 2022, 9:52pm UTC](https://discourse.julialang.org/t/multivariate-nonlinear-constrained-optimization-using-jump-and-forwarddiff-automatic-differentiation/87338 "2022-09-15T21:52:17Z")

</div>

Hi, I am new to Julia and I am trying to understand how to use JuMP/ForwardDiff to transfer a collocation algorithm (nlp problem) written in MATLAB. I use fmincon in MATLAB with a nonlinear function that returns a vector…

---

## [Conditionnal constraint](https://discourse.julialang.org/t/conditionnal-constraint/87157)

<div class="topic-metadata">

**Author:** [@Zizilabg](https://discourse.julialang.org/u/Zizilabg)\
**Replies:** 6\
**Last updated:** [September 14, 2022, 5:48pm UTC](https://discourse.julialang.org/t/conditionnal-constraint/87157 "2022-09-14T17:48:04Z")

</div>

Hello, I need help to implement a constraint. The goal is to assign students to courses. Some courses can have a maximum of 8 students, others can have a maximum of 12. I first wrote my constraint like this: For j in…

---

## [How to omit arithmetic error of MIP solver in JuMP?](https://discourse.julialang.org/t/how-to-omit-arithmetic-error-of-mip-solver-in-jump/87242)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 2\
**Last updated:** [September 13, 2022, 11:28pm UTC](https://discourse.julialang.org/t/how-to-omit-arithmetic-error-of-mip-solver-in-jump/87242 "2022-09-13T23:28:47Z")

</div>

Hi all, I am working on a nonlinear type MIP optimization problem solved through JuMP. My solution is based on Juniper and HiGHS: using Juniper using HiGHS using JuMP using Ipopt R10, R20 = 0.18, 0.195 L11, L21 = 2.4…

---

## [TrajectoryOptimization.jl minimal time problem](https://discourse.julialang.org/t/trajectoryoptimization-jl-minimal-time-problem/82795)

<div class="topic-metadata">

**Author:** [@a6a3uh](https://discourse.julialang.org/u/a6a3uh)\
**Replies:** 17\
**Last updated:** [September 13, 2022, 6:13pm UTC](https://discourse.julialang.org/t/trajectoryoptimization-jl-minimal-time-problem/82795 "2022-09-13T18:13:12Z")

</div>

Maybe some of authors of the package are around here to answer the question. Is it possible to formulate minimal time trajectory optimization problem with TrajectoryOptimization.jl? How can I go about if I don’t know in …

---

## [How to extract intermediate results from GMRES of Krylov.jl](https://discourse.julialang.org/t/how-to-extract-intermediate-results-from-gmres-of-krylov-jl/87019)

<div class="topic-metadata">

**Author:** [@jinml](https://discourse.julialang.org/u/jinml)\
**Replies:** 7\
**Last updated:** [September 12, 2022, 7:10pm UTC](https://discourse.julialang.org/t/how-to-extract-intermediate-results-from-gmres-of-krylov-jl/87019 "2022-09-12T19:10:05Z")

</div>

Hi, I am using gmres from Krylov.jl as follows x,stat=gmres(A,b,itmax=3000,memory=500,history=true) which will return some information about the iteration, e.g., stat.residuals. Is there a way to also return the interm…

---

## [Seasonal storage balance constraint](https://discourse.julialang.org/t/seasonal-storage-balance-constraint/87098)

<div class="topic-metadata">

**Author:** [@mbah](https://discourse.julialang.org/u/mbah)\
**Replies:** 3\
**Last updated:** [September 12, 2022, 7:11am UTC](https://discourse.julialang.org/t/seasonal-storage-balance-constraint/87098 "2022-09-12T07:11:58Z")

</div>

Hello all, I am trying to code up a seasonal storage balance constraint. The idea is to limit the total generation over a time range by a particular amount for each of the seasonal storage plants (see Table). I have tr…

---

## [Error when supplying initial guess](https://discourse.julialang.org/t/error-when-supplying-initial-guess/86574)

<div class="topic-metadata">

**Author:** [@ivzktch99](https://discourse.julialang.org/u/ivzktch99)\
**Replies:** 6\
**Last updated:** [September 10, 2022, 11:56am UTC](https://discourse.julialang.org/t/error-when-supplying-initial-guess/86574 "2022-09-10T11:56:02Z")

</div>

If I set my variable to be lower trianglar, how can I supply an initial guess? The following gives me an error that has to do with the difference in the data type between the variable X and the initial guess X0 using Ju…

---

## [Mosek.jl not compiling in Julia 1.8 (Apple Silicon M1)](https://discourse.julialang.org/t/mosek-jl-not-compiling-in-julia-1-8-apple-silicon-m1/87024)

<div class="topic-metadata">

**Author:** [@raktim](https://discourse.julialang.org/u/raktim)\
**Replies:** 1\
**Last updated:** [September 10, 2022, 1:23am UTC](https://discourse.julialang.org/t/mosek-jl-not-compiling-in-julia-1-8-apple-silicon-m1/87024 "2022-09-10T01:23:22Z")

</div>

Mosek.jl is not compiling in Julia 1.8 macOS ARM (M-series Processor). It is unable to load libmosek (~/.julia/packages/Mosek/3NJdY/deps/src/mosek/9.3/tools/platform/osx64x86/bin/libmosek64.9.3.dylib). It is probably an…

---

## [Approaches to find optimal X on large simulation model when you have only (X,Y) (no gradient, hessian,...)](https://discourse.julialang.org/t/approaches-to-find-optimal-x-on-large-simulation-model-when-you-have-only-x-y-no-gradient-hessian/86925)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 15\
**Last updated:** [September 9, 2022, 11:47am UTC](https://discourse.julialang.org/t/approaches-to-find-optimal-x-on-large-simulation-model-when-you-have-only-x-y-no-gradient-hessian/86925 "2022-09-09T11:47:39Z")

</div>

I have a large (i.e. 1 hour run time, 1 core) bio-economic simulation model and I want to find which combination of some inputs minimise the sum of this inputs given a fixed output of the model. In practice, I want to f…

---

## [An object of name x is already attached to this model. If this is intended, consider using the anonymous construction syntax](https://discourse.julialang.org/t/an-object-of-name-x-is-already-attached-to-this-model-if-this-is-intended-consider-using-the-anonymous-construction-syntax/86896)

<div class="topic-metadata">

**Author:** [@Eric.O](https://discourse.julialang.org/u/Eric.O)\
**Replies:** 3\
**Last updated:** [September 8, 2022, 7:33pm UTC](https://discourse.julialang.org/t/an-object-of-name-x-is-already-attached-to-this-model-if-this-is-intended-consider-using-the-anonymous-construction-syntax/86896 "2022-09-08T19:33:22Z")

</div>

I am using Ipopt to solve the non linear optimization problem. My code is running but gives an error when the final solution is to be dispalyed as " An object of name x is already attached to this model. If this is inten…

---

## [LsqFit: strange DomainError](https://discourse.julialang.org/t/lsqfit-strange-domainerror/86907)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 5\
**Last updated:** [September 7, 2022, 9:49pm UTC](https://discourse.julialang.org/t/lsqfit-strange-domainerror/86907 "2022-09-07T21:49:13Z")

</div>

I am using LsqFit to fit the data for some correlation function. I am not going to go into details, but it is convenient for me to actually fit the logarithm of the correlation function. using LsqFit g(x, N, ξ, α, β) = …

---

## [Alpine+JuMP gives error for quadratic functions](https://discourse.julialang.org/t/alpine-jump-gives-error-for-quadratic-functions/70321)

<div class="topic-metadata">

**Author:** [@blob](https://discourse.julialang.org/u/blob)\
**Replies:** 4\
**Last updated:** [September 7, 2022, 5:54pm UTC](https://discourse.julialang.org/t/alpine-jump-gives-error-for-quadratic-functions/70321 "2022-09-07T17:54:54Z")

</div>

I am using Alpine with JuMP and Alpine fails for quadratic functions. Using the example from nlp3 here: https://github.com/lanl-ansi/Alpine.jl/blob/master/examples/MINLPs/nlp.jl, I have a working example: #Working examp…

---

## [Speedup optimization in nested for loop](https://discourse.julialang.org/t/speedup-optimization-in-nested-for-loop/86880)

<div class="topic-metadata">

**Author:** [@tsojtc](https://discourse.julialang.org/u/tsojtc)\
**Replies:** 1\
**Last updated:** [September 7, 2022, 12:05pm UTC](https://discourse.julialang.org/t/speedup-optimization-in-nested-for-loop/86880 "2022-09-07T12:05:43Z")

</div>

I have adapted some python code that takes data which is G x N, and returns the (strictly upper triangular) matrix cost\_permuted whose (i,j)-th entry represents the minimum of cooscillation\_distance(data\[i, :\], data\[j, :…

---

## [JuMP element wise \`latex\_formulation\`](https://discourse.julialang.org/t/jump-element-wise-latex-formulation/86842)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 3\
**Last updated:** [September 6, 2022, 7:22pm UTC](https://discourse.julialang.org/t/jump-element-wise-latex-formulation/86842 "2022-09-06T19:22:18Z")

</div>

I have some large JuMP models which I’d like to convert to latex, however, this quickly becomes impractical. Given a model using JuMP model = Model() @variable(model, x\[1:10\]) @constraint(model, x\_min, x .≤ 10) @cons…

---

## [Fast non dominated sorting](https://discourse.julialang.org/t/fast-non-dominated-sorting/24164)

<div class="topic-metadata">

**Author:** [@Igor\_Douven](https://discourse.julialang.org/u/Igor_Douven)\
**Replies:** 21\
**Last updated:** [September 5, 2022, 8:38am UTC](https://discourse.julialang.org/t/fast-non-dominated-sorting/24164 "2022-09-05T08:38:42Z")

</div>

I need a fast implementation of the so-called non dominated sorting algorithm. The best I could come up with so far is the following (the sorting is to be done on the basis of three criteria): dominates(x, y) = all(x .\<=…

---

## [Indexing variables by vectors not working in JuMPv1.2.x](https://discourse.julialang.org/t/indexing-variables-by-vectors-not-working-in-jumpv1-2-x/86652)

<div class="topic-metadata">

**Author:** [@BatyLeo](https://discourse.julialang.org/u/BatyLeo)\
**Replies:** 4\
**Last updated:** [September 4, 2022, 11:47pm UTC](https://discourse.julialang.org/t/indexing-variables-by-vectors-not-working-in-jumpv1-2-x/86652 "2022-09-04T23:47:34Z")

</div>

Hello, a bug appeared in my package when I updated JuMP to v1.2.1 from v1.1.1. Here is a minimum (non) working example: using GLPK using JuMP paths = \[ \[1, 2, 15, 3, 20\], \[1, 9, 16, 20\], \[1, 2, 20\] \] mode…

---

## [Is the any package or for solving a MIP with branch and bound that gives the user the developed constraints during the solution procedure?](https://discourse.julialang.org/t/is-the-any-package-or-for-solving-a-mip-with-branch-and-bound-that-gives-the-user-the-developed-constraints-during-the-solution-procedure/86714)

<div class="topic-metadata">

**Author:** [@Alex\_ricci](https://discourse.julialang.org/u/Alex_ricci)\
**Replies:** 2\
**Last updated:** [September 4, 2022, 9:50pm UTC](https://discourse.julialang.org/t/is-the-any-package-or-for-solving-a-mip-with-branch-and-bound-that-gives-the-user-the-developed-constraints-during-the-solution-procedure/86714 "2022-09-04T21:50:18Z")

</div>

I have a two-stage stochastic optimization model with binary and continuous variables in the first and the second stages. To solve this I employ a benders decomposition technique. In this technique I need to get the dua…

---

## [Curve Fitting With Error In Variables](https://discourse.julialang.org/t/curve-fitting-with-error-in-variables/82614)

<div class="topic-metadata">

**Author:** [@vini-fda](https://discourse.julialang.org/u/vini-fda)\
**Replies:** 5\
**Last updated:** [September 4, 2022, 4:27am UTC](https://discourse.julialang.org/t/curve-fitting-with-error-in-variables/82614 "2022-09-04T04:27:19Z")

</div>

I’m looking for a way to do curve fitting where the data has error both on x and y. I’ve read up on physics forums about errors-in-variables fitting, but I’d like to know if there are already any functionalities that ju…

---

## [Change SCS solver options](https://discourse.julialang.org/t/change-scs-solver-options/86676)

<div class="topic-metadata">

**Author:** [@mosby](https://discourse.julialang.org/u/mosby)\
**Replies:** 2\
**Last updated:** [September 2, 2022, 2:56pm UTC](https://discourse.julialang.org/t/change-scs-solver-options/86676 "2022-09-02T14:56:34Z")

</div>

Hi, I am new to Julia, while I am trying to use SCS.Optimizer to get the solution of projection problem, I see SCS has default eps = 1e-4, what if I want to be more accurate, like 1e-6, how could I change it? I found s…

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

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