# Optimization (Mathematical)

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

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

**Page:** 110

---

## [Use Cbc with Parametron? (ERROR: MathOptInterface.SetAttributeNotAllowed)](https://discourse.julialang.org/t/use-cbc-with-parametron-error-mathoptinterface-setattributenotallowed/26263)

<div class="topic-metadata">

**Author:** [@ianfiske](https://discourse.julialang.org/u/ianfiske)\
**Replies:** 6\
**Last updated:** [July 12, 2019, 10:31pm UTC](https://discourse.julialang.org/t/use-cbc-with-parametron-error-mathoptinterface-setattributenotallowed/26263 "2019-07-12T22:31:21Z")

</div>

I am trying to adapt the first Parametron README.md example to use Cbc because I’ll need binary variables. However, the example does not work out of the box with Cbc.Optimizer(). I’ve worked through some of the errors …

---

## [Indexing a const array with a JuMP variable](https://discourse.julialang.org/t/indexing-a-const-array-with-a-jump-variable/26283)

<div class="topic-metadata">

**Author:** [@bocc](https://discourse.julialang.org/u/bocc)\
**Replies:** 2\
**Last updated:** [July 12, 2019, 2:41pm UTC](https://discourse.julialang.org/t/indexing-a-const-array-with-a-jump-variable/26283 "2019-07-12T14:41:16Z")

</div>

Hello, let’s assume I have multiple 2D arrays (maps, tables…), each row of those belongs to a single design in a Pareto set (objective & parameter values). I want to optimize on the combinations of those, therefore (I …

---

## [How to programmatically check optimisation status in JuMP \>= 0.19](https://discourse.julialang.org/t/how-to-programmatically-check-optimisation-status-in-jump-0-19/26289)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [July 12, 2019, 2:04pm UTC](https://discourse.julialang.org/t/how-to-programmatically-check-optimisation-status-in-jump-0-19/26289 "2019-07-12T14:04:41Z")

</div>

Which is the equivalent of status=solve(model); if status == :Optimal in JuMP \>= 0.19 ? optimize!(model); if termination\_status(model) == ????

---

## [Optim; Hessian or Hessian free?](https://discourse.julialang.org/t/optim-hessian-or-hessian-free/26209)

<div class="topic-metadata">

**Author:** [@krenova](https://discourse.julialang.org/u/krenova)\
**Replies:** 15\
**Last updated:** [July 11, 2019, 9:51pm UTC](https://discourse.julialang.org/t/optim-hessian-or-hessian-free/26209 "2019-07-11T21:51:28Z")

</div>

Hi, In the documentation for the Optim package I note the following statement with regards to the choice of algorithm: When you do not have an explicit Hessian or when the dimension becomes large enough that the linea…

---

## [How do you apply ceil/round function inside JuMP constraints, or can you force constraints to evaluate to Ints?](https://discourse.julialang.org/t/how-do-you-apply-ceil-round-function-inside-jump-constraints-or-can-you-force-constraints-to-evaluate-to-ints/26197)

<div class="topic-metadata">

**Author:** [@clausherther](https://discourse.julialang.org/u/clausherther)\
**Replies:** 4\
**Last updated:** [July 10, 2019, 2:29pm UTC](https://discourse.julialang.org/t/how-do-you-apply-ceil-round-function-inside-jump-constraints-or-can-you-force-constraints-to-evaluate-to-ints/26197 "2019-07-10T14:29:15Z")

</div>

Hi, I have this simple model that tries to maximize theoretical demand for a product given some SKU level inventory constraints and a probability distribution for SKU demand. In the first constraint I’d like to compare t…

---

## [For loop error](https://discourse.julialang.org/t/for-loop-error/26210)

<div class="topic-metadata">

**Author:** [@MuadhF](https://discourse.julialang.org/u/MuadhF)\
**Replies:** 7\
**Last updated:** [July 10, 2019, 9:46am UTC](https://discourse.julialang.org/t/for-loop-error/26210 "2019-07-10T09:46:56Z")

</div>

Hi, I’m still new to Julia, and am having problems with a for loop. I’m trying to create an array where each value is the former value minus another value. This is the code: for i = 1:T bal\[i\] = bal\[i-1\] - A\[i\] e…

---

## [Rootfinding on manifold](https://discourse.julialang.org/t/rootfinding-on-manifold/26113)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 8\
**Last updated:** [July 9, 2019, 2:20pm UTC](https://discourse.julialang.org/t/rootfinding-on-manifold/26113 "2019-07-09T14:20:40Z")

</div>

I have an f: \\mathbb{R}^n \\to \\mathbb{R}^m function with m \> n. I am looking for a root f(x) \\approx 0. f is continuous, differentiable, generally rather nice, if somewhat nonlinear. I managed to make this work with NLs…

---

## [Assigning strictly integer values](https://discourse.julialang.org/t/assigning-strictly-integer-values/26178)

<div class="topic-metadata">

**Author:** [@MuadhF](https://discourse.julialang.org/u/MuadhF)\
**Replies:** 4\
**Last updated:** [July 9, 2019, 9:23am UTC](https://discourse.julialang.org/t/assigning-strictly-integer-values/26178 "2019-07-09T09:23:16Z")

</div>

Hi, I am having trouble with assigning values from a CSV file into a variable. So I have a value of 300 in a cell (\[4,2\]) in the CSV file, and in the code I created a dataframe (df1) and tried to assign the value of 300…

---

## [Naming multiple constraints](https://discourse.julialang.org/t/naming-multiple-constraints/26134)

<div class="topic-metadata">

**Author:** [@MuadhF](https://discourse.julialang.org/u/MuadhF)\
**Replies:** 2\
**Last updated:** [July 8, 2019, 3:41pm UTC](https://discourse.julialang.org/t/naming-multiple-constraints/26134 "2019-07-08T15:41:07Z")

</div>

Hi, In JuMP, how do I get the name of a constraint by which I can refer to, if I haven’t named it already? Also, for multiple constraints, how do you name them? For example: for i = 1:5 @constraint(m, con\[i=1:5\],…

---

## [AmplNLWriter, NLexpression, can't evaluate pow('(0,0.45),](https://discourse.julialang.org/t/amplnlwriter-nlexpression-cant-evaluate-pow-0-0-45/26006)

<div class="topic-metadata">

**Author:** [@Raminel](https://discourse.julialang.org/u/Raminel)\
**Replies:** 2\
**Last updated:** [July 8, 2019, 3:35pm UTC](https://discourse.julialang.org/t/amplnlwriter-nlexpression-cant-evaluate-pow-0-0-45/26006 "2019-07-08T15:35:04Z")

</div>

Hi all, I am trying include a power expression in my objective function. and I get an error “can’t evaluate pow’(0,0.45)”, even though I forced my variables to start from 1e-20. Has anyone an idea why? using JuMP usin…

---

## [Nested optimization](https://discourse.julialang.org/t/nested-optimization/26061)

<div class="topic-metadata">

**Author:** [@Farnazmdi](https://discourse.julialang.org/u/Farnazmdi)\
**Replies:** 2\
**Last updated:** [July 6, 2019, 6:16pm UTC](https://discourse.julialang.org/t/nested-optimization/26061 "2019-07-06T18:16:19Z")

</div>

Hi, I have a model from which I estimate some parameters, and the parameters are “data” to my second model. I want to be able to optimize the parameters of the first model in a way that the second model fits well. Since…

---

## [Highly Asymmetric Hessian after optimization](https://discourse.julialang.org/t/highly-asymmetric-hessian-after-optimization/26027)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 26\
**Last updated:** [July 6, 2019, 9:05pm UTC](https://discourse.julialang.org/t/highly-asymmetric-hessian-after-optimization/26027 "2019-07-06T21:05:18Z")

</div>

The Hessian after optimization is not even close to symmetric; for example the 1, 2 element is 16.7 while the 2, 1 element is 1.4. The 12, 13 element is -3945 and 13, 12 is -16 (I’m rounding the numbers). I’m using aut…

---

## [Parameters in IPOPT](https://discourse.julialang.org/t/parameters-in-ipopt/25908)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 5\
**Last updated:** [July 3, 2019, 12:05pm UTC](https://discourse.julialang.org/t/parameters-in-ipopt/25908 "2019-07-03T12:05:38Z")

</div>

Dear all, I am with code: using Ipopt model = Model(with\_optimizer(Ipopt.Optimizer)) @variable(model, x, start = 500) @variable(model, y, start = 500) @NLobjective(model, Min, (1 - x)^2 + 100 \* (y - x^2)^2) optimi…

---

## [Multivariate Nonlinear Regression](https://discourse.julialang.org/t/multivariate-nonlinear-regression/25887)

<div class="topic-metadata">

**Author:** [@MLackner](https://discourse.julialang.org/u/MLackner)\
**Replies:** 9\
**Last updated:** [July 2, 2019, 11:44am UTC](https://discourse.julialang.org/t/multivariate-nonlinear-regression/25887 "2019-07-02T11:44:01Z")

</div>

Greetings! I am trying to perform a multivariate nonlinear regression (2D curve fitting). Let’s assume my data has the following form: function multimodel(x, p) a = x\[1\] t = x\[2\] α = p\[1\] τ = p\[2\] (…

---

## [Solving linear equations efficiency problem](https://discourse.julialang.org/t/solving-linear-equations-efficiency-problem/25718)

<div class="topic-metadata">

**Author:** [@FujiwaraTakumiEH](https://discourse.julialang.org/u/FujiwaraTakumiEH)\
**Replies:** 4\
**Last updated:** [June 27, 2019, 8:59pm UTC](https://discourse.julialang.org/t/solving-linear-equations-efficiency-problem/25718 "2019-06-27T20:59:09Z")

</div>

Background: In the finite element numerical simulation, the last step is to calculate the linear equations of the overall stiffness matrix: K×d=F . In julia, the method of solving linear equations can be directly “\\”: d…

---

## [1e6+ constrained optimization problems](https://discourse.julialang.org/t/1e6-constrained-optimization-problems/22032)

<div class="topic-metadata">

**Author:** [@jcreinhold](https://discourse.julialang.org/u/jcreinhold)\
**Replies:** 17\
**Last updated:** [June 26, 2019, 10:49am UTC](https://discourse.julialang.org/t/1e6-constrained-optimization-problems/22032 "2019-06-26T10:49:22Z")

</div>

I am working on a problem in medical imaging where I have to solve an optimization problem at every voxel (read: pixel) that is not background. The optimization problem is relatively simple, it is a system of three non-l…

---

## [Minimise() in IntervalOptimisation does not accept keyword arguments](https://discourse.julialang.org/t/minimise-in-intervaloptimisation-does-not-accept-keyword-arguments/25678)

<div class="topic-metadata">

**Author:** [@bocc](https://discourse.julialang.org/u/bocc)\
**Replies:** 3\
**Last updated:** [June 26, 2019, 6:47am UTC](https://discourse.julialang.org/t/minimise-in-intervaloptimisation-does-not-accept-keyword-arguments/25678 "2019-06-26T06:47:41Z")

</div>

Hello All, I am experimenting a bit with IntervalOptimisation package, and I have run into a problem (I am a Julia noob, please excuse me if the resolution is trivial - I’ve tried to find the answer by myself but couldn…

---

## [Estimate parameters of a Delay Differential Equation](https://discourse.julialang.org/t/estimate-parameters-of-a-delay-differential-equation/25159)

<div class="topic-metadata">

**Author:** [@Farnazmdi](https://discourse.julialang.org/u/Farnazmdi)\
**Replies:** 6\
**Last updated:** [June 24, 2019, 4:53am UTC](https://discourse.julialang.org/t/estimate-parameters-of-a-delay-differential-equation/25159 "2019-06-24T04:53:54Z")

</div>

Hi! I am new to Julia and I’m trying to fit my data to a DDE, but have a problem with optimize(). It is not recognized, here is my code, and the error. I would appreciate if anyone could provide a toy example for how t…

---

## [How do I use Cbc with JuMP 0.19?](https://discourse.julialang.org/t/how-do-i-use-cbc-with-jump-0-19/25502)

<div class="topic-metadata">

**Author:** [@dburch](https://discourse.julialang.org/u/dburch)\
**Replies:** 1\
**Last updated:** [June 22, 2019, 2:24am UTC](https://discourse.julialang.org/t/how-do-i-use-cbc-with-jump-0-19/25502 "2019-06-22T02:24:14Z")

</div>

How do I use Cbc with JuMP 0.19? The new syntax is throwing me off. All of the documentation I can find is using the old syntax. Old Syntax model = Model(solver=CbcSolver()) I know that GLPK with new syntax is like th…

---

## [Error solving multiple JuMP models in parallel](https://discourse.julialang.org/t/error-solving-multiple-jump-models-in-parallel/3047)

<div class="topic-metadata">

**Author:** [@FabsOliveira](https://discourse.julialang.org/u/FabsOliveira)\
**Replies:** 6\
**Last updated:** [April 9, 2017, 9:53am UTC](https://discourse.julialang.org/t/error-solving-multiple-jump-models-in-parallel/3047 "2017-04-09T09:53:44Z")

</div>

Hi everyone, I’m struggling with an error that I can’t really understand. I am trying to solve several JuMP.Models in parallel as a step of a decomposition algorithm that can exploit a specific structure of my model. I…

---

## [Advice about refactoring LinearFractional.jl for JuMP 0.19 and Julia 0.7](https://discourse.julialang.org/t/advice-about-refactoring-linearfractional-jl-for-jump-0-19-and-julia-0-7/12966)

<div class="topic-metadata">

**Author:** [@ianfiske](https://discourse.julialang.org/u/ianfiske)\
**Replies:** 7\
**Last updated:** [June 21, 2019, 3:07pm UTC](https://discourse.julialang.org/t/advice-about-refactoring-linearfractional-jl-for-jump-0-19-and-julia-0-7/12966 "2019-06-21T15:07:29Z")

</div>

A short while ago, I shared GitHub - nexteraanalytics/LinearFractional.jl: Linear fractional programming with Julia and JuMP for solving linear fractional programs with JuMP. I’m now looking into a big refactor to take …

---

## [Retriving the Tableau from Gurobi](https://discourse.julialang.org/t/retriving-the-tableau-from-gurobi/25468)

<div class="topic-metadata">

**Author:** [@rcallen24](https://discourse.julialang.org/u/rcallen24)\
**Replies:** 2\
**Last updated:** [June 20, 2019, 3:11pm UTC](https://discourse.julialang.org/t/retriving-the-tableau-from-gurobi/25468 "2019-06-20T15:11:33Z")

</div>

I am trying to get the tableau from Gurobi and running into some problems. I went through the gurobi github and reference manual and was able to put this together but it is erroring out. # dummy model m = direct\_model(G…

---

## [JuMP: filtering the output of JuMP.value.(x)](https://discourse.julialang.org/t/jump-filtering-the-output-of-jump-value-x/25391)

<div class="topic-metadata">

**Author:** [@PatrickHealy](https://discourse.julialang.org/u/PatrickHealy)\
**Replies:** 3\
**Last updated:** [June 18, 2019, 4:42pm UTC](https://discourse.julialang.org/t/jump-filtering-the-output-of-jump-value-x/25391 "2019-06-18T16:42:48Z")

</div>

Is there a nice idiom for filtering all of the elements of a JuMP array of binaries that are set? Even with iterating over the elements of JuMP.value.(x) in a for-loop I don’t seem to be able to catch the indices in a u…

---

## [JuMP v0.19 and CPLEX versions](https://discourse.julialang.org/t/jump-v0-19-and-cplex-versions/25253)

<div class="topic-metadata">

**Author:** [@PatrickHealy](https://discourse.julialang.org/u/PatrickHealy)\
**Replies:** 5\
**Last updated:** [June 18, 2019, 2:09pm UTC](https://discourse.julialang.org/t/jump-v0-19-and-cplex-versions/25253 "2019-06-18T14:09:06Z")

</div>

Greetings. While upgrading to julia 1.1.1 I thought it would be a good time to upgrade to JuMP 0.19. However, I could not add the CPLEX package (the executable and libraries could not be found) because CPLEX12.6 is not…

---

## [Optimization using SAMIN()](https://discourse.julialang.org/t/optimization-using-samin/25351)

<div class="topic-metadata">

**Author:** [@Farnazmdi](https://discourse.julialang.org/u/Farnazmdi)\
**Replies:** 10\
**Last updated:** [June 18, 2019, 10:00am UTC](https://discourse.julialang.org/t/optimization-using-samin/25351 "2019-06-18T10:00:31Z")

</div>

Hi, I am trying to use SAMIN() for constrained optimization for a DDE parameter estimation, I have seen the example in \[Optim.jl\] and I am following the same syntax, but get the error of Dimension mismatch. resid is t…

---

## [Optim \`Fminbox()\` -- what is wrong](https://discourse.julialang.org/t/optim-fminbox-what-is-wrong/25252)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 2\
**Last updated:** [June 14, 2019, 7:18am UTC](https://discourse.julialang.org/t/optim-fminbox-what-is-wrong/25252 "2019-06-14T07:18:47Z")

</div>

I’m trying to use Optim and Fminbox() for model fitting, but get an error message – and wonder what I do wrong. Here is what I do: I have created a loss function loss(p) (squared norm of shooting error for ODE). As my i…

---

## [Type of binary variables in constraints](https://discourse.julialang.org/t/type-of-binary-variables-in-constraints/25264)

<div class="topic-metadata">

**Author:** [@owiecc](https://discourse.julialang.org/u/owiecc)\
**Replies:** 4\
**Last updated:** [June 13, 2019, 8:28pm UTC](https://discourse.julialang.org/t/type-of-binary-variables-in-constraints/25264 "2019-06-13T20:28:00Z")

</div>

When I set this problem: data = \[2;3;4;-1;0\] model = Model(with\_optimizer(GLPK.Optimizer)) @variable(model, x\[1:length(data)\], Bin) @objective(model, Min, sum(data.\*x)) optimize!(model) typeof(value.(x)) I would expect…

---

## [Semi-continuous variables: JuMP and Cplex solver](https://discourse.julialang.org/t/semi-continuous-variables-jump-and-cplex-solver/24966)

<div class="topic-metadata">

**Author:** [@bienpierre](https://discourse.julialang.org/u/bienpierre)\
**Replies:** 2\
**Last updated:** [June 6, 2019, 4:08pm UTC](https://discourse.julialang.org/t/semi-continuous-variables-jump-and-cplex-solver/24966 "2019-06-06T16:08:17Z")

</div>

Hello, I have a semi-continuous variable, the domain is {0} U \[l,u\]. Example is: using JuMP using CPLEX MyModel = Model(with\_optimizer(CPLEX.Optimizer)) @variable(MyModel, zz) @constraint(MyModel, zz in MOI.Semicontin…

---

## [Automatic differentiation of an objective, which already uses AD tools](https://discourse.julialang.org/t/automatic-differentiation-of-an-objective-which-already-uses-ad-tools/24864)

<div class="topic-metadata">

**Author:** [@ArnoStrouwen](https://discourse.julialang.org/u/ArnoStrouwen)\
**Replies:** 3\
**Last updated:** [June 4, 2019, 9:08am UTC](https://discourse.julialang.org/t/automatic-differentiation-of-an-objective-which-already-uses-ad-tools/24864 "2019-06-04T09:08:40Z")

</div>

I’m searching for parameters u to maximize a function obj(u). This objective function, however, depends on the derivatives of another function y(u,p), with regards to the parameters p. An example: abstract type S1 end …

---

## [Integer variable as index of input matrix](https://discourse.julialang.org/t/integer-variable-as-index-of-input-matrix/24725)

<div class="topic-metadata">

**Author:** [@Raminel](https://discourse.julialang.org/u/Raminel)\
**Replies:** 2\
**Last updated:** [May 29, 2019, 2:08pm UTC](https://discourse.julialang.org/t/integer-variable-as-index-of-input-matrix/24725 "2019-05-29T14:08:14Z")

</div>

Hi people, Can I formulate an expression in Julia and use an integer variable as an index of an input matrix? @variable(m, 1 \<= t\[1:3, 1:3\] \<= 8, Int) P = \[ 90 80 60 70 50 30 10 0\] for i = 1:3 for j = 1:3 M\[i,j\] =…

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

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