# Optimization (Mathematical)

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

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

**Page:** 80

---

## [Help with JuMP variables](https://discourse.julialang.org/t/help-with-jump-variables/61733)

<div class="topic-metadata">

**Author:** [@Dan.phi](https://discourse.julialang.org/u/Dan.phi)\
**Replies:** 1\
**Last updated:** [May 25, 2021, 11:34pm UTC](https://discourse.julialang.org/t/help-with-jump-variables/61733 "2021-05-25T23:34:40Z")

</div>

I am trying to solve a constrained optimization problem using JuMP, but there is apparently a conflict between how I define the variables and one of the packages I call in the objective function. I just started with JuMP…

---

## [COSMO.jl & Convex.jl: setting intial values](https://discourse.julialang.org/t/cosmo-jl-convex-jl-setting-intial-values/61381)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 4\
**Last updated:** [May 25, 2021, 7:49pm UTC](https://discourse.julialang.org/t/cosmo-jl-convex-jl-setting-intial-values/61381 "2021-05-25T19:49:44Z")

</div>

Hi, I’m using COSMO.jl as a solver from Convex.jl. I’m solving tseveral ‘related problems’ over and over again, which correspond to more precise versions of each others. I’d like to use the COSMO.jl warm starting featu…

---

## [SDDiP: Could not solve for Lagrangian duals. Iteration limit exceeded](https://discourse.julialang.org/t/sddip-could-not-solve-for-lagrangian-duals-iteration-limit-exceeded/61673)

<div class="topic-metadata">

**Author:** [@BYS](https://discourse.julialang.org/u/BYS)\
**Replies:** 5\
**Last updated:** [May 24, 2021, 8:44am UTC](https://discourse.julialang.org/t/sddip-could-not-solve-for-lagrangian-duals-iteration-limit-exceeded/61673 "2021-05-24T08:44:09Z")

</div>

I have tried a SDDP model including integer using “integrality\_handler=SDDP.SDDiP()”, and I set SDDP.train(model; iteration\_limit = 10) The results are as follows, ERROR: LoadError: Could not solve for Lagrangian dual…

---

## [Optim.jl vs NLopt.jl vs?](https://discourse.julialang.org/t/optim-jl-vs-nlopt-jl-vs/61692)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 8\
**Last updated:** [May 24, 2021, 4:00am UTC](https://discourse.julialang.org/t/optim-jl-vs-nlopt-jl-vs/61692 "2021-05-24T04:00:08Z")

</div>

I have a kind of hard nonlinear optimization problem. 12 variables, I know the result of the function should be zero, but how to find the combination of 12 values that give a very low residual? So far I tried Optim.jl a…

---

## [SDDP:MethodError: no method matching \*(::Float64, ::SDDP.State{VariableRef})](https://discourse.julialang.org/t/sddp-no-method-matching-float64-sddp-state-variableref/61666)

<div class="topic-metadata">

**Author:** [@BYS](https://discourse.julialang.org/u/BYS)\
**Replies:** 4\
**Last updated:** [May 23, 2021, 4:13am UTC](https://discourse.julialang.org/t/sddp-no-method-matching-float64-sddp-state-variableref/61666 "2021-05-23T04:13:36Z")

</div>

Hi, If I write using SDDP,Gurobi a=2\*ones(10) a\[1\]=3 a\[2\]=4 ini\_a=ones(10); c\_a=ones(10); model = SDDP.LinearPolicyGraph( stages = 3, sense = :Min, lower\_bound = 0.0, optimizer = Gurobi.Optimizer, ) do …

---

## [SDDiP.jl - LoadError: AssertionError: \[...\] == :Optimal](https://discourse.julialang.org/t/sddip-jl-loaderror-assertionerror-optimal/24781)

<div class="topic-metadata">

**Author:** [@eltuck](https://discourse.julialang.org/u/eltuck)\
**Replies:** 10\
**Last updated:** [May 23, 2021, 2:47am UTC](https://discourse.julialang.org/t/sddip-jl-loaderror-assertionerror-optimal/24781 "2021-05-23T02:47:35Z")

</div>

Hi all, I’m new to Julia (coming from AMPL), and I’m trying to solve a model using the SDDiP algorithm implemented in SDDiP.jl and CPLEX. I’m able to implement many of the example models, and the algorithm generally wo…

---

## [Trying to solve a puzzle](https://discourse.julialang.org/t/trying-to-solve-a-puzzle/61515)

<div class="topic-metadata">

**Author:** [@sogrbilja](https://discourse.julialang.org/u/sogrbilja)\
**Replies:** 23\
**Last updated:** [May 23, 2021, 2:32am UTC](https://discourse.julialang.org/t/trying-to-solve-a-puzzle/61515 "2021-05-23T02:32:19Z")

</div>

Just recently I bumped on this: The PuzzlOR and I want to play a bit with that and solve it using JuMP. My approach is not yet certain, but something like this: load data into DICT(string, int) \* actually just 0 or 1 …

---

## [Can JuMP.fix be use to fix Array{Float64,1} to Array{VariableRef,1}](https://discourse.julialang.org/t/can-jump-fix-be-use-to-fix-array-float64-1-to-array-variableref-1/61640)

<div class="topic-metadata">

**Author:** [@BYS](https://discourse.julialang.org/u/BYS)\
**Replies:** 3\
**Last updated:** [May 23, 2021, 1:27am UTC](https://discourse.julialang.org/t/can-jump-fix-be-use-to-fix-array-float64-1-to-array-variableref-1/61640 "2021-05-23T01:27:12Z")

</div>

Hi, I find if I write model=Model(); ep=ones(20); @variable(model,ep1\[1:20\]); JuMP.fix(ep1,ep); I find it cannot be deal with, and do the JuMP.fix need to fix one by one? and How can I do it? Thanks a lot.

---

## [Why is this optimization problem so slow in Julia? In R it took 60s](https://discourse.julialang.org/t/why-is-this-optimization-problem-so-slow-in-julia-in-r-it-took-60s/61557)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 31\
**Last updated:** [May 22, 2021, 9:52am UTC](https://discourse.julialang.org/t/why-is-this-optimization-problem-so-slow-in-julia-in-r-it-took-60s/61557 "2021-05-22T09:52:28Z")

</div>

Update I copied the data and the code into a repo GitHub - xiaodaigh/optim-slow-julia I am trying to estimate the strength of Go player ( or any other two player broad game where the only outcomes are win or loser). M…

---

## [Status of relaxation: NORM\_LIMIT](https://discourse.julialang.org/t/status-of-relaxation-norm-limit/61078)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 7\
**Last updated:** [May 21, 2021, 9:39pm UTC](https://discourse.julialang.org/t/status-of-relaxation-norm-limit/61078 "2021-05-21T21:39:21Z")

</div>

Hi All, I am solving an MINLP using Juniper and getting this Status of relaxation: NORM\_LIMIT any suggestions how to resolve this. Thanks

---

## [How can I forcefully bridge sum-of-squares constraints into PSD constraints?](https://discourse.julialang.org/t/how-can-i-forcefully-bridge-sum-of-squares-constraints-into-psd-constraints/61365)

<div class="topic-metadata">

**Author:** [@ciba12](https://discourse.julialang.org/u/ciba12)\
**Replies:** 4\
**Last updated:** [May 21, 2021, 8:48pm UTC](https://discourse.julialang.org/t/how-can-i-forcefully-bridge-sum-of-squares-constraints-into-psd-constraints/61365 "2021-05-21T20:48:37Z")

</div>

Hi everyone, I have model written using SumOfSquares.jl, it contains “F in S” pairs such as Vector{AffExpr}\`-in-\`SumOfSquares.SOSPolynomialSet{BasicSemialgebraicSet{Float64, Polynomial{true, Float64}, FullSpace}, Monom…

---

## [Slow model generation in JUMP](https://discourse.julialang.org/t/slow-model-generation-in-jump/61477)

<div class="topic-metadata">

**Author:** [@Popeye](https://discourse.julialang.org/u/Popeye)\
**Replies:** 13\
**Last updated:** [May 20, 2021, 12:55pm UTC](https://discourse.julialang.org/t/slow-model-generation-in-jump/61477 "2021-05-20T12:55:55Z")

</div>

I need to decide between using JUMP and Python-MIP for a large MILP. Python-MIP has some impressive benchmarks on its website, and provides more features such as lazy constraints and call-backs with CBC solver. But here …

---

## [NLopt returning :FAILURE, but only with :LD\_LBFGS](https://discourse.julialang.org/t/nlopt-returning-failure-but-only-with-ld-lbfgs/61475)

<div class="topic-metadata">

**Author:** [@jbshannon](https://discourse.julialang.org/u/jbshannon)\
**Replies:** 1\
**Last updated:** [May 20, 2021, 4:08am UTC](https://discourse.julialang.org/t/nlopt-returning-failure-but-only-with-ld-lbfgs/61475 "2021-05-20T04:08:40Z")

</div>

I’m minimizing a GMM criterion function (uses a lot of data, so a MWE here would be tricky) using NLopt and I keep getting a return code of :FAILURE after a few iterations whenever I use :LD\_LBFGS. I don’t think this is …

---

## [JuMP not updating to latest version](https://discourse.julialang.org/t/jump-not-updating-to-latest-version/37770)

<div class="topic-metadata">

**Author:** [@cby](https://discourse.julialang.org/u/cby)\
**Replies:** 11\
**Last updated:** [May 18, 2021, 8:02pm UTC](https://discourse.julialang.org/t/jump-not-updating-to-latest-version/37770 "2021-05-18T20:02:58Z")

</div>

When I call pkg\> update JuMP, I only get version v0.19.2, while the latest stable release listed at Juliaopt.org is v0.21. I’d like to use some features that started in v0.20.

---

## [Constraint MINLP problem](https://discourse.julialang.org/t/constraint-minlp-problem/61272)

<div class="topic-metadata">

**Author:** [@Francisco\_Javier\_Mar](https://discourse.julialang.org/u/Francisco_Javier_Mar)\
**Replies:** 5\
**Last updated:** [May 18, 2021, 2:30am UTC](https://discourse.julialang.org/t/constraint-minlp-problem/61272 "2021-05-18T02:30:11Z")

</div>

Hello. I was wondering if someone could clarify a question for me. I have a problem when it comes to modeling in JuMP. I have a MINLP problem with the following objective function and constraints. @NLobjective(model,Min…

---

## [Can't get the same results at the rocket control tutorial in JuMP](https://discourse.julialang.org/t/cant-get-the-same-results-at-the-rocket-control-tutorial-in-jump/61235)

<div class="topic-metadata">

**Author:** [@yucho147](https://discourse.julialang.org/u/yucho147)\
**Replies:** 4\
**Last updated:** [May 17, 2021, 12:08am UTC](https://discourse.julialang.org/t/cant-get-the-same-results-at-the-rocket-control-tutorial-in-jump/61235 "2021-05-17T00:08:35Z")

</div>

Hi I am learning how to use the JuMP package. However, I am not getting the same results from the rocket control tutorial. https://jump.dev/JuMP.jl/v0.21.8/tutorials/Nonlinear%20programs/rocket\_control/ In my environm…

---

## [Constraint declaration generates an error](https://discourse.julialang.org/t/constraint-declaration-generates-an-error/61239)

<div class="topic-metadata">

**Author:** [@mamo](https://discourse.julialang.org/u/mamo)\
**Replies:** 6\
**Last updated:** [May 16, 2021, 3:16pm UTC](https://discourse.julialang.org/t/constraint-declaration-generates-an-error/61239 "2021-05-16T15:16:34Z")

</div>

Dear all, how to type the constraint below in order to avoid an error. for j in N1 if j\>1 && j\<7 @constraint(vrpm, sum(x\[j,i,k\] for i in N5, k in B if i!=j) -sum(x\[i,j,k\] for i in N4, k in B, if i!=j) == 0) end en…

---

## [Optimising a non-linear user-defined function using NLopt](https://discourse.julialang.org/t/optimising-a-non-linear-user-defined-function-using-nlopt/61141)

<div class="topic-metadata">

**Author:** [@Debasish](https://discourse.julialang.org/u/Debasish)\
**Replies:** 5\
**Last updated:** [May 14, 2021, 1:21pm UTC](https://discourse.julialang.org/t/optimising-a-non-linear-user-defined-function-using-nlopt/61141 "2021-05-14T13:21:34Z")

</div>

Dear Julia experts, This is my second Julia code. I have a physical problem to solve in which a waving filament in fluid medium propels itself (think of a beating sperm tail). I have a MATLAB code which optimises the s…

---

## [Fixing vs Constraining a variable in JuMP](https://discourse.julialang.org/t/fixing-vs-constraining-a-variable-in-jump/27609)

<div class="topic-metadata">

**Author:** [@Libbum](https://discourse.julialang.org/u/Libbum)\
**Replies:** 13\
**Last updated:** [May 14, 2021, 11:10am UTC](https://discourse.julialang.org/t/fixing-vs-constraining-a-variable-in-jump/27609 "2021-05-14T11:10:13Z")

</div>

I was wondering if someone could explain the differences between fixing and constraining a variable in a little more detail than the JuMP documentation does. If you use fix(...; force=true); my understanding is that thi…

---

## [Counting non negative instances of a variable for use in constraint - efficient formulation?](https://discourse.julialang.org/t/counting-non-negative-instances-of-a-variable-for-use-in-constraint-efficient-formulation/60507)

<div class="topic-metadata">

**Author:** [@gobs](https://discourse.julialang.org/u/gobs)\
**Replies:** 6\
**Last updated:** [May 13, 2021, 5:58am UTC](https://discourse.julialang.org/t/counting-non-negative-instances-of-a-variable-for-use-in-constraint-efficient-formulation/60507 "2021-05-13T05:58:21Z")

</div>

This is an optimisation and not JuMP related question, but I thought it worth asking here. I have a constraint in my model which limits the number of non-negative instances of a variable. Specifically, I have a power bal…

---

## [LoadError: UndefVarError: Grisu not defined](https://discourse.julialang.org/t/loaderror-undefvarerror-grisu-not-defined/61000)

<div class="topic-metadata">

**Author:** [@healyp](https://discourse.julialang.org/u/healyp)\
**Replies:** 7\
**Last updated:** [May 12, 2021, 10:15pm UTC](https://discourse.julialang.org/t/loaderror-undefvarerror-grisu-not-defined/61000 "2021-05-12T22:15:23Z")

</div>

I’m getting the above error with JuMP / MathOptInterface when I attempt to write a model to a file: MOI.write\_to\_file(lp\_model, gName\*".lp") I note that there has been some discussion about Grisu in a plots+1.6 context…

---

## [How to update JuMP](https://discourse.julialang.org/t/how-to-update-jump/60682)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 2\
**Last updated:** [May 12, 2021, 6:05pm UTC](https://discourse.julialang.org/t/how-to-update-jump/60682 "2021-05-12T18:05:57Z")

</div>

I’m with JuMP v0.18.6 and I want to update to v0.21, but whenever I try the following message appears: julia\> Pkg.update ("JuMP") Updating registry at \`C: \\ Users \\ raquel.santos \\ .julia \\ registries \\ General\` …

---

## [Optim: Problems with Fminbox and the NelderMead algorithm](https://discourse.julialang.org/t/optim-problems-with-fminbox-and-the-neldermead-algorithm/60978)

<div class="topic-metadata">

**Author:** [@itzui](https://discourse.julialang.org/u/itzui)\
**Replies:** 4\
**Last updated:** [May 12, 2021, 10:44am UTC](https://discourse.julialang.org/t/optim-problems-with-fminbox-and-the-neldermead-algorithm/60978 "2021-05-12T10:44:39Z")

</div>

Hi, Today my Optim package was updated. However, after this update, the optimization doesn’t work anymore. For the optimization I use the Nelder-Mead algorithm. In order to set some boundaries, I use Fminbox, i.e., the …

---

## [Warmstarting variables does not work with Xpress](https://discourse.julialang.org/t/warmstarting-variables-does-not-work-with-xpress/60989)

<div class="topic-metadata">

**Author:** [@obar](https://discourse.julialang.org/u/obar)\
**Replies:** 3\
**Last updated:** [May 12, 2021, 4:00am UTC](https://discourse.julialang.org/t/warmstarting-variables-does-not-work-with-xpress/60989 "2021-05-12T04:00:19Z")

</div>

Hello, When using the xpress solver through JuMP and the Xpress.jl packages to solve a mixed-integer program, I seem to be unable to warm-start primal variable values using set\_start\_value. Is this expected? Thanks!

---

## [Constraint for scheduling worker to complete task before moving on](https://discourse.julialang.org/t/constraint-for-scheduling-worker-to-complete-task-before-moving-on/60984)

<div class="topic-metadata">

**Author:** [@eipi10](https://discourse.julialang.org/u/eipi10)\
**Replies:** 3\
**Last updated:** [May 12, 2021, 2:44am UTC](https://discourse.julialang.org/t/constraint-for-scheduling-worker-to-complete-task-before-moving-on/60984 "2021-05-12T02:44:21Z")

</div>

I have a worker-task scheduling problem that I am using a MILP on with JuMP. I want to set a constraint where once a worker starts a task they must complete that task before moving to a new task. I am looking at workers,…

---

## [How to use AD for function with multiple inputs?](https://discourse.julialang.org/t/how-to-use-ad-for-function-with-multiple-inputs/60932)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 4\
**Last updated:** [May 12, 2021, 12:36am UTC](https://discourse.julialang.org/t/how-to-use-ad-for-function-with-multiple-inputs/60932 "2021-05-12T00:36:24Z")

</div>

Over the past several days I have been struggling with AD for a particular function. I have boiled down the problem to this: using ForwardDiff function F!(resx, resy, x, y) resx\[1\] = 1 - x\[1\] resx\[2\] = 10(x\[2\]-…

---

## [Trying to save MPS from raw solver and problems with MOI.RawSolver()](https://discourse.julialang.org/t/trying-to-save-mps-from-raw-solver-and-problems-with-moi-rawsolver/58515)

<div class="topic-metadata">

**Author:** [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Replies:** 5\
**Last updated:** [May 11, 2021, 9:16pm UTC](https://discourse.julialang.org/t/trying-to-save-mps-from-raw-solver-and-problems-with-moi-rawsolver/58515 "2021-05-11T21:16:07Z")

</div>

I am having problems with JuMP.write\_to\_file which calls MOI.write\_to\_file. I had some problems using Model with no solver attached (because this calls the MOI function mentioned above and, at the moment, it seems a litt…

---

## [Disassociate parameter or variable from a model in JuMP](https://discourse.julialang.org/t/disassociate-parameter-or-variable-from-a-model-in-jump/60851)

<div class="topic-metadata">

**Author:** [@path-doc](https://discourse.julialang.org/u/path-doc)\
**Replies:** 6\
**Last updated:** [May 11, 2021, 12:37am UTC](https://discourse.julialang.org/t/disassociate-parameter-or-variable-from-a-model-in-jump/60851 "2021-05-11T00:37:46Z")

</div>

Suppose I have associated the NLvariable y with the model mod. Then suppose I change my mind and want to disassociate the variable y from mod. Is there something like unset?

---

## [How to use NLopt with juniper and Alpine](https://discourse.julialang.org/t/how-to-use-nlopt-with-juniper-and-alpine/60857)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 9\
**Last updated:** [May 10, 2021, 11:18am UTC](https://discourse.julialang.org/t/how-to-use-nlopt-with-juniper-and-alpine/60857 "2021-05-10T11:18:01Z")

</div>

Hi, Can we use NLopt with juniper/Alpine or any other solver for solving MINLP? Thanks, Manoj

---

## [How to pass options for bonmin solver](https://discourse.julialang.org/t/how-to-pass-options-for-bonmin-solver/60790)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 6\
**Last updated:** [May 10, 2021, 7:49am UTC](https://discourse.julialang.org/t/how-to-pass-options-for-bonmin-solver/60790 "2021-05-10T07:49:33Z")

</div>

Hi, I am using bonmin solver via AmplNLWriter model2 = Model(() -\> AmplNLWriter.Optimizer("D:\\\\Julia\_solver\\\\Bonmin-1.4.0-win32-msvc9\\\\bin\\\\bonmin")) Any suggestion on how to pass time\_limit to the solver. I tried bel…

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

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