# Optimization (Mathematical)

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

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

**Page:** 99

---

## [Optimization with cost and constraints returned from a single function call](https://discourse.julialang.org/t/optimization-with-cost-and-constraints-returned-from-a-single-function-call/40433)

<div class="topic-metadata">

**Author:** [@DrPapa](https://discourse.julialang.org/u/DrPapa)\
**Replies:** 4\
**Last updated:** [May 29, 2020, 11:28pm UTC](https://discourse.julialang.org/t/optimization-with-cost-and-constraints-returned-from-a-single-function-call/40433 "2020-05-29T23:28:55Z")

</div>

I need to solve a constrained non-linear optimization problem where the cost and constraints are computed via a vector-value function. E.g., instead of J = cost(x) c1 = constraint1(x) c2 = constraint2(x) I have, for ef…

---

## [How to round down coefficients in a constraint in Julia/JuMP?](https://discourse.julialang.org/t/how-to-round-down-coefficients-in-a-constraint-in-julia-jump/29381)

<div class="topic-metadata">

**Author:** [@Shor](https://discourse.julialang.org/u/Shor)\
**Replies:** 15\
**Last updated:** [May 29, 2020, 8:50pm UTC](https://discourse.julialang.org/t/how-to-round-down-coefficients-in-a-constraint-in-julia-jump/29381 "2020-05-29T20:50:31Z")

</div>

Hi, I am new here. I don’t know how to round down coefficients in my constraints. (only coefficients in this constraint. I don’t want to round down elements in the given array) Anyone can help me? Thanks in advance!

---

## [Optimization using Optim and Roots](https://discourse.julialang.org/t/optimization-using-optim-and-roots/39301)

<div class="topic-metadata">

**Author:** [@optimist](https://discourse.julialang.org/u/optimist)\
**Replies:** 9\
**Last updated:** [May 24, 2020, 10:43pm UTC](https://discourse.julialang.org/t/optimization-using-optim-and-roots/39301 "2020-05-24T22:43:55Z")

</div>

Hello, I am a new user of Julia and the Optim package, and I am looking for some guidance on a simple piece of code. I have given my simple implementation of the equivalent of Excel XIRR (extended internal rate of retur…

---

## [Identifying the systems available linear solvers (With JuMP & Ipopt)](https://discourse.julialang.org/t/identifying-the-systems-available-linear-solvers-with-jump-ipopt/31675)

<div class="topic-metadata">

**Author:** [@Libbum](https://discourse.julialang.org/u/Libbum)\
**Replies:** 5\
**Last updated:** [May 24, 2020, 11:12am UTC](https://discourse.julialang.org/t/identifying-the-systems-available-linear-solvers-with-jump-ipopt/31675 "2020-05-24T11:12:57Z")

</div>

Hi all, I’d like to be able to verify / list available linear solvers on any given machine before running a model. My stack is JuMP and Ipopt, which means I can do something like this: import Ipopt; import JuMP; opti…

---

## [JuMP stopped working](https://discourse.julialang.org/t/jump-stopped-working/40032)

<div class="topic-metadata">

**Author:** [@JohnZ](https://discourse.julialang.org/u/JohnZ)\
**Replies:** 5\
**Last updated:** [May 23, 2020, 6:57pm UTC](https://discourse.julialang.org/t/jump-stopped-working/40032 "2020-05-23T18:57:23Z")

</div>

Hello, I reinstalled Julia (v1.4.1), and now I am no longer able to use JuMP. Please find my code and error log below. Pkg.add("JuMP") should install the recent version of JuMP but when I check the status it is actually…

---

## [Help with JuMP model formulation](https://discourse.julialang.org/t/help-with-jump-model-formulation/40002)

<div class="topic-metadata">

**Author:** [@Vondoe79](https://discourse.julialang.org/u/Vondoe79)\
**Replies:** 4\
**Last updated:** [May 23, 2020, 4:34am UTC](https://discourse.julialang.org/t/help-with-jump-model-formulation/40002 "2020-05-23T04:34:15Z")

</div>

Hello there, I kindly need help with my code. The following is a piece of my model. The entire model is quite lengthy, so I do not wish to bore you with that. The error (stated immediately below) : julia\> for (key, val…

---

## [NL Model Issue during forward diff](https://discourse.julialang.org/t/nl-model-issue-during-forward-diff/39888)

<div class="topic-metadata">

**Author:** [@Dominic\_Pazzula](https://discourse.julialang.org/u/Dominic_Pazzula)\
**Replies:** 1\
**Last updated:** [May 21, 2020, 5:49pm UTC](https://discourse.julialang.org/t/nl-model-issue-during-forward-diff/39888 "2020-05-21T17:49:35Z")

</div>

I’m still new to Julia and JuMP, so this might be an easy one. Setup: I have some complex business logic that takes in some planned changes in a DataFrame, and returns a DataFrame with projected output and error variab…

---

## [Gurobi Lazyconstraints with JuMP 0.21](https://discourse.julialang.org/t/gurobi-lazyconstraints-with-jump-0-21/39863)

<div class="topic-metadata">

**Author:** [@Wei\_Wang](https://discourse.julialang.org/u/Wei_Wang)\
**Replies:** 2\
**Last updated:** [May 21, 2020, 1:40am UTC](https://discourse.julialang.org/t/gurobi-lazyconstraints-with-jump-0-21/39863 "2020-05-21T01:40:42Z")

</div>

Hi, I am transferring some codes from old package versions (Julia 0.64, JuMP 0.18, Gurobi 8.5) to current environment. But I got some problems with one using lazyconstraints. In the old environment, the problem was sol…

---

## [CPLEX.jl: how to call CPXcallbackgetinfoint?](https://discourse.julialang.org/t/cplex-jl-how-to-call-cpxcallbackgetinfoint/39834)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 1\
**Last updated:** [May 20, 2020, 2:36pm UTC](https://discourse.julialang.org/t/cplex-jl-how-to-call-cpxcallbackgetinfoint/39834 "2020-05-20T14:36:41Z")

</div>

Dear folks, I try to call CPXcallbackgetinfoint within a callback but unfortunately fail to do so. From what I could extract from the source code of the CPLEX package, it should work something like this: function myCal…

---

## [Beginners question: how to formulate this assignment/scheduling problem?](https://discourse.julialang.org/t/beginners-question-how-to-formulate-this-assignment-scheduling-problem/39681)

<div class="topic-metadata">

**Author:** [@scheidan](https://discourse.julialang.org/u/scheidan)\
**Replies:** 5\
**Last updated:** [May 19, 2020, 1:38am UTC](https://discourse.julialang.org/t/beginners-question-how-to-formulate-this-assignment-scheduling-problem/39681 "2020-05-19T01:38:22Z")

</div>

Hi all, I’m quite new to mathematical programming. I try to solve this seemingly simple problem: I have N speakers and M \> N slots for talks. Each slot can hold a single talk. Other constrains may be added. How should…

---

## [MILP optimization using Gurobi gives error related to Attribute MathOptInterface](https://discourse.julialang.org/t/milp-optimization-using-gurobi-gives-error-related-to-attribute-mathoptinterface/39700)

<div class="topic-metadata">

**Author:** [@mamuniut09](https://discourse.julialang.org/u/mamuniut09)\
**Replies:** 1\
**Last updated:** [May 18, 2020, 3:32pm UTC](https://discourse.julialang.org/t/milp-optimization-using-gurobi-gives-error-related-to-attribute-mathoptinterface/39700 "2020-05-18T15:32:48Z")

</div>

Hello all, I was trying to optimize an MILP problem using Gurobi. However, I am getting the below error. MathOptInterface.UnsupportedAttribute{MathOptInterface.NLPBlock}: Attribute MathOptInterface.NLPBlock() is not su…

---

## [\[JuMP\] Connecting JuMP to custom Solver Simplex](https://discourse.julialang.org/t/jump-connecting-jump-to-custom-solver-simplex/39623)

<div class="topic-metadata">

**Author:** [@RaulBritto](https://discourse.julialang.org/u/RaulBritto)\
**Replies:** 7\
**Last updated:** [May 18, 2020, 11:22am UTC](https://discourse.julialang.org/t/jump-connecting-jump-to-custom-solver-simplex/39623 "2020-05-18T11:22:21Z")

</div>

Hello, I’m new in Julia Language and I’m currently coding the Simplex algorithm and I would like to use JuMP to write the optimization models to my solver. My ideia is write the models using JuMP and call my solver or Ju…

---

## [Objective function "limit reached" status in JuMP](https://discourse.julialang.org/t/objective-function-limit-reached-status-in-jump/39349)

<div class="topic-metadata">

**Author:** [@ivborissov](https://discourse.julialang.org/u/ivborissov)\
**Replies:** 5\
**Last updated:** [May 13, 2020, 2:46pm UTC](https://discourse.julialang.org/t/objective-function-limit-reached-status-in-jump/39349 "2020-05-13T14:46:43Z")

</div>

Hi, Can JuMP report that an objective function has reached some predefined limit? My problem looks the following. I am looking for a Min or Max value of a variable x\[1\] within the bounds (lets say \[1e-9,1e9\]) w.r.t som…

---

## [Linprog and Clp under JuMP or MathOptInterface - Why is it so hard?](https://discourse.julialang.org/t/linprog-and-clp-under-jump-or-mathoptinterface-why-is-it-so-hard/39323)

<div class="topic-metadata">

**Author:** [@scotts](https://discourse.julialang.org/u/scotts)\
**Replies:** 2\
**Last updated:** [May 12, 2020, 8:33am UTC](https://discourse.julialang.org/t/linprog-and-clp-under-jump-or-mathoptinterface-why-is-it-so-hard/39323 "2020-05-12T08:33:19Z")

</div>

Julia is working beautifully on an LP problem on my mac. My optimisation problem is structured with inequality constraints and the sense vector: sol = linprog(-f,A,sense,b,lb,ub,ClpSolver()) For some reason running t…

---

## [How to choose a nonlinear optimizer (ecosystem)?](https://discourse.julialang.org/t/how-to-choose-a-nonlinear-optimizer-ecosystem/39231)

<div class="topic-metadata">

**Author:** [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Replies:** 7\
**Last updated:** [May 11, 2020, 6:50pm UTC](https://discourse.julialang.org/t/how-to-choose-a-nonlinear-optimizer-ecosystem/39231 "2020-05-11T18:50:09Z")

</div>

At work, we currently use JuMP + Gurobi to solve fairly large LPs in production. These LPs are linear approximations of much smaller nonlinear problems. For several reasons including “Gurobi is expensive” and “this appro…

---

## [Preconditioner for L-BFGS in Optim.jl](https://discourse.julialang.org/t/preconditioner-for-l-bfgs-in-optim-jl/39167)

<div class="topic-metadata">

**Author:** [@cpross90](https://discourse.julialang.org/u/cpross90)\
**Replies:** 17\
**Last updated:** [May 11, 2020, 6:45pm UTC](https://discourse.julialang.org/t/preconditioner-for-l-bfgs-in-optim-jl/39167 "2020-05-11T18:45:54Z")

</div>

I’m stumped, and I’m not sure if my problem is a lack of understanding of the L-BFGS implementation or the Optim.jl interface. I’m trying to figure out how to create a preconditioner such that it is equivalent to the ap…

---

## [Conditional NLconstraint, Couenne](https://discourse.julialang.org/t/conditional-nlconstraint-couenne/26801)

<div class="topic-metadata">

**Author:** [@Raminel](https://discourse.julialang.org/u/Raminel)\
**Replies:** 4\
**Last updated:** [May 11, 2020, 4:50pm UTC](https://discourse.julialang.org/t/conditional-nlconstraint-couenne/26801 "2020-05-11T16:50:26Z")

</div>

Hi all, I am trying to solve a MINLP problem with Couenne. I have difficulty implementing an NLconstraint of this form: if x\[i,j\] == 0, y\[i,j\] == 0 else y\[i,j\] = 1/x\[i,j\], I have checked the Syntax notes and I still can…

---

## [Constraints in a loop in the PowerModels](https://discourse.julialang.org/t/constraints-in-a-loop-in-the-powermodels/38573)

<div class="topic-metadata">

**Author:** [@Rasoul](https://discourse.julialang.org/u/Rasoul)\
**Replies:** 7\
**Last updated:** [May 9, 2020, 12:16am UTC](https://discourse.julialang.org/t/constraints-in-a-loop-in-the-powermodels/38573 "2020-05-09T00:16:33Z")

</div>

I want to enforce linear envelopes on the cosine function in PowerModelsAnnex. I implement the following code for doing that. for (bp, buspair) in ref\[:buspairs\] for k=1:length(linear\_envelopes1) @constraint(model, cs…

---

## [JuMP dual model formulation and impact on performance](https://discourse.julialang.org/t/jump-dual-model-formulation-and-impact-on-performance/39124)

<div class="topic-metadata">

**Author:** [@martincornejo](https://discourse.julialang.org/u/martincornejo)\
**Replies:** 1\
**Last updated:** [May 8, 2020, 7:38pm UTC](https://discourse.julialang.org/t/jump-dual-model-formulation-and-impact-on-performance/39124 "2020-05-08T19:38:33Z")

</div>

For context: I have a SDP problem that is formulated in the dual form (I don’t think its possible to formulate it in the primal form), for the solver to be able to optimize it I use Dualization.jl and apply it to the s…

---

## [Solver Cplex](https://discourse.julialang.org/t/solver-cplex/38915)

<div class="topic-metadata">

**Author:** [@lausilvag](https://discourse.julialang.org/u/lausilvag)\
**Replies:** 2\
**Last updated:** [May 7, 2020, 4:12pm UTC](https://discourse.julialang.org/t/solver-cplex/38915 "2020-05-07T16:12:29Z")

</div>

Hi!! Our binary programming problem has an objective function B. \* x, where B is an mxn matrix and x is an mxn variable matrix. Some of the B values will not exist in the problem to be solved. Question: How can I assi…

---

## [Deleting variables in quadratic constraints in JuMP](https://discourse.julialang.org/t/deleting-variables-in-quadratic-constraints-in-jump/38929)

<div class="topic-metadata">

**Author:** [@pulsipher](https://discourse.julialang.org/u/pulsipher)\
**Replies:** 1\
**Last updated:** [May 7, 2020, 10:43am UTC](https://discourse.julialang.org/t/deleting-variables-in-quadratic-constraints-in-jump/38929 "2020-05-07T10:43:36Z")

</div>

It appears that when a variable is deleted in JuMP and it is part of a quadratic term, the entire term is dropped: julia\> using JuMP; m = Model(); @variable(m, x\[1:2\]); julia\> @constraint(m, c, 2 \* x\[1\] \* x\[2\] == 0) c …

---

## [UndefRefError: access to undefined reference, when I use NLsolve.jl](https://discourse.julialang.org/t/undefreferror-access-to-undefined-reference-when-i-use-nlsolve-jl/38795)

<div class="topic-metadata">

**Author:** [@PearsonCHEN](https://discourse.julialang.org/u/PearsonCHEN)\
**Replies:** 10\
**Last updated:** [May 7, 2020, 6:05am UTC](https://discourse.julialang.org/t/undefreferror-access-to-undefined-reference-when-i-use-nlsolve-jl/38795 "2020-05-07T06:05:27Z")

</div>

I am new to Julia and the Julia community. I’d appreciate it if someone can help me with this error. I have also opened an issue in the package NLsolve.jl. I tried to use variables and parameters with type Float64 and a…

---

## [Cbc and Clp performance](https://discourse.julialang.org/t/cbc-and-clp-performance/38505)

<div class="topic-metadata">

**Author:** [@Diego](https://discourse.julialang.org/u/Diego)\
**Replies:** 16\
**Last updated:** [May 6, 2020, 9:39pm UTC](https://discourse.julialang.org/t/cbc-and-clp-performance/38505 "2020-05-06T21:39:22Z")

</div>

Hello everyone, I have been testing the solvers of COIN-OR, namely Cbc (MILP solver) and Clp (LP solver). I obtain for Cbc a very good performance, Cbc even outperforms some commertial solvers in numerically complex pr…

---

## [Minimize function of matrix subject to matrix equality](https://discourse.julialang.org/t/minimize-function-of-matrix-subject-to-matrix-equality/38701)

<div class="topic-metadata">

**Author:** [@uncertainly](https://discourse.julialang.org/u/uncertainly)\
**Replies:** 5\
**Last updated:** [May 5, 2020, 3:06am UTC](https://discourse.julialang.org/t/minimize-function-of-matrix-subject-to-matrix-equality/38701 "2020-05-05T03:06:02Z")

</div>

newbie here, both to julia, JuMP, only intermediate at optimization. I would like to solve a problem min(A) subject to C = B\*A where A,B,C are all matrices. Is it possible to express this in JuMP? Any h…

---

## [JuMP Optimization Help](https://discourse.julialang.org/t/jump-optimization-help/38740)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 5\
**Last updated:** [May 4, 2020, 11:44pm UTC](https://discourse.julialang.org/t/jump-optimization-help/38740 "2020-05-04T23:44:44Z")

</div>

I’m brand new to JuMP.jl and optimization and I’m running into a bit of a roadblock figuring out how to solve what I thought would be a fairly straightforward problem. Imagine 6 jars of marbles, divided into two groups. …

---

## [How to set Cbc Parameters](https://discourse.julialang.org/t/how-to-set-cbc-parameters/38516)

<div class="topic-metadata">

**Author:** [@lausilvag](https://discourse.julialang.org/u/lausilvag)\
**Replies:** 3\
**Last updated:** [May 4, 2020, 10:28pm UTC](https://discourse.julialang.org/t/how-to-set-cbc-parameters/38516 "2020-05-04T22:28:58Z")

</div>

Hi I am trying to set parameters for Cbc Solver Z\_OP = Model(with\_optimizer(Cbc.Optimizer)) set\_parameter(Z\_OP, "preProcess", off) set\_parameter(Z\_OP, "CliqueCuts", Root) error: UndefVarError: Off not defined …

---

## [Dynamic programming](https://discourse.julialang.org/t/dynamic-programming/38512)

<div class="topic-metadata">

**Author:** [@lausilvag](https://discourse.julialang.org/u/lausilvag)\
**Replies:** 4\
**Last updated:** [May 4, 2020, 10:28pm UTC](https://discourse.julialang.org/t/dynamic-programming/38512 "2020-05-04T22:28:12Z")

</div>

Hi I am new to Julia and I would like to know if there is any MIP optimization solver that performs dynamic search. I have an optimization problem that exceeds 1000 variables allowed by student/research CPLEX license. …

---

## [How do I extract the coefficients and RHS's of all constraints in a JuMP linear program? (Need for KKT)](https://discourse.julialang.org/t/how-do-i-extract-the-coefficients-and-rhss-of-all-constraints-in-a-jump-linear-program-need-for-kkt/38525)

<div class="topic-metadata">

**Author:** [@nlaws](https://discourse.julialang.org/u/nlaws)\
**Replies:** 14\
**Last updated:** [May 4, 2020, 3:28am UTC](https://discourse.julialang.org/t/how-do-i-extract-the-coefficients-and-rhss-of-all-constraints-in-a-jump-linear-program-need-for-kkt/38525 "2020-05-04T03:28:04Z")

</div>

I am building a bilevel problem and I need to construct the KKT conditions of a linear program written in JuMP. I am wondering if it is possible to extract all the coefficients and right-hand-sides (RHS) of the constrai…

---

## [How to map JuMP VariableRef to NLPModelMeta indices?](https://discourse.julialang.org/t/how-to-map-jump-variableref-to-nlpmodelmeta-indices/38681)

<div class="topic-metadata">

**Author:** [@nlaws](https://discourse.julialang.org/u/nlaws)\
**Replies:** 2\
**Last updated:** [May 4, 2020, 2:52am UTC](https://discourse.julialang.org/t/how-to-map-jump-variableref-to-nlpmodelmeta-indices/38681 "2020-05-04T02:52:07Z")

</div>

I am developing a large scale bilevel problem (1M+ variables), and as a first step I am extracting the constraint coefficient matrix of the lower level linear program using NLPModelMeta (see this post). Here is a simple …

---

## [Optimize 0-1 loss in MIP](https://discourse.julialang.org/t/optimize-0-1-loss-in-mip/33027)

<div class="topic-metadata">

**Author:** [@Maximilian](https://discourse.julialang.org/u/Maximilian)\
**Replies:** 5\
**Last updated:** [May 2, 2020, 7:18pm UTC](https://discourse.julialang.org/t/optimize-0-1-loss-in-mip/33027 "2020-05-02T19:18:18Z")

</div>

I am currently trying to solve the following optimization problem Where N is the number of observations on \\mathbf{x} predictors, and y \\in \\{-1, 1\\} is a binary vector of length N, \\lambda has to be integer, C\_0, C\_…

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

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