# Optimization (Mathematical)

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

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

**Page:** 64

---

## [Two stage stochastic](https://discourse.julialang.org/t/two-stage-stochastic/78767)

<div class="topic-metadata">

**Author:** [@HosseinF](https://discourse.julialang.org/u/HosseinF)\
**Replies:** 8\
**Last updated:** [May 6, 2022, 1:59pm UTC](https://discourse.julialang.org/t/two-stage-stochastic/78767 "2022-05-06T13:59:42Z")

</div>

Hello every one. I am new to Julia. I want to extract the second stage decisional variables but it does not work. Does every one know that what is the problem?

---

## [TORA: Invalid number in NLP function or derivative detected](https://discourse.julialang.org/t/tora-invalid-number-in-nlp-function-or-derivative-detected/80511)

<div class="topic-metadata">

**Author:** [@hedonismbot](https://discourse.julialang.org/u/hedonismbot)\
**Replies:** 6\
**Last updated:** [May 6, 2022, 1:45pm UTC](https://discourse.julialang.org/t/tora-invalid-number-in-nlp-function-or-derivative-detected/80511 "2022-05-06T13:45:14Z")

</div>

On a custom URDF file (fanuc.urdf · GitHub), the tutorial for tora.jl (Tutorial · TORA.jl) always fails with this error: EXIT: Invalid number in NLP function or derivative detected. (6.328051371, \[0.0, 0.0, 0.0, 0.0, …

---

## [A problem about JUMP function fix](https://discourse.julialang.org/t/a-problem-about-jump-function-fix/80596)

<div class="topic-metadata">

**Author:** [@mahon](https://discourse.julialang.org/u/mahon)\
**Replies:** 2\
**Last updated:** [May 6, 2022, 10:08am UTC](https://discourse.julialang.org/t/a-problem-about-jump-function-fix/80596 "2022-05-06T10:08:13Z")

</div>

Hello , i am trying to use function fix to fix a matrix variable for example @variable(model, P\_dch\[1:2,1:2\]); fix(P\_dch, \[0 0;0 0\]); but it doesn\`t work, how can i do ? thanks

---

## [Indicator constraints with quadratic terms may have bugs?](https://discourse.julialang.org/t/indicator-constraints-with-quadratic-terms-may-have-bugs/80516)

<div class="topic-metadata">

**Author:** [@iiitr](https://discourse.julialang.org/u/iiitr)\
**Replies:** 4\
**Last updated:** [May 6, 2022, 1:53am UTC](https://discourse.julialang.org/t/indicator-constraints-with-quadratic-terms-may-have-bugs/80516 "2022-05-06T01:53:47Z")

</div>

When I use the indicator constraint, I find that it sometimes causes the model to be infeasible, but I can solve the model when I set a feasible solution as a constraint. I know that the indicator can only contain linea…

---

## [DC load flow constraint](https://discourse.julialang.org/t/dc-load-flow-constraint/80564)

<div class="topic-metadata">

**Author:** [@mbah](https://discourse.julialang.org/u/mbah)\
**Replies:** 2\
**Last updated:** [May 5, 2022, 10:19pm UTC](https://discourse.julialang.org/t/dc-load-flow-constraint/80564 "2022-05-05T22:19:50Z")

</div>

Hello, I am trying to fit in a DC load flow equation into my zonal dispatch model without much success. #using DataFrames, JuMp generators = DataFrame(index = \["conventional\_gas", "conventional\_nuc", "West\_A\_Wind", "…

---

## [Renewable generation constraint](https://discourse.julialang.org/t/renewable-generation-constraint/80526)

<div class="topic-metadata">

**Author:** [@mbah](https://discourse.julialang.org/u/mbah)\
**Replies:** 4\
**Last updated:** [May 5, 2022, 11:20am UTC](https://discourse.julialang.org/t/renewable-generation-constraint/80526 "2022-05-05T11:20:20Z")

</div>

Hello all, I have posted an earlier question on coding renewable generation constraints with availability factors. I am still stuck with the problem. I have reverted back to bare basics, but i still receive keyErrors. A…

---

## [Installation of some packages fail](https://discourse.julialang.org/t/installation-of-some-packages-fail/80413)

<div class="topic-metadata">

**Author:** [@jasperbos](https://discourse.julialang.org/u/jasperbos)\
**Replies:** 4\
**Last updated:** [May 3, 2022, 7:40pm UTC](https://discourse.julialang.org/t/installation-of-some-packages-fail/80413 "2022-05-03T19:40:43Z")

</div>

Hi all, I just fired up Julia for the first time. My goal is to use the JEMSS package for research purposes. However, as I try to install it with pkg\> add https://github.com/uoa-ems-research/JEMSS.jl Cgl\_jll, Cbc\_jll, …

---

## [JuMP solution\_summary() not working](https://discourse.julialang.org/t/jump-solution-summary-not-working/80412)

<div class="topic-metadata">

**Author:** [@naouess](https://discourse.julialang.org/u/naouess)\
**Replies:** 1\
**Last updated:** [May 3, 2022, 9:39am UTC](https://discourse.julialang.org/t/jump-solution-summary-not-working/80412 "2022-05-03T09:39:10Z")

</div>

Hello, I have a simple jump model and it’s running. When I try to check the solution using solution\_summary, it gives me an error: UndefVarError: solution\_summary not defined Any idea why this is bugging? I’m using J…

---

## [NLsolve.jl for different input and output dimensions?](https://discourse.julialang.org/t/nlsolve-jl-for-different-input-and-output-dimensions/80202)

<div class="topic-metadata">

**Author:** [@Alseidon](https://discourse.julialang.org/u/Alseidon)\
**Replies:** 13\
**Last updated:** [May 2, 2022, 3:13pm UTC](https://discourse.julialang.org/t/nlsolve-jl-for-different-input-and-output-dimensions/80202 "2022-05-02T15:13:29Z")

</div>

Hi all, I am currently trying out NLsolve.jl to find roots of given functions, which works great at the moment, but I realized that I can’t seem to find a way to specify a dimension for the output different from the inp…

---

## [Defining constraint using JuMP convert String to Expression and Merge Quart Expr and nonlinear Expr](https://discourse.julialang.org/t/defining-constraint-using-jump-convert-string-to-expression-and-merge-quart-expr-and-nonlinear-expr/79967)

<div class="topic-metadata">

**Author:** [@Deena\_20](https://discourse.julialang.org/u/Deena_20)\
**Replies:** 12\
**Last updated:** [May 2, 2022, 4:43am UTC](https://discourse.julialang.org/t/defining-constraint-using-jump-convert-string-to-expression-and-merge-quart-expr-and-nonlinear-expr/79967 "2022-05-02T04:43:40Z")

</div>

using JuMP,CSV,DataFrames model = Model() @variable(model, x\[1:3\]) @constraint(model, c2, x\[1\] + 2 \* x\[3\] \>= 2) @constraint(model, c4, 4 \<= 2 \* x\[2\] \<= 5) @variable(model,x1\[h in 1:5, i in 1:1, j in 1:2, k in 1:1,p …

---

## [Rank1 PSD constraint dual variables](https://discourse.julialang.org/t/rank1-psd-constraint-dual-variables/80348)

<div class="topic-metadata">

**Author:** [@HWS](https://discourse.julialang.org/u/HWS)\
**Replies:** 8\
**Last updated:** [May 2, 2022, 1:47am UTC](https://discourse.julialang.org/t/rank1-psd-constraint-dual-variables/80348 "2022-05-02T01:47:07Z")

</div>

Hi, I ran the following code in JuMP, @variable(m, x\[1:n\]\>=0) @variable(m, X\[1:n,1:n\], Symmetric) @constraint(m, X\_xx\_cons, \[1 x'; x X\] in PSDCone() ) @objective(m, Min, tr(Q'\*X)+dot(b,x)) optimize!(m) A = dual(X\_xx\_c…

---

## [Slow generation of the non-linear expressions](https://discourse.julialang.org/t/slow-generation-of-the-non-linear-expressions/80308)

<div class="topic-metadata">

**Author:** [@xxxxx](https://discourse.julialang.org/u/xxxxx)\
**Replies:** 4\
**Last updated:** [May 1, 2022, 10:37pm UTC](https://discourse.julialang.org/t/slow-generation-of-the-non-linear-expressions/80308 "2022-05-01T22:37:09Z")

</div>

Hi there, I am new to JuMP and trying to use it for maximum likelihood estimation. I found a very slow step when generating the expressions, and I am not sure how to improve it. Here is the code for a minimum working ex…

---

## [Use low precision float type in JuMP](https://discourse.julialang.org/t/use-low-precision-float-type-in-jump/80332)

<div class="topic-metadata">

**Author:** [@wujinq](https://discourse.julialang.org/u/wujinq)\
**Replies:** 2\
**Last updated:** [May 1, 2022, 9:44pm UTC](https://discourse.julialang.org/t/use-low-precision-float-type-in-jump/80332 "2022-05-01T21:44:44Z")

</div>

I’m working with a large linear SDP problem with JuMP and COSMO and is trying to find whether low float precision contributes to the convergence problem. So I want to change the float type of a smaller problem that works…

---

## [Unable to set\_optimizer\_attribute in BilevelJuMP.jl](https://discourse.julialang.org/t/unable-to-set-optimizer-attribute-in-bileveljump-jl/80240)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 6\
**Last updated:** [May 1, 2022, 4:49am UTC](https://discourse.julialang.org/t/unable-to-set-optimizer-attribute-in-bileveljump-jl/80240 "2022-05-01T04:49:18Z")

</div>

I am trying to change the MIPGap parameter for Guorbi: using JuMP, Gurobi, BilevelJuMP model = BilevelModel(Gurobi.Optimizer, mode = BilevelJuMP.SOS1Mode()) set\_optimizer\_attribute(model, "MIPGap", 1e-5) Throws error: …

---

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

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 8\
**Last updated:** [April 28, 2022, 2:02am UTC](https://discourse.julialang.org/t/help-with-jump-extension/79485 "2022-04-28T02:02:05Z")

</div>

I am trying to tweak JuMP so that I can specify and query some more specific stuff that I can not currently do with inbuilt JuMP functions and macros. See the example below: First, I want to specify the ‘kind’ of variab…

---

## [Querying lower level objective value in BilevelJuMP.jl](https://discourse.julialang.org/t/querying-lower-level-objective-value-in-bileveljump-jl/80084)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 3\
**Last updated:** [April 28, 2022, 1:06am UTC](https://discourse.julialang.org/t/querying-lower-level-objective-value-in-bileveljump-jl/80084 "2022-04-28T01:06:38Z")

</div>

Is there an inbuilt function I can use to query the lower level objective value when using BilevelJuMP.jl? For the following example: using JuMP, BilevelJuMP, Gurobi model = BilevelModel(Gurobi.Optimizer, mode = Bilev…

---

## [Help speeding up problem with Convex.jl](https://discourse.julialang.org/t/help-speeding-up-problem-with-convex-jl/79005)

<div class="topic-metadata">

**Author:** [@josuagrw](https://discourse.julialang.org/u/josuagrw)\
**Replies:** 31\
**Last updated:** [April 26, 2022, 8:11am UTC](https://discourse.julialang.org/t/help-speeding-up-problem-with-convex-jl/79005 "2022-04-26T08:11:52Z")

</div>

I’m currently solving a convex problem with Convex.jl and COSMO.jl. The text output from COSMO indicates that the solution is actually quite fast (less than a second) but it takes ca. 30 seconds to set the problem up wit…

---

## [Analytic derivatives for multivariate functions in JuMP](https://discourse.julialang.org/t/analytic-derivatives-for-multivariate-functions-in-jump/79750)

<div class="topic-metadata">

**Author:** [@optimist](https://discourse.julialang.org/u/optimist)\
**Replies:** 2\
**Last updated:** [April 26, 2022, 2:26am UTC](https://discourse.julialang.org/t/analytic-derivatives-for-multivariate-functions-in-jump/79750 "2022-04-26T02:26:32Z")

</div>

I am trying to provide derivatives for a function to see if it can speed up the optimization, but I am running in to errors. Unexpected array VariableRef\[x\[1\], x\[2\], x\[3\], x\[4\]\] in nonlinear expression. Nonlinear expres…

---

## [Using CPLEX populate method with JuMP](https://discourse.julialang.org/t/using-cplex-populate-method-with-jump/79973)

<div class="topic-metadata">

**Author:** [@MLainee](https://discourse.julialang.org/u/MLainee)\
**Replies:** 2\
**Last updated:** [April 25, 2022, 11:12am UTC](https://discourse.julialang.org/t/using-cplex-populate-method-with-jump/79973 "2022-04-25T11:12:22Z")

</div>

Greetings, I am currently using the CPLEX optimizer with the help of the JuMP package. In order to generate constraints for my model, I am currently using a function of the following type: using JuMP using CPLEX funct…

---

## [Writing loops in optimization problems in Julia](https://discourse.julialang.org/t/writing-loops-in-optimization-problems-in-julia/79927)

<div class="topic-metadata">

**Author:** [@Eric.O](https://discourse.julialang.org/u/Eric.O)\
**Replies:** 7\
**Last updated:** [April 24, 2022, 11:44pm UTC](https://discourse.julialang.org/t/writing-loops-in-optimization-problems-in-julia/79927 "2022-04-24T23:44:55Z")

</div>

I am trying to use Mosek to solve this optimization problem. I have my code which displays the optimal solution of the values of x,y,z and the radius R. I want to insert a loop in my code to test if the absolute of the …

---

## [How to properly specify Jacobian & Hessian functions of inequality constraints (Optim)](https://discourse.julialang.org/t/how-to-properly-specify-jacobian-hessian-functions-of-inequality-constraints-optim/53870)

<div class="topic-metadata">

**Author:** [@Michael\_Barmann](https://discourse.julialang.org/u/Michael_Barmann)\
**Replies:** 9\
**Last updated:** [April 24, 2022, 10:34pm UTC](https://discourse.julialang.org/t/how-to-properly-specify-jacobian-hessian-functions-of-inequality-constraints-optim/53870 "2022-04-24T22:34:46Z")

</div>

I’m trying to optimize an objective function with 19 variables in Optim with the following inequality constraints: 0 \<= x\[1\]/3 - x\[2\] \<= 1/3 5 \<= 1/x\[3\] + 1/x\[4\] \<= 6 I’m trying to use either IPNewton() or NewtonTrust…

---

## [Problem in installing Gurobi.jl (ipopt shows infeasible )](https://discourse.julialang.org/t/problem-in-installing-gurobi-jl-ipopt-shows-infeasible/79845)

<div class="topic-metadata">

**Author:** [@HosseinF](https://discourse.julialang.org/u/HosseinF)\
**Replies:** 6\
**Last updated:** [April 24, 2022, 10:23pm UTC](https://discourse.julialang.org/t/problem-in-installing-gurobi-jl-ipopt-shows-infeasible/79845 "2022-04-24T22:23:16Z")

</div>

Hi, I wanted to solve a two stage stochastic problem via ipopt solver but it does not solved and shows: Converged to a point of local infeasibility. Problem may be infeasible. LOCALLY INFEASIBLE┌ Warning: Stochastic p…

---

## [Finding nodal lines numerically in a volume](https://discourse.julialang.org/t/finding-nodal-lines-numerically-in-a-volume/79836)

<div class="topic-metadata">

**Author:** [@volkerkarle](https://discourse.julialang.org/u/volkerkarle)\
**Replies:** 3\
**Last updated:** [April 24, 2022, 12:13pm UTC](https://discourse.julialang.org/t/finding-nodal-lines-numerically-in-a-volume/79836 "2022-04-24T12:13:32Z")

</div>

Dear all, I’m trying to the solve the following problem. Consider some volume V \\in \\mathbb{R}^3 with an almost everywhere smooth function f(x) \\in \\mathbb{R} \\leq 0 with x \\in V . For symmetry reasons, all zero manifo…

---

## [Problem in installing Gurobi.jl](https://discourse.julialang.org/t/problem-in-installing-gurobi-jl/79929)

<div class="topic-metadata">

**Author:** [@HosseinF](https://discourse.julialang.org/u/HosseinF)\
**Replies:** 1\
**Last updated:** [April 24, 2022, 10:22am UTC](https://discourse.julialang.org/t/problem-in-installing-gurobi-jl/79929 "2022-04-24T10:22:19Z")

</div>

Hi, I wanted to solve a two stage stochastic problem via ipopt solver but it does not solved and shows: Converged to a point of local infeasibility. Problem may be infeasible. LOCALLY INFEASIBLE┌ Warning: Stochastic pr…

---

## [Compute simplex tableau from Gurobi.jl using JuMP](https://discourse.julialang.org/t/compute-simplex-tableau-from-gurobi-jl-using-jump/79395)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 2\
**Last updated:** [April 22, 2022, 6:08pm UTC](https://discourse.julialang.org/t/compute-simplex-tableau-from-gurobi-jl-using-jump/79395 "2022-04-22T18:08:13Z")

</div>

I am modeling an LP in JuMP using Gurobi. How can I obtain the optimal simplex tableau? For example, consider the below LP: A = \[1; 2; 3\]' c = \[4; 5; 6\] b = 7 M = Model(Gurobi.Optimizer) set\_optimizer\_attribute(M, "Pre…

---

## [Copy\_model() equivalent for BilevelJuMP.jl](https://discourse.julialang.org/t/copy-model-equivalent-for-bileveljump-jl/79709)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 10\
**Last updated:** [April 22, 2022, 3:46pm UTC](https://discourse.julialang.org/t/copy-model-equivalent-for-bileveljump-jl/79709 "2022-04-22T15:46:55Z")

</div>

Is there a way to copy a JuMP model and use it as a building block for the lower level problem in BilevelJuMP.jl. For example: using JuMP, BilevelJuMP model = Model() @variable(model, ...) @constraint(model, ...) #Defi…

---

## [Complementarity constraints containing sum statements](https://discourse.julialang.org/t/complementarity-constraints-containing-sum-statements/79818)

<div class="topic-metadata">

**Author:** [@rubenvanbeesten](https://discourse.julialang.org/u/rubenvanbeesten)\
**Replies:** 4\
**Last updated:** [April 22, 2022, 2:09pm UTC](https://discourse.julialang.org/t/complementarity-constraints-containing-sum-statements/79818 "2022-04-22T14:09:42Z")

</div>

Hi, I’m trying to model an mathematical program with equilibrium constraints (MPEC) in Julia/JuMP. I am currently using the Complementarity.jl package. I am following this example (“bard1”) and try to adapt it to my nee…

---

## [Registering the user-defined function "multivariate normal cdf" for nonlinear modeling in JuMP](https://discourse.julialang.org/t/registering-the-user-defined-function-multivariate-normal-cdf-for-nonlinear-modeling-in-jump/79825)

<div class="topic-metadata">

**Author:** [@naouess](https://discourse.julialang.org/u/naouess)\
**Replies:** 3\
**Last updated:** [April 22, 2022, 11:46am UTC](https://discourse.julialang.org/t/registering-the-user-defined-function-multivariate-normal-cdf-for-nonlinear-modeling-in-jump/79825 "2022-04-22T11:46:16Z")

</div>

Hello Julia-community, I would like to use the multivariate normal cumulative distribution function within a constraint in JuMP. For the function, I’m using the mvnormcdf from this package MvNormalCDF.jl. Since this re…

---

## [Convex.jl/Mosek/SCS setting callback](https://discourse.julialang.org/t/convex-jl-mosek-scs-setting-callback/79780)

<div class="topic-metadata">

**Author:** [@Alex\_W](https://discourse.julialang.org/u/Alex_W)\
**Replies:** 3\
**Last updated:** [April 21, 2022, 8:12pm UTC](https://discourse.julialang.org/t/convex-jl-mosek-scs-setting-callback/79780 "2022-04-21T20:12:30Z")

</div>

Hello all, I am new to Julia so I apologize if this is trivial. I am calling Mosek and SCS through Convex.jl and want to track how quickly these solvers are converging (for plotting purposes). Is it possible to pass a …

---

## [Unable to transform a quadratic constraint into a second-order cone constraint because the quadratic constraint is not strongly convex](https://discourse.julialang.org/t/unable-to-transform-a-quadratic-constraint-into-a-second-order-cone-constraint-because-the-quadratic-constraint-is-not-strongly-convex/79767)

<div class="topic-metadata">

**Author:** [@Eric.O](https://discourse.julialang.org/u/Eric.O)\
**Replies:** 4\
**Last updated:** [April 21, 2022, 1:13pm UTC](https://discourse.julialang.org/t/unable-to-transform-a-quadratic-constraint-into-a-second-order-cone-constraint-because-the-quadratic-constraint-is-not-strongly-convex/79767 "2022-04-21T13:13:38Z")

</div>

I am using Mosek solver to solve the model below. I get the model showing but the solver is not able to display the results. Am guessing is an issue with the second order cone formulation. I will appreciate your guidance…

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

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