# Optimization (Mathematical)

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

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

**Page:** 86

---

## [JuMP 0.21.6 released](https://discourse.julialang.org/t/jump-0-21-6-released/54161)

<div class="topic-metadata">

**Author:** [@odow](https://discourse.julialang.org/u/odow)\
**Replies:** 0\
**Last updated:** [January 29, 2021, 5:10am UTC](https://discourse.julialang.org/t/jump-0-21-6-released/54161 "2021-01-29T05:10:20Z")

</div>

Dear all, We are pleased to announce the release of JuMP 0.21.6. You can find more information about the release on our blog: JuMP 0.21.6 is released | JuMP. The major change for most users is that we have over-hauled …

---

## [Gurobi how to get variable coefficients in constraints](https://discourse.julialang.org/t/gurobi-how-to-get-variable-coefficients-in-constraints/54150)

<div class="topic-metadata">

**Author:** [@rezabayani](https://discourse.julialang.org/u/rezabayani)\
**Replies:** 5\
**Last updated:** [January 29, 2021, 3:51am UTC](https://discourse.julialang.org/t/gurobi-how-to-get-variable-coefficients-in-constraints/54150 "2021-01-29T03:51:56Z")

</div>

I am trying to extract the variable coefficients in a constraint. According to Gurobi documentation, https://www.gurobi.com/documentation/9.1/refman/py\_model\_getcoeff.html, the function Model.getCoeff() should do the tri…

---

## [Three state variable](https://discourse.julialang.org/t/three-state-variable/53632)

<div class="topic-metadata">

**Author:** [@user1200](https://discourse.julialang.org/u/user1200)\
**Replies:** 10\
**Last updated:** [January 28, 2021, 9:56pm UTC](https://discourse.julialang.org/t/three-state-variable/53632 "2021-01-28T21:56:07Z")

</div>

Edit1: Sorry i found lens next to avatar ^^ Hello Please can I ask newbie q, i need to make signum variable from another variable. (tried things like type Int in variable type / sign function in constrains but get err…

---

## [Question regarding COSMO Convergence](https://discourse.julialang.org/t/question-regarding-cosmo-convergence/53996)

<div class="topic-metadata">

**Author:** [@Y\_Li](https://discourse.julialang.org/u/Y_Li)\
**Replies:** 1\
**Last updated:** [January 28, 2021, 1:16am UTC](https://discourse.julialang.org/t/question-regarding-cosmo-convergence/53996 "2021-01-28T01:16:31Z")

</div>

Hi, I have a question regarding COSMO package, this is my first time using it, what steps can I take when my code does not converge(but in reality it should)? It delivers message “Max\_iter\_reached” and stops at a value …

---

## [How to define JuMP expressions using a loop](https://discourse.julialang.org/t/how-to-define-jump-expressions-using-a-loop/54079)

<div class="topic-metadata">

**Author:** [@Micah\_Mungal](https://discourse.julialang.org/u/Micah_Mungal)\
**Replies:** 1\
**Last updated:** [January 27, 2021, 10:03pm UTC](https://discourse.julialang.org/t/how-to-define-jump-expressions-using-a-loop/54079 "2021-01-27T22:03:48Z")

</div>

Hi, I am trying to incorporate an expression into Julia using JuMP. Now I have been able to do this using MATLAB, but decided to switch to Julia for specific purposes. However based on the documentation provided for usin…

---

## [Positve semidefinite constraint on SDP program in JuMP](https://discourse.julialang.org/t/positve-semidefinite-constraint-on-sdp-program-in-jump/53972)

<div class="topic-metadata">

**Author:** [@cheng\_chen](https://discourse.julialang.org/u/cheng_chen)\
**Replies:** 11\
**Last updated:** [January 27, 2021, 2:51pm UTC](https://discourse.julialang.org/t/positve-semidefinite-constraint-on-sdp-program-in-jump/53972 "2021-01-27T14:51:56Z")

</div>

I have to solve an SDP program. For example: min tr(Σ \* A ) s.t. Σ\[1:2,1:2\] \>= AΣA’ Σ \>= 0 Here is what I have: n = 4 d = 2 A = rand(d,n) B = rand(n,n) model = Model(ProxSDP.Optimizer) @variable(model, Σ\[1:n, 1:n\], …

---

## [Invertible Constraint in JuMP](https://discourse.julialang.org/t/invertible-constraint-in-jump/54031)

<div class="topic-metadata">

**Author:** [@cheng\_chen](https://discourse.julialang.org/u/cheng_chen)\
**Replies:** 1\
**Last updated:** [January 27, 2021, 8:03am UTC](https://discourse.julialang.org/t/invertible-constraint-in-jump/54031 "2021-01-27T08:03:31Z")

</div>

How can I add a constraint in JuMP model with ProxSDP optimizer such that the solution is invertible?

---

## [Optim callback function -- how to use optimization variable](https://discourse.julialang.org/t/optim-callback-function-how-to-use-optimization-variable/8807)

<div class="topic-metadata">

**Author:** [@egcjm](https://discourse.julialang.org/u/egcjm)\
**Replies:** 1\
**Last updated:** [January 26, 2021, 4:45pm UTC](https://discourse.julialang.org/t/optim-callback-function-how-to-use-optimization-variable/8807 "2021-01-26T16:45:50Z")

</div>

The optim callback function seems to operate on the OptimizationState, which provides access to the iteration count (.iteration) and value. Can I access the optimization variable being optimized (i.e. temporary optim.mi…

---

## [Optim.jl callback](https://discourse.julialang.org/t/optim-jl-callback/52625)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 1\
**Last updated:** [January 26, 2021, 4:44pm UTC](https://discourse.julialang.org/t/optim-jl-callback/52625 "2021-01-26T16:44:16Z")

</div>

How to work properly with OptimizationState? In docs I found only os.iteration. Some like os.metadata\["x"\] not working with error: type Array has no field metadata Is callback documented anywhere? Thx!

---

## [ERROR: syntax: function argument names not unique around](https://discourse.julialang.org/t/error-syntax-function-argument-names-not-unique-around/53944)

<div class="topic-metadata">

**Author:** [@GraceMabele](https://discourse.julialang.org/u/GraceMabele)\
**Replies:** 5\
**Last updated:** [January 26, 2021, 9:46am UTC](https://discourse.julialang.org/t/error-syntax-function-argument-names-not-unique-around/53944 "2021-01-26T09:46:29Z")

</div>

I am currently building a milp model previously done in GAMS and I’m converting it into JuMP (Julia). I am particularly having trouble with constraints and the objective function that has more than one summation with co…

---

## [EXIT: Restoration Failed! with JuMP (0.21.4) and Ipopt (0.6.5)](https://discourse.julialang.org/t/exit-restoration-failed-with-jump-0-21-4-and-ipopt-0-6-5/53853)

<div class="topic-metadata">

**Author:** [@indycdrom](https://discourse.julialang.org/u/indycdrom)\
**Replies:** 6\
**Last updated:** [January 25, 2021, 10:42pm UTC](https://discourse.julialang.org/t/exit-restoration-failed-with-jump-0-21-4-and-ipopt-0-6-5/53853 "2021-01-25T22:42:27Z")

</div>

I am really puzzled and also frustrated that no matter how simple the problem was, like one below, Ipopt returns EXIT: Restoration Failed! using JuMP using Ipopt model = Model(Ipopt.Optimizer) @variable(model, x, st…

---

## [Nonlinear systems: NLsolve alternative (non-convergence issue)](https://discourse.julialang.org/t/nonlinear-systems-nlsolve-alternative-non-convergence-issue/53925)

<div class="topic-metadata">

**Author:** [@vjimenezg](https://discourse.julialang.org/u/vjimenezg)\
**Replies:** 3\
**Last updated:** [January 25, 2021, 9:39pm UTC](https://discourse.julialang.org/t/nonlinear-systems-nlsolve-alternative-non-convergence-issue/53925 "2021-01-25T21:39:39Z")

</div>

Hello Julia community I’m having trouble with the convergence of NLsolve when solving a large system of linear equations (the transition between steady states in a heterogeneous-agent model in economics). Even in its si…

---

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

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 5\
**Last updated:** [January 25, 2021, 4:12pm UTC](https://discourse.julialang.org/t/help-with-jump/53724 "2021-01-25T16:12:40Z")

</div>

Hello I’m trying to make the “for” compile all the variables in the model, but whenever I compile it just returns the variable “c” Can anybody help me ? Thank you!! using JuMP, MathOptInterface, GLPK, GLPKMathProgInt…

---

## [Infeasible LP and Farkas Certificate](https://discourse.julialang.org/t/infeasible-lp-and-farkas-certificate/53852)

<div class="topic-metadata">

**Author:** [@Mahbubar06](https://discourse.julialang.org/u/Mahbubar06)\
**Replies:** 2\
**Last updated:** [January 24, 2021, 9:23am UTC](https://discourse.julialang.org/t/infeasible-lp-and-farkas-certificate/53852 "2021-01-24T09:23:29Z")

</div>

Is there any JuMP (or other) method to retrieve Farkas certificate from an infeasible lp model? I am using Clp, Gurobi, or Ipopt solver for solving the lp problem modeled using JuMP. Thank you.

---

## [How to set a systems of ODEs to zero with Boundary Value Problem?](https://discourse.julialang.org/t/how-to-set-a-systems-of-odes-to-zero-with-boundary-value-problem/53771)

<div class="topic-metadata">

**Author:** [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Replies:** 1\
**Last updated:** [January 24, 2021, 6:58am UTC](https://discourse.julialang.org/t/how-to-set-a-systems-of-odes-to-zero-with-boundary-value-problem/53771 "2021-01-24T06:58:06Z")

</div>

I have a system of ordinary differential equations (ODEs) that model the interaction between a bacterium and phage: dN/dt = μN(1-(N+I)/κ) -φNP -ωN dI/dt = φNP -ηI -ωI dP/dt = βηI -φNP -ωP I am looking for the values of…

---

## [Optimizing a quadratic binary function on CPLEX/JuMP](https://discourse.julialang.org/t/optimizing-a-quadratic-binary-function-on-cplex-jump/53800)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 11\
**Last updated:** [January 23, 2021, 10:22pm UTC](https://discourse.julialang.org/t/optimizing-a-quadratic-binary-function-on-cplex-jump/53800 "2021-01-23T22:22:07Z")

</div>

I am using CPLEX 12.8 in JuMP to minimize a quadratic binary nonconvex function, according to quadratic function by CPLEX. In particular, my function is the following: \\sum\_{i=1}^{m-1} \\sum\_{f=1}^{F} \\sum\_{\\underset{\\…

---

## [Minimize Multiple norms using JuMP](https://discourse.julialang.org/t/minimize-multiple-norms-using-jump/53763)

<div class="topic-metadata">

**Author:** [@cheng\_chen](https://discourse.julialang.org/u/cheng_chen)\
**Replies:** 1\
**Last updated:** [January 22, 2021, 9:14pm UTC](https://discourse.julialang.org/t/minimize-multiple-norms-using-jump/53763 "2021-01-22T21:14:08Z")

</div>

Hi, I need to minimize an objective function that has multiple norms in it. Here is a minimal example: A is a variable of dimension d by n. x is a known constant matrix of dimension n by 1 and b\_t (dimension d by 1) …

---

## [Problems to build CPLEX](https://discourse.julialang.org/t/problems-to-build-cplex/53671)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 14\
**Last updated:** [January 22, 2021, 8:43pm UTC](https://discourse.julialang.org/t/problems-to-build-cplex/53671 "2021-01-22T20:43:04Z")

</div>

Dear all, I am having a problem to build the CPLEX v 20.10 on my computer. The error message appears: Pkg.build("CPLEX") Building CPLEX → \`C:\\Users\\Usuário\\.julia\\packages\\CPLEX\\DgohF\\deps\\build.log\` ┌ Error: Error …

---

## [Least Squares Minimization of operator norm](https://discourse.julialang.org/t/least-squares-minimization-of-operator-norm/53723)

<div class="topic-metadata">

**Author:** [@cheng\_chen](https://discourse.julialang.org/u/cheng_chen)\
**Replies:** 3\
**Last updated:** [January 21, 2021, 3:24pm UTC](https://discourse.julialang.org/t/least-squares-minimization-of-operator-norm/53723 "2021-01-21T15:24:56Z")

</div>

Here is a minimal example of my problem: I want to find a minimizer x that minimizes the objective function : opnorm(A\*x-b,2)^2 I tried Convex.jl, but it doesn’t work for the operator norm.

---

## [Access JuMP canonical matricial LP problem](https://discourse.julialang.org/t/access-jump-canonical-matricial-lp-problem/53688)

<div class="topic-metadata">

**Author:** [@josePereiro](https://discourse.julialang.org/u/josePereiro)\
**Replies:** 2\
**Last updated:** [January 21, 2021, 2:28am UTC](https://discourse.julialang.org/t/access-jump-canonical-matricial-lp-problem/53688 "2021-01-21T02:28:05Z")

</div>

Hi, just wondering if there is a way to ‘extract’ the canonical matricial(\*) LP form from a JuMP model. (\*) With canonical form I meant something like: \\text{maximize } c^Tv \\text{, subject to:} \\\\ Sv = b \\\\ lb \\le v …

---

## [Error: Unsatisfiable requirements detected for package MathOptInterface](https://discourse.julialang.org/t/error-unsatisfiable-requirements-detected-for-package-mathoptinterface/46469)

<div class="topic-metadata">

**Author:** [@Raj95](https://discourse.julialang.org/u/Raj95)\
**Replies:** 11\
**Last updated:** [January 20, 2021, 7:18pm UTC](https://discourse.julialang.org/t/error-unsatisfiable-requirements-detected-for-package-mathoptinterface/46469 "2021-01-20T19:18:49Z")

</div>

Hello…I’m getting the following error while trying to add MathOptInterface: Pkg.add("MathOptInterface") ERROR: Unsatisfiable requirements detected for package MathOptInterface \[b8f27783\]: MathOptInterface \[b8f27783\] l…

---

## ["InexactError" when calling Optim](https://discourse.julialang.org/t/inexacterror-when-calling-optim/53568)

<div class="topic-metadata">

**Author:** [@Michael\_Barmann](https://discourse.julialang.org/u/Michael_Barmann)\
**Replies:** 3\
**Last updated:** [January 19, 2021, 10:22pm UTC](https://discourse.julialang.org/t/inexacterror-when-calling-optim/53568 "2021-01-19T22:22:33Z")

</div>

I’m writing a program to perform parameter estimation on a system of ODEs, and I keep getting this weird “InexactError” that I’ve spent hours unsuccessfully trying to figure out. Here is my call to the optimizer which i…

---

## [Warm-starting (set\_start\_value function) does not work in JuMP](https://discourse.julialang.org/t/warm-starting-set-start-value-function-does-not-work-in-jump/53620)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 2\
**Last updated:** [January 19, 2021, 5:59pm UTC](https://discourse.julialang.org/t/warm-starting-set-start-value-function-does-not-work-in-jump/53620 "2021-01-19T17:59:27Z")

</div>

Dear All, I am trying to solve the following SDP with warm starting. The code is as follows using JuMP, COSMO # data m = 5 n = 10 using Random: bitrand c = randn(n) x0 = bitrand(n) A = randn(m, n) b = A \* x0 x\_pr…

---

## [Automatic inverse of a function?](https://discourse.julialang.org/t/automatic-inverse-of-a-function/53342)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 17\
**Last updated:** [January 19, 2021, 5:28pm UTC](https://discourse.julialang.org/t/automatic-inverse-of-a-function/53342 "2021-01-19T17:28:51Z")

</div>

Hey, I do have a function that makes a heavy computation in Julia, from \\mathbb R^n to \\mathbb R^m. It uses loops, multiplications, additions, divisions, substractions, powers and exp/log. I am looking to inverse the f…

---

## [Problem with constrains for consequtive cases](https://discourse.julialang.org/t/problem-with-constrains-for-consequtive-cases/53599)

<div class="topic-metadata">

**Author:** [@gustav.asbjorn](https://discourse.julialang.org/u/gustav.asbjorn)\
**Replies:** 1\
**Last updated:** [January 19, 2021, 1:15pm UTC](https://discourse.julialang.org/t/problem-with-constrains-for-consequtive-cases/53599 "2021-01-19T13:15:04Z")

</div>

Hello there. I have problems creating some constrains that will satisfy the following case: We have 10 wokers that will work some days of a 14 day period in different timeintervals of the day: daytime, evening and night…

---

## [Problems with constraint. Alternative for JuMP variable in if statement](https://discourse.julialang.org/t/problems-with-constraint-alternative-for-jump-variable-in-if-statement/53563)

<div class="topic-metadata">

**Author:** [@gustav.asbjorn](https://discourse.julialang.org/u/gustav.asbjorn)\
**Replies:** 7\
**Last updated:** [January 19, 2021, 11:00am UTC](https://discourse.julialang.org/t/problems-with-constraint-alternative-for-jump-variable-in-if-statement/53563 "2021-01-19T11:00:28Z")

</div>

Hey. So I need to implement the following: Let’s say that we have 10 workers. If they work in the weekend then they want to work both days of the weekend or none. If they work only one day of the weekend then we add a p…

---

## [Error using getvalue](https://discourse.julialang.org/t/error-using-getvalue/53546)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 4\
**Last updated:** [January 18, 2021, 8:35pm UTC](https://discourse.julialang.org/t/error-using-getvalue/53546 "2021-01-18T20:35:09Z")

</div>

Hello!! Whenever I try to use getvalue the following error appears to me: MethodError: no method matches getvalue (:: ConstraintRef {Model, JuMP.GenericRangeConstraint {JuMP.GenericAffExpr {Float64, Variable}}}) Could…

---

## [How to delete a nonlinear constraint from a JuMP optimization problem](https://discourse.julialang.org/t/how-to-delete-a-nonlinear-constraint-from-a-jump-optimization-problem/53469)

<div class="topic-metadata">

**Author:** [@boranzhao](https://discourse.julialang.org/u/boranzhao)\
**Replies:** 2\
**Last updated:** [January 18, 2021, 4:22am UTC](https://discourse.julialang.org/t/how-to-delete-a-nonlinear-constraint-from-a-jump-optimization-problem/53469 "2021-01-18T04:22:49Z")

</div>

Hello, I know that delete can be used to delete constraints and variables from a JuMP problem. However, based on my testing, it does not work for nonlinear constraint added through @NLconstraint. I was wondering whether…

---

## [User cuts and Lazy Constraints JuMP Gurobi](https://discourse.julialang.org/t/user-cuts-and-lazy-constraints-jump-gurobi/53328)

<div class="topic-metadata">

**Author:** [@baprata](https://discourse.julialang.org/u/baprata)\
**Replies:** 4\
**Last updated:** [January 16, 2021, 8:43am UTC](https://discourse.julialang.org/t/user-cuts-and-lazy-constraints-jump-gurobi/53328 "2021-01-16T08:43:10Z")

</div>

I am trying to insert user cuts and lazy constraints in a mixed-integer linear programming model. I am putting the functions in separate files from the main model. An illustrative example: function valid\_inequality(cb\_d…

---

## [Optim.jl wrongly reporting success](https://discourse.julialang.org/t/optim-jl-wrongly-reporting-success/53174)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 4\
**Last updated:** [January 13, 2021, 6:44pm UTC](https://discourse.julialang.org/t/optim-jl-wrongly-reporting-success/53174 "2021-01-13T18:44:17Z")

</div>

I’m solving for the MLE. using Distributions, Random, Optim; DGP\_True = LogNormal(17,7); Random.seed!(123); const d\_train = rand(DGP\_True, 1\_000) const d\_test = rand(DGP\_True, 1\_000) # LogNormal function loglike(θ) …

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

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