# Optimization (Mathematical)

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

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

**Page:** 67

---

## [How to use the solver-dependent callback](https://discourse.julialang.org/t/how-to-use-the-solver-dependent-callback/76519)

<div class="topic-metadata">

**Author:** [@Jacob\_Jin](https://discourse.julialang.org/u/Jacob_Jin)\
**Replies:** 12\
**Last updated:** [March 14, 2022, 7:48am UTC](https://discourse.julialang.org/t/how-to-use-the-solver-dependent-callback/76519 "2022-03-14T07:48:26Z")

</div>

I want to use Gurobi to implement Bender’s decomposition. I write it in Python: LB = model.cbGet(GRB.Callback.MIPSOL\_OBJBND) How to call the cbGet(GRB.Callback.MIPSOL\_OBJBND) in Julia? Thank you so much.

---

## [Optimization with Gurobi](https://discourse.julialang.org/t/optimization-with-gurobi/77125)

<div class="topic-metadata">

**Author:** [@O\_olalekan](https://discourse.julialang.org/u/O_olalekan)\
**Replies:** 4\
**Last updated:** [March 14, 2022, 1:35am UTC](https://discourse.julialang.org/t/optimization-with-gurobi/77125 "2022-03-14T01:35:36Z")

</div>

I am solving an optimization problem with Gurobi package. I set the non-convex parameter to be 2 which helped me with the bilinear constraints. But, I am getting an infeasible solution with a warning “”" Model contains…

---

## [Set MathOptInterface.SecondOrderCone is not accepted when solution method is BilevelJuMP.SOS1Mode{Float64}](https://discourse.julialang.org/t/set-mathoptinterface-secondordercone-is-not-accepted-when-solution-method-is-bileveljump-sos1mode-float64/77737)

<div class="topic-metadata">

**Author:** [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Replies:** 3\
**Last updated:** [March 13, 2022, 12:45am UTC](https://discourse.julialang.org/t/set-mathoptinterface-secondordercone-is-not-accepted-when-solution-method-is-bileveljump-sos1mode-float64/77737 "2022-03-13T00:45:12Z")

</div>

Here is an example: using JuMP, BilevelJuMP, Gurobi model=BilevelModel(Gurobi.Optimizer) set\_optimizer\_attribute(model,"NonConvex",2) @variable(Lower(model), x) @variable(Upper(model), y) @objective(Upper(model), Min, …

---

## [Could Optim.TwiceDifferentiable support CuArray?](https://discourse.julialang.org/t/could-optim-twicedifferentiable-support-cuarray/77670)

<div class="topic-metadata">

**Author:** [@DennisFang](https://discourse.julialang.org/u/DennisFang)\
**Replies:** 5\
**Last updated:** [March 12, 2022, 7:27pm UTC](https://discourse.julialang.org/t/could-optim-twicedifferentiable-support-cuarray/77670 "2022-03-12T19:27:25Z")

</div>

I try to transform optimization problem from CPU to GPU computing in Optim.jl. My demo examples are as follows. #Version 1-1 using Optim, CUDA f1(x) = x\[1\]^4 + x\[2\]^4 - 8 \* x\[1\] \* x\[2\] + 2.0 init = \[1.0 1.0\] opt1 = …

---

## [Computing the schur norm of a matrix](https://discourse.julialang.org/t/computing-the-schur-norm-of-a-matrix/77770)

<div class="topic-metadata">

**Author:** [@jsch77](https://discourse.julialang.org/u/jsch77)\
**Replies:** 2\
**Last updated:** [March 12, 2022, 1:11pm UTC](https://discourse.julialang.org/t/computing-the-schur-norm-of-a-matrix/77770 "2022-03-12T13:11:23Z")

</div>

using the CVX package in Matlab the following code will compute the Schur norm of matrix T. T = \[1 2;3 4\]; n = length(T); cvx\_begin sdp quiet cvx\_precision high; variable Y0(n,n) hermitian variable Y1(n,n) …

---

## [Question on Xpress.license function](https://discourse.julialang.org/t/question-on-xpress-license-function/77762)

<div class="topic-metadata">

**Author:** [@Marie](https://discourse.julialang.org/u/Marie)\
**Replies:** 4\
**Last updated:** [March 11, 2022, 6:09pm UTC](https://discourse.julialang.org/t/question-on-xpress-license-function/77762 "2022-03-11T18:09:50Z")

</div>

I am using Xpress and JuMP packages to solve LP problem. First i need to initialize xpress license. There’s a function under Xpress lib.jl: ‘’’ function XPRSlicense(\_i1, \_c1) ccall((:XPRSlicense, libxprs), Cint, (Ptr{…

---

## [Infeasible or unbounded model](https://discourse.julialang.org/t/infeasible-or-unbounded-model/77653)

<div class="topic-metadata">

**Author:** [@dires](https://discourse.julialang.org/u/dires)\
**Replies:** 6\
**Last updated:** [March 10, 2022, 10:04pm UTC](https://discourse.julialang.org/t/infeasible-or-unbounded-model/77653 "2022-03-10T22:04:26Z")

</div>

I got this message for my optimization problem can anybody help me how to resolve this? "Result index of attribute MathOptInterface.ObjectiveValue(1) out of bounds. There are currently 0 solution(s) in the model. check…

---

## [Any way to achieve the L2 norm of a matrix xx is smaller than 1 in JuMP?](https://discourse.julialang.org/t/any-way-to-achieve-the-l2-norm-of-a-matrix-xx-is-smaller-than-1-in-jump/77660)

<div class="topic-metadata">

**Author:** [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Replies:** 3\
**Last updated:** [March 10, 2022, 3:22am UTC](https://discourse.julialang.org/t/any-way-to-achieve-the-l2-norm-of-a-matrix-xx-is-smaller-than-1-in-jump/77660 "2022-03-10T03:22:41Z")

</div>

I want to achieve the constraint: norm(A) \<= 1, where A is a matrix variable. M = Model(SCS.Optimizer) @variable(M,A\[1:3,1:3\]) @constraint(M, \[1; A\] in SecondOrderCone()) But it shows error：@constraint(M, \[1; A\] in Se…

---

## [Best way to convert a generic QCQP into standard form in JuMP](https://discourse.julialang.org/t/best-way-to-convert-a-generic-qcqp-into-standard-form-in-jump/77593)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 4\
**Last updated:** [March 9, 2022, 11:46pm UTC](https://discourse.julialang.org/t/best-way-to-convert-a-generic-qcqp-into-standard-form-in-jump/77593 "2022-03-09T23:46:55Z")

</div>

Dear All, I am solving nonconvex quadratically constrained quadratic optimization problems (QCQPs) in JuMP+Gurobi for teaching a recitation class on power system course at MIT (I am a teaching assistant for the course).…

---

## [How \`JuMP.@expression\` will work ? / Multiple macros](https://discourse.julialang.org/t/how-jump-expression-will-work-multiple-macros/77585)

<div class="topic-metadata">

**Author:** [@iAnkiit](https://discourse.julialang.org/u/iAnkiit)\
**Replies:** 3\
**Last updated:** [March 9, 2022, 6:06pm UTC](https://discourse.julialang.org/t/how-jump-expression-will-work-multiple-macros/77585 "2022-03-09T18:06:26Z")

</div>

I am referring a code in which there are multiple macros with same name. So, how would it work? I mean, what attributes would be called/run when macro is called? eg. @expression(EP, ePowerBalance\[t=1:T, z=1:Z\], 0), @ex…

---

## [Urls in JuMP docs web page giving "404 error page not found"](https://discourse.julialang.org/t/urls-in-jump-docs-web-page-giving-404-error-page-not-found/77639)

<div class="topic-metadata">

**Author:** [@harinreddy](https://discourse.julialang.org/u/harinreddy)\
**Replies:** 2\
**Last updated:** [March 9, 2022, 3:55pm UTC](https://discourse.julialang.org/t/urls-in-jump-docs-web-page-giving-404-error-page-not-found/77639 "2022-03-09T15:55:30Z")

</div>

Hi, Some of the links in: https://github.com/jump-dev/JuMP.jl/blob/master/docs/src/index.md are throwing “404 page not found” error For example: Getting started with Julia Please let me know how to get around this …

---

## [JuMP CPLEX attribute error for getting CPX\_PARAM\_INTSOLLIM](https://discourse.julialang.org/t/jump-cplex-attribute-error-for-getting-cpx-param-intsollim/77595)

<div class="topic-metadata">

**Author:** [@hideakiv](https://discourse.julialang.org/u/hideakiv)\
**Replies:** 2\
**Last updated:** [March 9, 2022, 3:41am UTC](https://discourse.julialang.org/t/jump-cplex-attribute-error-for-getting-cpx-param-intsollim/77595 "2022-03-09T03:41:58Z")

</div>

I am trying to get a CPLEX attribute of a model. I am using JuMP v0.21.10 and CPLEX v0.7.8. using JuMP, CPLEX m = Model() set\_optimizer(m, optimizer\_with\_attributes(CPLEX.Optimizer, "CPX\_PARAM\_INTSOLLIM" =\> 1)) get\_opt…

---

## [Bonmin\_jll](https://discourse.julialang.org/t/bonmin-jll/77612)

<div class="topic-metadata">

**Author:** [@Francisco\_Javier\_Mar](https://discourse.julialang.org/u/Francisco_Javier_Mar)\
**Replies:** 1\
**Last updated:** [March 9, 2022, 1:12am UTC](https://discourse.julialang.org/t/bonmin-jll/77612 "2022-03-09T01:12:01Z")

</div>

I got this error message. I am using Bonmin\_jll to solve my model. What can I do? The provided optimizer\_constructor is invalid. It must be callable with zero arguments. For example, "Ipopt.Optimizer" or "() -\> ECOS.Opt…

---

## [Factor of two in Zygote complex gradient](https://discourse.julialang.org/t/factor-of-two-in-zygote-complex-gradient/77545)

<div class="topic-metadata">

**Author:** [@goerz](https://discourse.julialang.org/u/goerz)\
**Replies:** 5\
**Last updated:** [March 8, 2022, 8:14pm UTC](https://discourse.julialang.org/t/factor-of-two-in-zygote-complex-gradient/77545 "2022-03-08T20:14:59Z")

</div>

Either Zygote’s gradients for a scalar function with respect to a complex vector are off by a factor of two, I’ve been doing matrix algebra wrong for the last 10 years, or I’m just being stupid here. Consider the followi…

---

## [Tuning the gamma parameter in FrankWolfe.jl](https://discourse.julialang.org/t/tuning-the-gamma-parameter-in-frankwolfe-jl/77023)

<div class="topic-metadata">

**Author:** [@dridz](https://discourse.julialang.org/u/dridz)\
**Replies:** 7\
**Last updated:** [March 8, 2022, 5:47pm UTC](https://discourse.julialang.org/t/tuning-the-gamma-parameter-in-frankwolfe-jl/77023 "2022-03-08T17:47:33Z")

</div>

Hi, I found out about the FrankWolfe.jl package and it looks great ! I am dealing with an optimization problem for which I have a lot of intuition about a good warm start and also about the order of magnitude of a good …

---

## [How to print multiple values in a loop](https://discourse.julialang.org/t/how-to-print-multiple-values-in-a-loop/77474)

<div class="topic-metadata">

**Author:** [@Eric.O](https://discourse.julialang.org/u/Eric.O)\
**Replies:** 8\
**Last updated:** [March 8, 2022, 4:48pm UTC](https://discourse.julialang.org/t/how-to-print-multiple-values-in-a-loop/77474 "2022-03-08T16:48:05Z")

</div>

I want to print my output in Julia, I have written it in the form presented below but I want to use a for loop to make it more concise. Any help on how to write the code below using for loop will be appreciated please. …

---

## [CBC solver](https://discourse.julialang.org/t/cbc-solver/77548)

<div class="topic-metadata">

**Author:** [@Francisco\_Javier\_Mar](https://discourse.julialang.org/u/Francisco_Javier_Mar)\
**Replies:** 18\
**Last updated:** [March 8, 2022, 1:08pm UTC](https://discourse.julialang.org/t/cbc-solver/77548 "2022-03-08T13:08:01Z")

</div>

I got this error while trying to test Alpine: Failed to precompile Cbc. What can I do to fix this ? Any suggestion ? My Julia version: JuliaPro\_v1.5.3-1

---

## [Powermodels.jl SCS for a mixed-integer problem with SDP relaxation](https://discourse.julialang.org/t/powermodels-jl-scs-for-a-mixed-integer-problem-with-sdp-relaxation/77244)

<div class="topic-metadata">

**Author:** [@lostamcimber](https://discourse.julialang.org/u/lostamcimber)\
**Replies:** 4\
**Last updated:** [March 8, 2022, 12:44pm UTC](https://discourse.julialang.org/t/powermodels-jl-scs-for-a-mixed-integer-problem-with-sdp-relaxation/77244 "2022-03-08T12:44:23Z")

</div>

Hi all, I am trying to solve a mixed integer problem of a network with switches (switches are my binary variables). I can solve my OPF problem with quadratic relaxations like ‘SOCWRPowerModel’, ‘QCRMPowerModel’, ‘QCLSPo…

---

## [Neos Server](https://discourse.julialang.org/t/neos-server/77549)

<div class="topic-metadata">

**Author:** [@Francisco\_Javier\_Mar](https://discourse.julialang.org/u/Francisco_Javier_Mar)\
**Replies:** 1\
**Last updated:** [March 8, 2022, 2:19am UTC](https://discourse.julialang.org/t/neos-server/77549 "2022-03-08T02:19:13Z")

</div>

I got this error while trying to install NEOSServer. What can I do ? ERROR: Unsatisfiable requirements detected for package HTTP \[cd3eb016\]: HTTP \[cd3eb016\] log: ├─possible versions are: \[0.6.10-0.6.14, 0.7.0-0.7.1, 0…

---

## [JuMP Hessian sparcity issues. Registered function's Hessians. atan2 issue](https://discourse.julialang.org/t/jump-hessian-sparcity-issues-registered-functions-hessians-atan2-issue/76342)

<div class="topic-metadata">

**Author:** [@a6a3uh](https://discourse.julialang.org/u/a6a3uh)\
**Replies:** 6\
**Last updated:** [March 7, 2022, 5:43am UTC](https://discourse.julialang.org/t/jump-hessian-sparcity-issues-registered-functions-hessians-atan2-issue/76342 "2022-03-07T05:43:28Z")

</div>

So there are a bunch of observations so far which I want to get some insights into. I’m describing issues with nonlinear solver btw. As soon as I’m using atan with 2 arguments JuMP seems registers this function for me (…

---

## [Optimizing using objective with an integral in it](https://discourse.julialang.org/t/optimizing-using-objective-with-an-integral-in-it/77162)

<div class="topic-metadata">

**Author:** [@samerb](https://discourse.julialang.org/u/samerb)\
**Replies:** 5\
**Last updated:** [March 5, 2022, 11:05pm UTC](https://discourse.julialang.org/t/optimizing-using-objective-with-an-integral-in-it/77162 "2022-03-05T23:05:41Z")

</div>

I’m new to JuMP and I’d like to minimize a function that has an integral in it. Here’s an example f(y) = \\int\_0^y y dy - y. Of course, this is just f(y)=(1/2)y^2-y which is minimized at y=1, but this is just a minimal ex…

---

## [How to print the values of constraints](https://discourse.julialang.org/t/how-to-print-the-values-of-constraints/40040)

<div class="topic-metadata">

**Author:** [@Vondoe79](https://discourse.julialang.org/u/Vondoe79)\
**Replies:** 12\
**Last updated:** [July 19, 2020, 5:16am UTC](https://discourse.julialang.org/t/how-to-print-the-values-of-constraints/40040 "2020-07-19T05:16:50Z")

</div>

Hello team, I would like to print the values of the constraints(disT, cosT, & deaTH) of my model below. I used the following immediate commands, but it is not working. I am using Julia v0.6.4. I shall be grateful for yo…

---

## [How to define a subset of some variables integers?](https://discourse.julialang.org/t/how-to-define-a-subset-of-some-variables-integers/77443)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [March 5, 2022, 5:53pm UTC](https://discourse.julialang.org/t/how-to-define-a-subset-of-some-variables-integers/77443 "2022-03-05T17:53:12Z")

</div>

I need to define some variables as integer based on input. The following code doesn’t work as the name x is already used, and at the same time I don’t know the syntax to add it as a constraint: for a in 1:nActivities …

---

## [How to optimize multiple times in a run](https://discourse.julialang.org/t/how-to-optimize-multiple-times-in-a-run/75118)

<div class="topic-metadata">

**Author:** [@Anjinsan](https://discourse.julialang.org/u/Anjinsan)\
**Replies:** 4\
**Last updated:** [March 4, 2022, 11:43pm UTC](https://discourse.julialang.org/t/how-to-optimize-multiple-times-in-a-run/75118 "2022-03-04T23:43:52Z")

</div>

Hello, I’m completely new to Julia / JuMP. I’m working on writing least-cost dispatch code for a power system. I want to load in data for one year (8760 hours), but have the model optimize only one day at a time. Wha…

---

## [Optimization Error:](https://discourse.julialang.org/t/optimization-error/77358)

<div class="topic-metadata">

**Author:** [@Eriklw](https://discourse.julialang.org/u/Eriklw)\
**Replies:** 4\
**Last updated:** [March 4, 2022, 2:26pm UTC](https://discourse.julialang.org/t/optimization-error/77358 "2022-03-04T14:26:02Z")

</div>

I am minimizing a function with the Optim package. I am supplying a gradient (that is calculated using AD). I am using the LBFGS() option. However the following error keeps occuring: AssertionError: isfinite(phi\_c) && i…

---

## [JuMP: Sensitivity of Objective to Constraints](https://discourse.julialang.org/t/jump-sensitivity-of-objective-to-constraints/77361)

<div class="topic-metadata">

**Author:** [@Alec\_Loudenback](https://discourse.julialang.org/u/Alec_Loudenback)\
**Replies:** 3\
**Last updated:** [March 4, 2022, 1:51am UTC](https://discourse.julialang.org/t/jump-sensitivity-of-objective-to-constraints/77361 "2022-03-04T01:51:52Z")

</div>

Is there a recommended way to perform sensitivity analysis of the optimization target to different constraints? What I mean by that is a way to determine which constraints are most limiting to the objective function. Fo…

---

## [Parameter estimation with DifferentialEquations.jl for a subset of parameters](https://discourse.julialang.org/t/parameter-estimation-with-differentialequations-jl-for-a-subset-of-parameters/33851)

<div class="topic-metadata">

**Author:** [@moesphere](https://discourse.julialang.org/u/moesphere)\
**Replies:** 3\
**Last updated:** [March 3, 2022, 12:27pm UTC](https://discourse.julialang.org/t/parameter-estimation-with-differentialequations-jl-for-a-subset-of-parameters/33851 "2022-03-03T12:27:13Z")

</div>

If I have defined an ODEFunction with a parameter vector p according to the DifferentialEquations.jl package. Is it possible to build a loss objective, i.e. using build\_loss\_objective for only a subset of parameters spe…

---

## [Cbc solver crashes Julia with multithreading](https://discourse.julialang.org/t/cbc-solver-crashes-julia-with-multithreading/73859)

<div class="topic-metadata">

**Author:** [@JohnZ](https://discourse.julialang.org/u/JohnZ)\
**Replies:** 11\
**Last updated:** [March 2, 2022, 10:26pm UTC](https://discourse.julialang.org/t/cbc-solver-crashes-julia-with-multithreading/73859 "2022-03-02T22:26:32Z")

</div>

The Cbc solver crashes Julia when using more than one threads for optimization. It gives an error message that Julia has exited. Here is a MWE based on JuMP tutorial on facility location: using JuMP, Cbc, LinearAlgebra,…

---

## [KNITRO.jl cannot be added with latest JuMP, MathOptInterface](https://discourse.julialang.org/t/knitro-jl-cannot-be-added-with-latest-jump-mathoptinterface/77290)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 2\
**Last updated:** [March 2, 2022, 2:50pm UTC](https://discourse.julialang.org/t/knitro-jl-cannot-be-added-with-latest-jump-mathoptinterface/77290 "2022-03-02T14:50:30Z")

</div>

Dear All, If I try to install KNITRO add KNITRO it downgrades JuMP and MathoptInterface Resolving package versions... Installed BinaryProvider ───── v0.5.10 Installed MutableArithmetics ─ v0.3.3 Installed …

---

## [Having problem with Convex.jl](https://discourse.julialang.org/t/having-problem-with-convex-jl/77196)

<div class="topic-metadata">

**Author:** [@janilin](https://discourse.julialang.org/u/janilin)\
**Replies:** 4\
**Last updated:** [March 1, 2022, 6:08am UTC](https://discourse.julialang.org/t/having-problem-with-convex-jl/77196 "2022-03-01T06:08:49Z")

</div>

Hi! I’m new to Julia. While I was going through the Julia for Data Science course’s \*\* Numerical Optimization\*\* lecture, got stucked in solve!() unfortunately. Explored in different forums but could not get the solution…

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

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