# Optimization (Mathematical)

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

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

**Page:** 74

---

## [Column Gerneration Example in the documentation/hot start after adding variables to LP](https://discourse.julialang.org/t/column-gerneration-example-in-the-documentation-hot-start-after-adding-variables-to-lp/69603)

<div class="topic-metadata">

**Author:** [@dirk](https://discourse.julialang.org/u/dirk)\
**Replies:** 1\
**Last updated:** [October 12, 2021, 4:40am UTC](https://discourse.julialang.org/t/column-gerneration-example-in-the-documentation-hot-start-after-adding-variables-to-lp/69603 "2021-10-12T04:40:31Z")

</div>

Hi all, I just started using Julia and JuMP. I went through the tutorials (https://jump.dev/JuMP.jl/stable/tutorials/Mixed-integer%20linear%20programs/cutting\_stock\_column\_generation/) and in the column generation exam…

---

## [Fastest way to add many JuMP constraints](https://discourse.julialang.org/t/fastest-way-to-add-many-jump-constraints/69587)

<div class="topic-metadata">

**Author:** [@ZHEN\_LIN](https://discourse.julialang.org/u/ZHEN_LIN)\
**Replies:** 6\
**Last updated:** [October 12, 2021, 3:08am UTC](https://discourse.julialang.org/t/fastest-way-to-add-many-jump-constraints/69587 "2021-10-12T03:08:43Z")

</div>

What is the best way to add the following constraints in JuMP to minimize computation time? I need to solve similar models many times. @constraint(model, \[i = 1:n, j = 1:m\], \[t\[i, j\], 1, x\[i, j\]\] in MOI.ExponentialCone(…

---

## [Printing non linear expression in model](https://discourse.julialang.org/t/printing-non-linear-expression-in-model/69505)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 5\
**Last updated:** [October 11, 2021, 7:10am UTC](https://discourse.julialang.org/t/printing-non-linear-expression-in-model/69505 "2021-10-11T07:10:59Z")

</div>

Hi All, is there a way to print non linear expression model=Model() @variable(model,x) exp1 =@NLexpression(model,x\*x) @NLconstraint(model,exp1\<=10) println("exp1",exp1) output exp1"Reference to nonlinear expression …

---

## [Necessary Second-Order Optimality Condition of Iterate within a Specified Tolerance](https://discourse.julialang.org/t/necessary-second-order-optimality-condition-of-iterate-within-a-specified-tolerance/69334)

<div class="topic-metadata">

**Author:** [@danphenderson](https://discourse.julialang.org/u/danphenderson)\
**Replies:** 5\
**Last updated:** [October 9, 2021, 1:21pm UTC](https://discourse.julialang.org/t/necessary-second-order-optimality-condition-of-iterate-within-a-specified-tolerance/69334 "2021-10-09T13:21:29Z")

</div>

Hello, I am working with a scheme that seeks an unconstrained local minimizer of some C^2 function f. The scheme terminates when the necessary first-order optimality condition for the iterate x has been met, up to a pr…

---

## [What is the uknown rate, how to resolve it?](https://discourse.julialang.org/t/what-is-the-uknown-rate-how-to-resolve-it/68839)

<div class="topic-metadata">

**Author:** [@Lessvn](https://discourse.julialang.org/u/Lessvn)\
**Replies:** 4\
**Last updated:** [October 8, 2021, 1:28pm UTC](https://discourse.julialang.org/t/what-is-the-uknown-rate-how-to-resolve-it/68839 "2021-10-08T13:28:17Z")

</div>

Hello, I am trying to solve an optimzation problem using SCIP, it looks like every thing is fine, unless I get this warning at the onset where the solution starts. WARNING: ignore partial solution (0) because unknown …

---

## [Ipopt and JuMP - Invalid number in NLP function or derivative](https://discourse.julialang.org/t/ipopt-and-jump-invalid-number-in-nlp-function-or-derivative/69342)

<div class="topic-metadata">

**Author:** [@jaberdeen](https://discourse.julialang.org/u/jaberdeen)\
**Replies:** 4\
**Last updated:** [October 7, 2021, 6:50am UTC](https://discourse.julialang.org/t/ipopt-and-jump-invalid-number-in-nlp-function-or-derivative/69342 "2021-10-07T06:50:38Z")

</div>

We are generalising the following julia code to two or more dimensional grids. The following is the output (for each grid point): "Number of Iterations…: 0 Number of objective function evaluations = 0 N…

---

## [Error in NL expression UndefVarError: exp1 not defined](https://discourse.julialang.org/t/error-in-nl-expression-undefvarerror-exp1-not-defined/68780)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 2\
**Last updated:** [October 6, 2021, 3:52am UTC](https://discourse.julialang.org/t/error-in-nl-expression-undefvarerror-exp1-not-defined/68780 "2021-10-06T03:52:56Z")

</div>

Hi All, is there a way to use NL expression from nested loops? outside nested loops example code using JuMP model=Model() @variable(model,x) xy=1 for z in 1:10 if z==1 if xy\>=1 @NLexpression(model,exp1,x^3) …

---

## [How to register the name of anonymous variable to certain model?](https://discourse.julialang.org/t/how-to-register-the-name-of-anonymous-variable-to-certain-model/69273)

<div class="topic-metadata">

**Author:** [@iiitr](https://discourse.julialang.org/u/iiitr)\
**Replies:** 1\
**Last updated:** [October 6, 2021, 3:47am UTC](https://discourse.julialang.org/t/how-to-register-the-name-of-anonymous-variable-to-certain-model/69273 "2021-10-06T03:47:49Z")

</div>

Hi all, I cannot view the anonymous variable in the model, when I use the following method: julia\> model = Model() A JuMP Model Feasibility problem with: Variables: 0 Model mode: AUTOMATIC CachingOptimizer state: NO\_OP…

---

## [Extremely low values of barrier term mu in Fminbox](https://discourse.julialang.org/t/extremely-low-values-of-barrier-term-mu-in-fminbox/69264)

<div class="topic-metadata">

**Author:** [@Gabriel\_Kreindler](https://discourse.julialang.org/u/Gabriel_Kreindler)\
**Replies:** 2\
**Last updated:** [October 5, 2021, 10:36pm UTC](https://discourse.julialang.org/t/extremely-low-values-of-barrier-term-mu-in-fminbox/69264 "2021-10-05T22:36:01Z")

</div>

I am puzzled by Fminbox decreasing mu (the barier penalty term) to extremely low values. I do not quite understand why this happens and how I can control it. I run something like (note in case it’s relevant that my\_obj\_…

---

## [Abstract Branch and Bound API for MIP](https://discourse.julialang.org/t/abstract-branch-and-bound-api-for-mip/4691)

<div class="topic-metadata">

**Author:** [@michaellindon](https://discourse.julialang.org/u/michaellindon)\
**Replies:** 19\
**Last updated:** [October 5, 2021, 10:37am UTC](https://discourse.julialang.org/t/abstract-branch-and-bound-api-for-mip/4691 "2021-10-05T10:37:02Z")

</div>

I have a non-linear objective function F of p binary arguments… I would like to solve this using a branch and bound method, using a continuous relaxation to acquire the bound. The continuous relaxation of F, however, i…

---

## [Passing "dynamic" argument to function in Optim.jl](https://discourse.julialang.org/t/passing-dynamic-argument-to-function-in-optim-jl/69202)

<div class="topic-metadata">

**Author:** [@Gabriel\_Kreindler](https://discourse.julialang.org/u/Gabriel_Kreindler)\
**Replies:** 2\
**Last updated:** [October 4, 2021, 8:16pm UTC](https://discourse.julialang.org/t/passing-dynamic-argument-to-function-in-optim-jl/69202 "2021-10-04T20:16:08Z")

</div>

Hello, I have an objective function that solves for a vector z using an iterative algorithm. I then feed this into optimize(). I can use a “static” starting guess z0 that I set before calling optimize. However, it might…

---

## [SimulatedAnnealing (and SAMIN) claims "Status Failure", but output seems to be OK?](https://discourse.julialang.org/t/simulatedannealing-and-samin-claims-status-failure-but-output-seems-to-be-ok/69146)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 3\
**Last updated:** [October 4, 2021, 10:28am UTC](https://discourse.julialang.org/t/simulatedannealing-and-samin-claims-status-failure-but-output-seems-to-be-ok/69146 "2021-10-04T10:28:08Z")

</div>

I am trying to get SimulatedAnnealing to work for an optimisation problem, so I first look at a basic example. using Optim f(x) = (1.0 - x\[1\])^2 + 100.0 \* (x\[2\] - x\[1\]^2)^2 This works fine: x0 = \[0.0,0.0\] res = optimi…

---

## [How to set lower and upper bound for SimulatedAnnealing OptimizationProblem's? Tired "lu=" and "ub=" but doesn't seem to work](https://discourse.julialang.org/t/how-to-set-lower-and-upper-bound-for-simulatedannealing-optimizationproblems-tired-lu-and-ub-but-doesnt-seem-to-work/69134)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 6\
**Last updated:** [October 3, 2021, 5:42pm UTC](https://discourse.julialang.org/t/how-to-set-lower-and-upper-bound-for-simulatedannealing-optimizationproblems-tired-lu-and-ub-but-doesnt-seem-to-work/69134 "2021-10-03T17:42:03Z")

</div>

This is the sampel code: using GalacticOptim, Optim function tmp(x,p) return (x\[1\]-2)^2 end prob = OptimizationProblem(tmp,\[4.\],lb=\[3\],ub=\[6\]) res = solve(prob,SimulatedAnnealing()) the result is correct 1.99822287…

---

## [How to extend the JuMP @variable so that it can construct a sparse array which can be used as a full matrix?](https://discourse.julialang.org/t/how-to-extend-the-jump-variable-so-that-it-can-construct-a-sparse-array-which-can-be-used-as-a-full-matrix/69125)

<div class="topic-metadata">

**Author:** [@iiitr](https://discourse.julialang.org/u/iiitr)\
**Replies:** 1\
**Last updated:** [October 3, 2021, 1:54am UTC](https://discourse.julialang.org/t/how-to-extend-the-jump-variable-so-that-it-can-construct-a-sparse-array-which-can-be-used-as-a-full-matrix/69125 "2021-10-03T01:54:41Z")

</div>

Hi all In fact, this question is a derivative of my last question. I want to create a 4x4 array variables, but it only has a value at the index (1, 2), (2, 1), (2, 3), (3, 2) and the rest is 0. @blegat provide sever…

---

## [Can JuMP.jl create a sparse array variable that can be used as a full matrix?](https://discourse.julialang.org/t/can-jump-jl-create-a-sparse-array-variable-that-can-be-used-as-a-full-matrix/69114)

<div class="topic-metadata">

**Author:** [@iiitr](https://discourse.julialang.org/u/iiitr)\
**Replies:** 2\
**Last updated:** [October 3, 2021, 1:21am UTC](https://discourse.julialang.org/t/can-jump-jl-create-a-sparse-array-variable-that-can-be-used-as-a-full-matrix/69114 "2021-10-03T01:21:15Z")

</div>

Hi all Recently, I have encountered some problems in optimizing code speed. I guess it is because I always create dense array variables I want to create a 4x4 array variables, but it only has a value at the index (1, 2…

---

## [How to code the following optimization problem](https://discourse.julialang.org/t/how-to-code-the-following-optimization-problem/69098)

<div class="topic-metadata">

**Author:** [@Jaidy](https://discourse.julialang.org/u/Jaidy)\
**Replies:** 4\
**Last updated:** [October 2, 2021, 10:57pm UTC](https://discourse.julialang.org/t/how-to-code-the-following-optimization-problem/69098 "2021-10-02T22:57:26Z")

</div>

Hi everyone, I have the following optimization problem to solve: minimize c^Tx, subject to ||c^Tx||\_1 \<= C Can someone tell me how to write this in say NLopt, or any other library?

---

## [How does JuMP.jl (Gurobi solver) take full advantage of the performance of multi-core CPUs](https://discourse.julialang.org/t/how-does-jump-jl-gurobi-solver-take-full-advantage-of-the-performance-of-multi-core-cpus/69103)

<div class="topic-metadata">

**Author:** [@iiitr](https://discourse.julialang.org/u/iiitr)\
**Replies:** 2\
**Last updated:** [October 2, 2021, 11:07am UTC](https://discourse.julialang.org/t/how-does-jump-jl-gurobi-solver-take-full-advantage-of-the-performance-of-multi-core-cpus/69103 "2021-10-02T11:07:24Z")

</div>

Hi all, In the past, I usually used Yalmip to complete the modeling of mathematical optimization. When I construct a large-scale mixed integer linear programming, I don’t need any additional settings, and Gurobi can alw…

---

## [How to set max\_iterations for Optim.jl](https://discourse.julialang.org/t/how-to-set-max-iterations-for-optim-jl/61410)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 5\
**Last updated:** [October 1, 2021, 6:04pm UTC](https://discourse.julialang.org/t/how-to-set-max-iterations-for-optim-jl/61410 "2021-10-01T18:04:32Z")

</div>

I have the following code: lower = \[-20, -20, -20, -20, -20, -20.0, -20, -20, -20, -20, -20, -20\] upper = \[ 20, 20, 20, 20, 20, 20.0, 20, 20, 20, 20, 20, 20\] initial\_x = \[-1.4665866297620287, -3.…

---

## [Callbacks interfering with solver output](https://discourse.julialang.org/t/callbacks-interfering-with-solver-output/69001)

<div class="topic-metadata">

**Author:** [@arkanver](https://discourse.julialang.org/u/arkanver)\
**Replies:** 2\
**Last updated:** [October 1, 2021, 8:35am UTC](https://discourse.julialang.org/t/callbacks-interfering-with-solver-output/69001 "2021-10-01T08:35:39Z")

</div>

Hello all, I am currently working on a MILP using JuMP and Gurobi. As far as I’m aware my versions are all up to date - Julia 1.6.3, JuMP v0.21.10, Gurobi.jl v0.9.14 (and Gurobi - the solver - 9.1.2). I’m solving my pr…

---

## [Gurobi callback in JuMP for submitting heuristic solution](https://discourse.julialang.org/t/gurobi-callback-in-jump-for-submitting-heuristic-solution/69006)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 2\
**Last updated:** [September 30, 2021, 8:40pm UTC](https://discourse.julialang.org/t/gurobi-callback-in-jump-for-submitting-heuristic-solution/69006 "2021-09-30T20:40:52Z")

</div>

Dear All, I am trying to implement the fix-and-dive heuristic for the traveling salesman problem in JuMP with Gurobi based on the Python+Gurobi code available here: https://github.com/Gurobi/pres-mipheur/blob/master/mip…

---

## [Linear constraint optimisation on GPU](https://discourse.julialang.org/t/linear-constraint-optimisation-on-gpu/68692)

<div class="topic-metadata">

**Author:** [@Huy\_Nguyen](https://discourse.julialang.org/u/Huy_Nguyen)\
**Replies:** 5\
**Last updated:** [September 29, 2021, 9:45am UTC](https://discourse.julialang.org/t/linear-constraint-optimisation-on-gpu/68692 "2021-09-29T09:45:33Z")

</div>

I currently use JuMP and Ipopt to solve Linear Constraints Optimisation problems, primarily with linear equality and inequality constraints. I would like to either solve many of these problems in parallel, or sequentiall…

---

## [Randomness in initialization](https://discourse.julialang.org/t/randomness-in-initialization/68822)

<div class="topic-metadata">

**Author:** [@joe\_sonic](https://discourse.julialang.org/u/joe_sonic)\
**Replies:** 10\
**Last updated:** [September 28, 2021, 1:20pm UTC](https://discourse.julialang.org/t/randomness-in-initialization/68822 "2021-09-28T13:20:25Z")

</div>

Hi, I have a simple model, which I know there exists multiplicity in results. When I start Ipopt to optimize this model, I found out that every time the optimizer gives me different results. The question is: Is there a …

---

## [Problem using JuMP with user-defined function](https://discourse.julialang.org/t/problem-using-jump-with-user-defined-function/68835)

<div class="topic-metadata">

**Author:** [@vinicius\_de\_lima](https://discourse.julialang.org/u/vinicius_de_lima)\
**Replies:** 1\
**Last updated:** [September 27, 2021, 9:40pm UTC](https://discourse.julialang.org/t/problem-using-jump-with-user-defined-function/68835 "2021-09-27T21:40:48Z")

</div>

I am trying to use JuMP to solve a Non-linear optimization problem, but find a problem using the following code: function Q(H,h\_0,C,D,L) if H \<= h\_0 return 0.0 else Δh = H - h\_0 J = …

---

## [Need a combinatorial optimizer for black box function](https://discourse.julialang.org/t/need-a-combinatorial-optimizer-for-black-box-function/68791)

<div class="topic-metadata">

**Author:** [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Replies:** 6\
**Last updated:** [September 27, 2021, 1:34pm UTC](https://discourse.julialang.org/t/need-a-combinatorial-optimizer-for-black-box-function/68791 "2021-09-27T13:34:03Z")

</div>

I’m looking for a combinatorial optimizer (decision variables are a permutation of the integers 1, 2, \\ldots, N, where N is between, say, 50, and 500, for a black box function (i.e., only the value of the objective funct…

---

## [How to specify algorithm-specific parameters in NLopt.jl?](https://discourse.julialang.org/t/how-to-specify-algorithm-specific-parameters-in-nlopt-jl/68765)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 7\
**Last updated:** [September 27, 2021, 1:44am UTC](https://discourse.julialang.org/t/how-to-specify-algorithm-specific-parameters-in-nlopt-jl/68765 "2021-09-27T01:44:47Z")

</div>

The General Reference of NLopt here describes how to specify algorithm-specific parameters, but the NLopt.jl documentation does not have that section. Is it possible to access those parameters from NLopt.jl?

---

## [How mature is GalacticOptim for use NLopt algorithms](https://discourse.julialang.org/t/how-mature-is-galacticoptim-for-use-nlopt-algorithms/68764)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 1\
**Last updated:** [September 26, 2021, 12:11pm UTC](https://discourse.julialang.org/t/how-mature-is-galacticoptim-for-use-nlopt-algorithms/68764 "2021-09-26T12:11:30Z")

</div>

GalacticOptim has very convenient features like automatically constructing gradients, etc. but I am worried about its maturity given the thin documentation. Am I better off just using the NLopt.jl API directly?

---

## [Compressed Sensing using StructuredOptimization.jl](https://discourse.julialang.org/t/compressed-sensing-using-structuredoptimization-jl/35098)

<div class="topic-metadata">

**Author:** [@lstagner](https://discourse.julialang.org/u/lstagner)\
**Replies:** 12\
**Last updated:** [September 26, 2021, 11:35am UTC](https://discourse.julialang.org/t/compressed-sensing-using-structuredoptimization-jl/35098 "2021-09-26T11:35:59Z")

</div>

Here is something cool I did: gist using LinearAlgebra using Random using FFTW using PyPlot using StructuredOptimization N = 256 P = 5 K = 32 # Pick out P random frequencies freq = randperm(Int(N/2)).-1 freq = freq\[1:…

---

## [How to pass optimizer options to GalacticOptim?](https://discourse.julialang.org/t/how-to-pass-optimizer-options-to-galacticoptim/68742)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 1\
**Last updated:** [September 25, 2021, 10:35am UTC](https://discourse.julialang.org/t/how-to-pass-optimizer-options-to-galacticoptim/68742 "2021-09-25T10:35:45Z")

</div>

I’m trying to play with GalacticOptim. How can I pass options to the optimizer? In plain Optim, I can pass options like store\_trace with Optim.Options(store\_trace=true). How can I pass those options in the example below? …

---

## [MultiJuMP.jl - linear models](https://discourse.julialang.org/t/multijump-jl-linear-models/68695)

<div class="topic-metadata">

**Author:** [@s154428](https://discourse.julialang.org/u/s154428)\
**Replies:** 4\
**Last updated:** [September 25, 2021, 5:17am UTC](https://discourse.julialang.org/t/multijump-jl-linear-models/68695 "2021-09-25T05:17:36Z")

</div>

Hi I’m solving a multi objective MILP with two objectives and I’m using the package MultiJuMP.jl. When solving linear models the are two methods in MultiJuMP a WeightedSum and EpsilonCons. Why should I not provide the…

---

## [Reproducing rosenbrock example: can't see the candidate solution](https://discourse.julialang.org/t/reproducing-rosenbrock-example-cant-see-the-candidate-solution/68643)

<div class="topic-metadata">

**Author:** [@rio](https://discourse.julialang.org/u/rio)\
**Replies:** 1\
**Last updated:** [September 24, 2021, 4:43am UTC](https://discourse.julialang.org/t/reproducing-rosenbrock-example-cant-see-the-candidate-solution/68643 "2021-09-24T04:43:34Z")

</div>

Hi, when I run the rosenbrock example in https://github.com/JuliaNLSolvers/Optim.jl/ using Optim rosenbrock(x) = (1.0 - x\[1\])^2 + 100.0 \* (x\[2\] - x\[1\]^2)^2 result = optimize(rosenbrock, zeros(2), BFGS()) I get this o…

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

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