# Optimization (Mathematical)

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

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

**Page:** 85

---

## [Optimizer returns status infeasible for a feasible problem](https://discourse.julialang.org/t/optimizer-returns-status-infeasible-for-a-feasible-problem/55064)

<div class="topic-metadata">

**Author:** [@htpusa](https://discourse.julialang.org/u/htpusa)\
**Replies:** 2\
**Last updated:** [February 11, 2021, 7:27pm UTC](https://discourse.julialang.org/t/optimizer-returns-status-infeasible-for-a-feasible-problem/55064 "2021-02-11T19:27:33Z")

</div>

I’m running into the following issue while solving a set of LP-problems using JuMP: I want to create a model, optimize it, and then in turn minimize and maximize its variables while requiring the original optimum to be …

---

## [IPNewton and ForwardDiff with preallocated Arrays](https://discourse.julialang.org/t/ipnewton-and-forwarddiff-with-preallocated-arrays/55013)

<div class="topic-metadata">

**Author:** [@Sylvain](https://discourse.julialang.org/u/Sylvain)\
**Replies:** 2\
**Last updated:** [February 11, 2021, 11:36am UTC](https://discourse.julialang.org/t/ipnewton-and-forwarddiff-with-preallocated-arrays/55013 "2021-02-11T11:36:39Z")

</div>

Hi ! I am new here so please let me know if I post at the right place. I could not find that issue on other threads. I need to solve a constrained optimization problem, and I’d like to use Optim.optimize with the IPNew…

---

## [Cbc JuMP : get optimize() best possible, best solution, number of nodes](https://discourse.julialang.org/t/cbc-jump-get-optimize-best-possible-best-solution-number-of-nodes/54904)

<div class="topic-metadata">

**Author:** [@juliamilp](https://discourse.julialang.org/u/juliamilp)\
**Replies:** 4\
**Last updated:** [February 10, 2021, 8:23am UTC](https://discourse.julialang.org/t/cbc-jump-get-optimize-best-possible-best-solution-number-of-nodes/54904 "2021-02-10T08:23:56Z")

</div>

Hello, I’m working on a Cbc optimizer using JuMP. When I use the optimize function, the best possible, best solution, total nodes and nodes on trees appears as : “Cbc0010I After 14000 nodes, 1054 on tree, 662 best solut…

---

## [JuMP/CPLEX: retrieve value of array-variables in callback](https://discourse.julialang.org/t/jump-cplex-retrieve-value-of-array-variables-in-callback/54933)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 3\
**Last updated:** [February 9, 2021, 9:02pm UTC](https://discourse.julialang.org/t/jump-cplex-retrieve-value-of-array-variables-in-callback/54933 "2021-02-09T21:02:04Z")

</div>

Dear folks, I use JuMP (v0.21.4) and CPLEX (v0.7.3) and try to get the current variable values of sparse/dense-axis-array variables in a solver-specific callback. A quite long MWE based on the one in the documentation i…

---

## [Help in using the Cbc solver](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 10\
**Last updated:** [February 9, 2021, 10:27am UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956 "2021-02-09T10:27:46Z")

</div>

Hi Could someone help me in using Cbc. I don’t know what happens but every time I try to compile an error message appears. I’m using JuMP v0.18.6 and Cbc v0.7.1, I tried to update these packages but I couldn’t. Thank …

---

## [Julia Crash Fatal Error](https://discourse.julialang.org/t/julia-crash-fatal-error/54875)

<div class="topic-metadata">

**Author:** [@rezabayani](https://discourse.julialang.org/u/rezabayani)\
**Replies:** 6\
**Last updated:** [February 9, 2021, 12:51am UTC](https://discourse.julialang.org/t/julia-crash-fatal-error/54875 "2021-02-09T00:51:10Z")

</div>

I keep encountering a fatal error in julia and can not solve it. The reproduction steps are too much to cover in here. The gist of my code is that I am trying to solve a LP optimization problem with slight changes over a…

---

## [Set\_start\_value in JuMP for SCIP](https://discourse.julialang.org/t/set-start-value-in-jump-for-scip/54829)

<div class="topic-metadata">

**Author:** [@ahmadreza-marandi](https://discourse.julialang.org/u/ahmadreza-marandi)\
**Replies:** 6\
**Last updated:** [February 8, 2021, 4:05pm UTC](https://discourse.julialang.org/t/set-start-value-in-jump-for-scip/54829 "2021-02-08T16:05:10Z")

</div>

Hi all, I am using set\_value\_start function in JuMP 0.19 to pass a warm start to SCIP. Though, the solver doesn’t seem to use it. When I plug in an optimal solution to the problem as the warm start, nothing changes in …

---

## [SOCP with Vector{GenericAffExpr}](https://discourse.julialang.org/t/socp-with-vector-genericaffexpr/54844)

<div class="topic-metadata">

**Author:** [@mposs](https://discourse.julialang.org/u/mposs)\
**Replies:** 2\
**Last updated:** [February 8, 2021, 3:48pm UTC](https://discourse.julialang.org/t/socp-with-vector-genericaffexpr/54844 "2021-02-08T15:48:34Z")

</div>

Hi Is it possible to add a SOCP constraint to Gurobi through JuMP using @constraint(model, vec in SecondOrderCone()) where vec is a Vector{GenericAffExpr{Float64,VariableRef}} ? I got the impression it is possible ad…

---

## [Is autodifferentiation possible in this situation?](https://discourse.julialang.org/t/is-autodifferentiation-possible-in-this-situation/54807)

<div class="topic-metadata">

**Author:** [@marcobonici](https://discourse.julialang.org/u/marcobonici)\
**Replies:** 20\
**Last updated:** [February 8, 2021, 1:52am UTC](https://discourse.julialang.org/t/is-autodifferentiation-possible-in-this-situation/54807 "2021-02-08T01:52:40Z")

</div>

Dear all, I am here to ask the help of the community. I am a Physicist, working in the domain of Astrophysics/Cosmology. About a month ago I discovered Julia and I started translating my Python code in this new language…

---

## [@polyvar does not allow two-dimensional variables](https://discourse.julialang.org/t/polyvar-does-not-allow-two-dimensional-variables/52395)

<div class="topic-metadata">

**Author:** [@aliceee](https://discourse.julialang.org/u/aliceee)\
**Replies:** 4\
**Last updated:** [February 7, 2021, 6:15pm UTC](https://discourse.julialang.org/t/polyvar-does-not-allow-two-dimensional-variables/52395 "2021-02-07T18:15:42Z")

</div>

I want define a polyvar with size 2\*3. Several weeks ago, the following code works using TypedPolynomials @polyvar B\[1:2,1:3\] But now I get this error: Unsupported syntax. Expected x\[a:b\] for literal integers a and b…

---

## [Share system of equations solution between g(x) and dg(x)dx functions (i.e. constraint and its jacobian) in IPOPT](https://discourse.julialang.org/t/share-system-of-equations-solution-between-g-x-and-dg-x-dx-functions-i-e-constraint-and-its-jacobian-in-ipopt/51608)

<div class="topic-metadata">

**Author:** [@nico](https://discourse.julialang.org/u/nico)\
**Replies:** 6\
**Last updated:** [February 7, 2021, 8:50am UTC](https://discourse.julialang.org/t/share-system-of-equations-solution-between-g-x-and-dg-x-dx-functions-i-e-constraint-and-its-jacobian-in-ipopt/51608 "2021-02-07T08:50:31Z")

</div>

Hi, I planning to use IPOPT in an optimization project. I would like to know if there is a way to share the solution of a system of equations (like Ax=b) between different functions called by IPOPT, say the constraint …

---

## [Getindex in Model Constraints assign](https://discourse.julialang.org/t/getindex-in-model-constraints-assign/54678)

<div class="topic-metadata">

**Author:** [@user1200](https://discourse.julialang.org/u/user1200)\
**Replies:** 3\
**Last updated:** [February 5, 2021, 9:20pm UTC](https://discourse.julialang.org/t/getindex-in-model-constraints-assign/54678 "2021-02-05T21:20:16Z")

</div>

Hello Is there a way to use getIndex or findfirst function in Constraints in Model? Usage: Get maximum value from “1 vector(column)”-but remember just its index, for example 8th. Then get value from “another vector(co…

---

## [Bounded parameters w/ Optim](https://discourse.julialang.org/t/bounded-parameters-w-optim/54552)

<div class="topic-metadata">

**Author:** [@pyrex41](https://discourse.julialang.org/u/pyrex41)\
**Replies:** 1\
**Last updated:** [February 4, 2021, 6:51pm UTC](https://discourse.julialang.org/t/bounded-parameters-w-optim/54552 "2021-02-04T18:51:13Z")

</div>

I have been working on fitting some non-linear models, and have been using Optim. For models where the parameters space is bounded, one can obviously use Box Constraints. Before I read how to this, however, I had been tr…

---

## [Which Optimization package for large-scale structured nonlinear problems](https://discourse.julialang.org/t/which-optimization-package-for-large-scale-structured-nonlinear-problems/54449)

<div class="topic-metadata">

**Author:** [@egvila](https://discourse.julialang.org/u/egvila)\
**Replies:** 6\
**Last updated:** [February 4, 2021, 6:43pm UTC](https://discourse.julialang.org/t/which-optimization-package-for-large-scale-structured-nonlinear-problems/54449 "2021-02-04T18:43:52Z")

</div>

Hello everyone, As the title says, I would like some insight on what Julia Optimization package would be most appropriate to efficiently solve nonlinear problems with potentially exploitable sparsity structures (e.g. bl…

---

## [Optim with autodiff return error when optimize paralleled objective function](https://discourse.julialang.org/t/optim-with-autodiff-return-error-when-optimize-paralleled-objective-function/54496)

<div class="topic-metadata">

**Author:** [@zxjroger](https://discourse.julialang.org/u/zxjroger)\
**Replies:** 9\
**Last updated:** [February 4, 2021, 12:22am UTC](https://discourse.julialang.org/t/optim-with-autodiff-return-error-when-optimize-paralleled-objective-function/54496 "2021-02-04T00:22:45Z")

</div>

I have a very complicated objective function which involves some distributed call. I would like to optimize the function using Optim with Forward Difference. However, it reports an error. This is the MWE: using Distribu…

---

## [Calculating power transfer distribution factor (PTDF) matrix using PowerModels.jl](https://discourse.julialang.org/t/calculating-power-transfer-distribution-factor-ptdf-matrix-using-powermodels-jl/42668)

<div class="topic-metadata">

**Author:** [@gobs](https://discourse.julialang.org/u/gobs)\
**Replies:** 7\
**Last updated:** [February 3, 2021, 5:46pm UTC](https://discourse.julialang.org/t/calculating-power-transfer-distribution-factor-ptdf-matrix-using-powermodels-jl/42668 "2021-02-03T17:46:10Z")

</div>

I want to obtain a PTDF matrix to use in my power system optimisation model using data in PowerModels.jl format (I also raised an issue for this to be integrated into PowerModels.jl itself: https://github.com/lanl-ansi/P…

---

## [Inconsistance between @NLobjective and @objective](https://discourse.julialang.org/t/inconsistance-between-nlobjective-and-objective/54520)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [February 3, 2021, 9:39am UTC](https://discourse.julialang.org/t/inconsistance-between-nlobjective-and-objective/54520 "2021-02-03T09:39:21Z")

</div>

Let’s consider the following model: model = Model(with\_optimizer(Ipopt.Optimizer)) @variable(model, x \>= 0) @variable(model, y \>= 1) Then the macro @objective can be used both as: @objective(model, Min, x+2\*y) or @o…

---

## [Repeatedly calculating a hessian using both ForwardDiff and ReverseDiff](https://discourse.julialang.org/t/repeatedly-calculating-a-hessian-using-both-forwarddiff-and-reversediff/54051)

<div class="topic-metadata">

**Author:** [@jacobusmmsmit](https://discourse.julialang.org/u/jacobusmmsmit)\
**Replies:** 3\
**Last updated:** [February 2, 2021, 1:28pm UTC](https://discourse.julialang.org/t/repeatedly-calculating-a-hessian-using-both-forwarddiff-and-reversediff/54051 "2021-02-02T13:28:52Z")

</div>

I would like to calculate a Hessian matrix of a function f:\\mathbb{R}^n \\rightarrow \\mathbb{R} where n\\gg1. In my usecase the Jacobian of f is always needed, and the Hessian may or may not be needed (but this is known be…

---

## [Best JuMP modelling technique!](https://discourse.julialang.org/t/best-jump-modelling-technique/54183)

<div class="topic-metadata">

**Author:** [@musman](https://discourse.julialang.org/u/musman)\
**Replies:** 9\
**Last updated:** [February 2, 2021, 12:32pm UTC](https://discourse.julialang.org/t/best-jump-modelling-technique/54183 "2021-02-02T12:32:04Z")

</div>

Hi all, I came across two ways of defining a same constraint in JuMP. I want to know if both ways, from the point of view of the time taken by the JuMP to model the constraint, are equivalent OR does one method leads to…

---

## [Condition constraint symbol on problem data](https://discourse.julialang.org/t/condition-constraint-symbol-on-problem-data/54431)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 1\
**Last updated:** [February 2, 2021, 8:12am UTC](https://discourse.julialang.org/t/condition-constraint-symbol-on-problem-data/54431 "2021-02-02T08:12:13Z")

</div>

Here is a linear program I am trying to solve: using JuMP import GLPK function LP\_example(A::Array{Int64, 2}, B::Array{Int64, 2}, c::Array{Int64, 1}) n, m = size(B) model = Model(GLPK.Optimi…

---

## [Help with exporting data to .CSV](https://discourse.julialang.org/t/help-with-exporting-data-to-csv/54410)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 1\
**Last updated:** [February 1, 2021, 7:36pm UTC](https://discourse.julialang.org/t/help-with-exporting-data-to-csv/54410 "2021-02-01T19:36:44Z")

</div>

Hello everybody! I am trying to export only the numeric data of the result of the variable r to a .CSV. The model does not give an error, but I cannot export the data as I need it. I would like the data to be written …

---

## [ERROR: LoadError: UndefVarError: getValue not defined](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350)

<div class="topic-metadata">

**Author:** [@Prottay\_Adhikari](https://discourse.julialang.org/u/Prottay_Adhikari)\
**Replies:** 9\
**Last updated:** [February 1, 2021, 1:52am UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350 "2021-02-01T01:52:52Z")

</div>

I was trying to run the power system example to execute the economic load dispatch operation. The original code was reported here. However when I try to run this code (with the modifications to make the code compliant …

---

## [Problem with setting start value for PATH solver(PATH.jl) when solving a complementarity problem](https://discourse.julialang.org/t/problem-with-setting-start-value-for-path-solver-path-jl-when-solving-a-complementarity-problem/53918)

<div class="topic-metadata">

**Author:** [@jshengdb](https://discourse.julialang.org/u/jshengdb)\
**Replies:** 6\
**Last updated:** [January 31, 2021, 9:12pm UTC](https://discourse.julialang.org/t/problem-with-setting-start-value-for-path-solver-path-jl-when-solving-a-complementarity-problem/53918 "2021-01-31T21:12:23Z")

</div>

Hello, I am now having a problem with setting initial value for PATH solver(PATH.jl). I am trying to solve a linear complementarity problem with a chosen initial point. The problem is following: A = Dict( (1,1) =\> …

---

## [Native Qp solver?](https://discourse.julialang.org/t/native-qp-solver/54304)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 1\
**Last updated:** [January 31, 2021, 4:48pm UTC](https://discourse.julialang.org/t/native-qp-solver/54304 "2021-01-31T16:48:10Z")

</div>

Hey, I’m used to OSQP for QP solving in Float64, which had a lot of wrappers for all languages. However, Julia has a deep understanding of what Is a real number, and I’d like to solve QP for any real number, including …

---

## [L-BFGS returns a NaN gradient when providing analytical gradient. BFGS shows no issues](https://discourse.julialang.org/t/l-bfgs-returns-a-nan-gradient-when-providing-analytical-gradient-bfgs-shows-no-issues/54196)

<div class="topic-metadata">

**Author:** [@juandarias](https://discourse.julialang.org/u/juandarias)\
**Replies:** 1\
**Last updated:** [January 31, 2021, 1:16pm UTC](https://discourse.julialang.org/t/l-bfgs-returns-a-nan-gradient-when-providing-analytical-gradient-bfgs-shows-no-issues/54196 "2021-01-31T13:16:23Z")

</div>

Observations When providing an analytical gradient for optimization using LBFGS with boxed constraints, the optimizer fails occasionally due to gradient becoming NaN, i.e. g(x) = \[Nan, ..., Nan\]. The analytical gradien…

---

## [NLopt stalls without objective progress?](https://discourse.julialang.org/t/nlopt-stalls-without-objective-progress/54073)

<div class="topic-metadata">

**Author:** [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Replies:** 2\
**Last updated:** [January 30, 2021, 1:13pm UTC](https://discourse.julialang.org/t/nlopt-stalls-without-objective-progress/54073 "2021-01-30T13:13:58Z")

</div>

I have an optimization problem which I’m solving with NLopt (algorithm :LD\_MMA). The objective is nonlinear, there are upper/lower bound constraints, and one linear constraint. It seems like no matter how long I let NLop…

---

## [Registering an array of functions and using them in constraints and objectives](https://discourse.julialang.org/t/registering-an-array-of-functions-and-using-them-in-constraints-and-objectives/53294)

<div class="topic-metadata">

**Author:** [@maajdl](https://discourse.julialang.org/u/maajdl)\
**Replies:** 4\
**Last updated:** [January 30, 2021, 8:40am UTC](https://discourse.julialang.org/t/registering-an-array-of-functions-and-using-them-in-constraints-and-objectives/53294 "2021-01-30T08:40:43Z")

</div>

(Julia beginner) Still thinking about Nonlinear Programming with JuMP with some generality. (@NLconstraint with a sum, array and scalar variables) There are many NLP JuMP examples available but all more or less simila…

---

## [Optimization with JuMP: an affine expression enters a nonlinear constraint (dynamic discrete choice)](https://discourse.julialang.org/t/optimization-with-jump-an-affine-expression-enters-a-nonlinear-constraint-dynamic-discrete-choice/54230)

<div class="topic-metadata">

**Author:** [@kwokhao](https://discourse.julialang.org/u/kwokhao)\
**Replies:** 2\
**Last updated:** [January 30, 2021, 12:14am UTC](https://discourse.julialang.org/t/optimization-with-jump-an-affine-expression-enters-a-nonlinear-constraint-dynamic-discrete-choice/54230 "2021-01-30T00:14:10Z")

</div>

I am trying to use JuMP to solve a dynamic programming problem, but I cannot get MPEC (with Ipopt) to work. I am solving a prediction problem. There are 2 products, “safe” and “risky”. The safe product always yields uti…

---

## [MethodError: no method matching isless(::Int64, ::Array{UnitRange{Int64},1})](https://discourse.julialang.org/t/methoderror-no-method-matching-isless-int64-array-unitrange-int64-1/53970)

<div class="topic-metadata">

**Author:** [@GraceMabele](https://discourse.julialang.org/u/GraceMabele)\
**Replies:** 20\
**Last updated:** [January 29, 2021, 4:45pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-isless-int64-array-unitrange-int64-1/53970 "2021-01-29T16:45:43Z")

</div>

Hi I am a newbie to JuMP(Julia) and coding too, I am currently computing the following constraints in code below however, it is returning the following error and I am not exactly sure how to solve and I do not understan…

---

## [Obtaining variable scalar coefficients in objective](https://discourse.julialang.org/t/obtaining-variable-scalar-coefficients-in-objective/54128)

<div class="topic-metadata">

**Author:** [@gobs](https://discourse.julialang.org/u/gobs)\
**Replies:** 2\
**Last updated:** [January 29, 2021, 7:59am UTC](https://discourse.julialang.org/t/obtaining-variable-scalar-coefficients-in-objective/54128 "2021-01-29T07:59:37Z")

</div>

Hello! I would like to extend NREL’s progressive hedging package to include a scaled penalty parameter, i.e. one which is proportional to the coefficients of the variable being penalised in the objective function. Long …

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

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