# Optimization (Mathematical)

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

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

**Page:** 78

---

## [Why Mosek can not resolve new model when the added new constraints include SOCP constraints?](https://discourse.julialang.org/t/why-mosek-can-not-resolve-new-model-when-the-added-new-constraints-include-socp-constraints/64411)

<div class="topic-metadata">

**Author:** [@Sawyer\_Zhou](https://discourse.julialang.org/u/Sawyer_Zhou)\
**Replies:** 1\
**Last updated:** [July 10, 2021, 4:18pm UTC](https://discourse.julialang.org/t/why-mosek-can-not-resolve-new-model-when-the-added-new-constraints-include-socp-constraints/64411 "2021-07-10T16:18:38Z")

</div>

Here is a mini-case of my mathematical model. First, solve the initial model, and check if the solution meets the condition. If it does not, the new constraints will be added, and solve the new model. But there are som…

---

## [How to retrieve more results from NEOS Server?](https://discourse.julialang.org/t/how-to-retrieve-more-results-from-neos-server/64222)

<div class="topic-metadata">

**Author:** [@fredih](https://discourse.julialang.org/u/fredih)\
**Replies:** 5\
**Last updated:** [July 9, 2021, 4:32pm UTC](https://discourse.julialang.org/t/how-to-retrieve-more-results-from-neos-server/64222 "2021-07-09T16:32:46Z")

</div>

Hello! How can I retrieve the variable values from the NEOS server? Currently I only receive the objective function value in my e-mail. For example, to this code: using JuMP, NamedArrays, Cbc, NEOSServer threath = Mod…

---

## [User-defined objective function with scalar and vector inputs](https://discourse.julialang.org/t/user-defined-objective-function-with-scalar-and-vector-inputs/64218)

<div class="topic-metadata">

**Author:** [@mengxiaoliu](https://discourse.julialang.org/u/mengxiaoliu)\
**Replies:** 5\
**Last updated:** [July 9, 2021, 5:12am UTC](https://discourse.julialang.org/t/user-defined-objective-function-with-scalar-and-vector-inputs/64218 "2021-07-09T05:12:01Z")

</div>

Hello, I am using Ipopt to write an optimization problem with a user-defined objective function that has 5 scalar inputs and one vector input. I define the objective function as likelihood((ρ,α,fB,fS,fO,δ…), where δ is …

---

## [JuMP Ipopt performance for MLE](https://discourse.julialang.org/t/jump-ipopt-performance-for-mle/64295)

<div class="topic-metadata">

**Author:** [@mengxiaoliu](https://discourse.julialang.org/u/mengxiaoliu)\
**Replies:** 1\
**Last updated:** [July 9, 2021, 5:10am UTC](https://discourse.julialang.org/t/jump-ipopt-performance-for-mle/64295 "2021-07-09T05:10:26Z")

</div>

Hello, With much of your help, I am finally able to write a functioning code file. However, I was not able to find enough resources online for tuning the performance of Ipopt in JuMP. Now I would like to seek your advi…

---

## [How do I find the shadow price of anonymous constraints?](https://discourse.julialang.org/t/how-do-i-find-the-shadow-price-of-anonymous-constraints/29349)

<div class="topic-metadata">

**Author:** [@Leonardo\_Rivera](https://discourse.julialang.org/u/Leonardo_Rivera)\
**Replies:** 2\
**Last updated:** [July 8, 2021, 7:59pm UTC](https://discourse.julialang.org/t/how-do-i-find-the-shadow-price-of-anonymous-constraints/29349 "2021-07-08T19:59:45Z")

</div>

Hello! I have a model in which I need to create constraints for the non-zero elements of a sparse matrix (a parameter). I create them as anonymous constraints, but I do not know how to find their dual values after the mo…

---

## [Successive optimization in JuMP](https://discourse.julialang.org/t/successive-optimization-in-jump/64056)

<div class="topic-metadata">

**Author:** [@Maria95](https://discourse.julialang.org/u/Maria95)\
**Replies:** 6\
**Last updated:** [July 7, 2021, 11:03pm UTC](https://discourse.julialang.org/t/successive-optimization-in-jump/64056 "2021-07-07T23:03:43Z")

</div>

Sorry for the long post but I thought it is better to give more information. The question itself is not too long! I have given the mathematical formulation below and also my Julia code. Possible solution approach If…

---

## [Dynamically setting the constraint sense in JuMP](https://discourse.julialang.org/t/dynamically-setting-the-constraint-sense-in-jump/64155)

<div class="topic-metadata">

**Author:** [@Mastomaki](https://discourse.julialang.org/u/Mastomaki)\
**Replies:** 2\
**Last updated:** [July 7, 2021, 7:14am UTC](https://discourse.julialang.org/t/dynamically-setting-the-constraint-sense-in-jump/64155 "2021-07-07T07:14:28Z")

</div>

Hello! I was wondering if it is possible to specify different types (i.e. \<=, == and \>=) constraints within the same JuMP container. For example @constraint(model, con\[i = 1:3\], i \* x \<= i + 1) So that whether \<=, == …

---

## [Memory Allocation JuMP constraint!](https://discourse.julialang.org/t/memory-allocation-jump-constraint/64137)

<div class="topic-metadata">

**Author:** [@musman](https://discourse.julialang.org/u/musman)\
**Replies:** 1\
**Last updated:** [July 6, 2021, 9:25pm UTC](https://discourse.julialang.org/t/memory-allocation-jump-constraint/64137 "2021-07-06T21:25:42Z")

</div>

Hi all, I am implementing the following constraint which is allocating around 27MB of memory. for i in 1:nLines f\_bus = nw\_lines\[i\].line\_from t\_bus = nw\_lines\[i\].line\_to idx\_t\_bus = findall(x-\>x==t\_…

---

## [IntervalOptimisation surprising result](https://discourse.julialang.org/t/intervaloptimisation-surprising-result/64144)

<div class="topic-metadata">

**Author:** [@gmouts](https://discourse.julialang.org/u/gmouts)\
**Replies:** 9\
**Last updated:** [July 6, 2021, 6:11pm UTC](https://discourse.julialang.org/t/intervaloptimisation-surprising-result/64144 "2021-07-06T18:11:08Z")

</div>

I need to find the maximiser and the maximum of functions that have a narrow bump. I had some issues with numerics, so I decided to try my luck with intervals. Here is a minimal working (?) example: using IntervalArith…

---

## [Memory allocation problem with Optim + ApproxFun](https://discourse.julialang.org/t/memory-allocation-problem-with-optim-approxfun/64084)

<div class="topic-metadata">

**Author:** [@dbennett1994](https://discourse.julialang.org/u/dbennett1994)\
**Replies:** 8\
**Last updated:** [July 6, 2021, 2:06pm UTC](https://discourse.julialang.org/t/memory-allocation-problem-with-optim-approxfun/64084 "2021-07-06T14:06:09Z")

</div>

Hi all. I’m quite new to Julia and this is my first post. I want to optimize a functional F\[\\phi\] = \\int\_0^1 \\left\[\\frac{1}{2}\\left(\\partial\_x \\phi\\right)^2 + V(x,\\phi(x))\\right\]\\text{d}x. Of course, this can be done by…

---

## [Using casadi from Julia](https://discourse.julialang.org/t/using-casadi-from-julia/63988)

<div class="topic-metadata">

**Author:** [@adityac](https://discourse.julialang.org/u/adityac)\
**Replies:** 11\
**Last updated:** [July 5, 2021, 2:47am UTC](https://discourse.julialang.org/t/using-casadi-from-julia/63988 "2021-07-05T02:47:25Z")

</div>

I am trying to use Casadi from Julia using the opti stack. I am trying to do this using PyCall. I get an error when I use the following code: opti = casadi.Opti(); x = opti.variable(); y = opti.variable(); opti.minimi…

---

## [SCIP solver presolve](https://discourse.julialang.org/t/scip-solver-presolve/63946)

<div class="topic-metadata">

**Author:** [@mjanun](https://discourse.julialang.org/u/mjanun)\
**Replies:** 2\
**Last updated:** [July 3, 2021, 11:34pm UTC](https://discourse.julialang.org/t/scip-solver-presolve/63946 "2021-07-03T23:34:25Z")

</div>

SCIP presolve incorrectly returns some MILP and MINLP problems as infeasible or it gets stuck on presolving. I am trying to turn off presolve, but I am not sure which parameter to use. I have tried concurrent\_presolvebef…

---

## [How to make a user-defined objective function with mulitple vector variable and parameter arguments?](https://discourse.julialang.org/t/how-to-make-a-user-defined-objective-function-with-mulitple-vector-variable-and-parameter-arguments/63849)

<div class="topic-metadata">

**Author:** [@thompsonmj](https://discourse.julialang.org/u/thompsonmj)\
**Replies:** 6\
**Last updated:** [July 1, 2021, 2:18am UTC](https://discourse.julialang.org/t/how-to-make-a-user-defined-objective-function-with-mulitple-vector-variable-and-parameter-arguments/63849 "2021-07-01T02:18:35Z")

</div>

I would like to optimize a set of 3 variable vectors to minimize the total variance in a dataset. I think my problem is in passing variable and parameter vectors into my user-defined objective. I found this question on …

---

## [\[Convex.jl\] Objective function of matrix factorization with missing data](https://discourse.julialang.org/t/convex-jl-objective-function-of-matrix-factorization-with-missing-data/34253)

<div class="topic-metadata">

**Author:** [@4aHxKzD](https://discourse.julialang.org/u/4aHxKzD)\
**Replies:** 21\
**Last updated:** [June 30, 2021, 3:05pm UTC](https://discourse.julialang.org/t/convex-jl-objective-function-of-matrix-factorization-with-missing-data/34253 "2021-06-30T15:05:27Z")

</div>

I’m trying to solve a matrix factorization problem with alternating minimization. My data matrix has missing entries and because of that I can not simply write my objective function as: # A is a n x m data matrix n, m…

---

## [Convex.jl matrix constraints interface : How can i supply this matrix?](https://discourse.julialang.org/t/convex-jl-matrix-constraints-interface-how-can-i-supply-this-matrix/63753)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 2\
**Last updated:** [June 29, 2021, 5:32pm UTC](https://discourse.julialang.org/t/convex-jl-matrix-constraints-interface-how-can-i-supply-this-matrix/63753 "2021-06-29T17:32:36Z")

</div>

Hi, I want to constraint some matrix that is given as a linear functions of the variables to be semi-definite positive. However, I found something strange : function get\_hankels(s,a,b) m = length(s)-1 if iseven…

---

## [What happens if I set more threads than available?](https://discourse.julialang.org/t/what-happens-if-i-set-more-threads-than-available/63717)

<div class="topic-metadata">

**Author:** [@fredih](https://discourse.julialang.org/u/fredih)\
**Replies:** 2\
**Last updated:** [June 29, 2021, 3:06am UTC](https://discourse.julialang.org/t/what-happens-if-i-set-more-threads-than-available/63717 "2021-06-29T03:06:16Z")

</div>

My computer has 8 cores, so use set\_optimizer\_attribute(myModel, "threads", 8) before starting the optimization. What would happen if I use the exact same code on another computer that has, for example, 4 cores? The prog…

---

## [Eigenvectors from quadratic form of a low-rank matrix](https://discourse.julialang.org/t/eigenvectors-from-quadratic-form-of-a-low-rank-matrix/63715)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 2\
**Last updated:** [June 28, 2021, 10:07pm UTC](https://discourse.julialang.org/t/eigenvectors-from-quadratic-form-of-a-low-rank-matrix/63715 "2021-06-28T22:07:14Z")

</div>

Hello, I would like to compute the leading eigenvectors of a positive semi-definite matrix A with a low-rank structure. Are you aware of method that only rely on evaluations of y^\\top A x for arbitrary y, x vectors?

---

## [Help with constraints to select and/or insert columns to a matrix](https://discourse.julialang.org/t/help-with-constraints-to-select-and-or-insert-columns-to-a-matrix/63654)

<div class="topic-metadata">

**Author:** [@DrChainsaw](https://discourse.julialang.org/u/DrChainsaw)\
**Replies:** 3\
**Last updated:** [June 28, 2021, 10:48am UTC](https://discourse.julialang.org/t/help-with-constraints-to-select-and-or-insert-columns-to-a-matrix/63654 "2021-06-28T10:48:12Z")

</div>

I suppose this might be more of a generic MIP formulation question, but I’m not sure stackexchange would accept it and in here I can at least provide some almost working code using JuMP. Simple context free question is …

---

## [JuMP optimization with vector input and analytical gradient](https://discourse.julialang.org/t/jump-optimization-with-vector-input-and-analytical-gradient/63664)

<div class="topic-metadata">

**Author:** [@nicolas](https://discourse.julialang.org/u/nicolas)\
**Replies:** 5\
**Last updated:** [June 27, 2021, 10:58pm UTC](https://discourse.julialang.org/t/jump-optimization-with-vector-input-and-analytical-gradient/63664 "2021-06-27T22:58:11Z")

</div>

In JuMP’s manual, there are simple instructions to either optimize by providing an analytical gradient function or by providing a vector input with splatting: Nonlinear Modeling · JuMP. I have been trying to combine the …

---

## [Performance issues with matrix multiplication in JuMP](https://discourse.julialang.org/t/performance-issues-with-matrix-multiplication-in-jump/63564)

<div class="topic-metadata">

**Author:** [@Huy\_Nguyen](https://discourse.julialang.org/u/Huy_Nguyen)\
**Replies:** 3\
**Last updated:** [June 26, 2021, 1:32pm UTC](https://discourse.julialang.org/t/performance-issues-with-matrix-multiplication-in-jump/63564 "2021-06-26T13:32:46Z")

</div>

I am trying to do linear constraint optimisation as follows: model = Model(Tulip.Optimizer) # Set up variables @variable(model, x\[1:length(VecA)+length(VecB)\]) # set up linear constraints workingweights …

---

## [Understanding the results from Optim.jl for a black box function](https://discourse.julialang.org/t/understanding-the-results-from-optim-jl-for-a-black-box-function/63507)

<div class="topic-metadata">

**Author:** [@edwinb-ai](https://discourse.julialang.org/u/edwinb-ai)\
**Replies:** 15\
**Last updated:** [June 25, 2021, 10:19pm UTC](https://discourse.julialang.org/t/understanding-the-results-from-optim-jl-for-a-black-box-function/63507 "2021-06-25T22:19:37Z")

</div>

I’m using Optim.jl to solve an unconstrained minimization problem. In this particular problem I have a black-box function, which can take a long time on a single function evaluation. I don’t have access to gradient info…

---

## [How to record the optimization process when using the JuMP optimization package for optimization](https://discourse.julialang.org/t/how-to-record-the-optimization-process-when-using-the-jump-optimization-package-for-optimization/63124)

<div class="topic-metadata">

**Author:** [@til1](https://discourse.julialang.org/u/til1)\
**Replies:** 4\
**Last updated:** [June 25, 2021, 10:15pm UTC](https://discourse.julialang.org/t/how-to-record-the-optimization-process-when-using-the-jump-optimization-package-for-optimization/63124 "2021-06-25T22:15:16Z")

</div>

I want to know the result of each iteration of the independent variable and the target value. How can I get this information?

---

## [Gurobi license issue](https://discourse.julialang.org/t/gurobi-license-issue/36547)

<div class="topic-metadata">

**Author:** [@Nicolas\_Slosse](https://discourse.julialang.org/u/Nicolas_Slosse)\
**Replies:** 13\
**Last updated:** [June 23, 2021, 9:04pm UTC](https://discourse.julialang.org/t/gurobi-license-issue/36547 "2021-06-23T21:04:38Z")

</div>

Dear forum, I have installed a fresh version of Gurobi.jl and JuMP for Julia Version 1.3.1 on a linux server. When making call to Gurobi 9.0 from Julia, I bump on the following error message : ERROR: LoadError: Invali…

---

## [Bonmin + HSL?](https://discourse.julialang.org/t/bonmin-hsl/63338)

<div class="topic-metadata">

**Author:** [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Replies:** 8\
**Last updated:** [June 22, 2021, 11:20pm UTC](https://discourse.julialang.org/t/bonmin-hsl/63338 "2021-06-22T23:20:21Z")

</div>

Hi everyone, I’m trying to use the Bonmin solver with IPOPT+HSL. Can you take a look at the following example and let me know if there is anything that should be fixed? It works fine if I delete the linear\_solver option …

---

## [Pca question](https://discourse.julialang.org/t/pca-question/63337)

<div class="topic-metadata">

**Author:** [@Kevin\_25](https://discourse.julialang.org/u/Kevin_25)\
**Replies:** 2\
**Last updated:** [June 22, 2021, 9:32pm UTC](https://discourse.julialang.org/t/pca-question/63337 "2021-06-22T21:32:19Z")

</div>

I was wondering if there is a command or a way to produce the result of the “explained\_variance\_ratio\_” command from scikitlearn in order to plot it. Thanks.

---

## [The solution of Semidefinite Programming (SDP) violates the constraints](https://discourse.julialang.org/t/the-solution-of-semidefinite-programming-sdp-violates-the-constraints/63370)

<div class="topic-metadata">

**Author:** [@Sawyer\_Zhou](https://discourse.julialang.org/u/Sawyer_Zhou)\
**Replies:** 2\
**Last updated:** [June 22, 2021, 7:17pm UTC](https://discourse.julialang.org/t/the-solution-of-semidefinite-programming-sdp-violates-the-constraints/63370 "2021-06-22T19:17:55Z")

</div>

I try to solve a SDP, the result shows that the solution is feasible and optimal, but when I substitute the obtained solution back into the constraints, I find it violates many constraints. using JuMP, MosekTools, Linea…

---

## [Optimization on a manifold](https://discourse.julialang.org/t/optimization-on-a-manifold/59850)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 33\
**Last updated:** [June 21, 2021, 2:03pm UTC](https://discourse.julialang.org/t/optimization-on-a-manifold/59850 "2021-06-21T14:03:18Z")

</div>

This is both a conceptual question, and a practical one of what packages I could use to solve this. Problem statement I am trying to solve the following problem. Let a \\in \\mathbb{R}^M be a vector of parameters, and p \\…

---

## [Modeling sum of k-smallest eigenvalues of a symmetric matrix in JuMP](https://discourse.julialang.org/t/modeling-sum-of-k-smallest-eigenvalues-of-a-symmetric-matrix-in-jump/63245)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 2\
**Last updated:** [June 20, 2021, 7:59pm UTC](https://discourse.julialang.org/t/modeling-sum-of-k-smallest-eigenvalues-of-a-symmetric-matrix-in-jump/63245 "2021-06-20T19:59:15Z")

</div>

Dear All, I am trying to model the following convex constraint in JuMP: \\sum\_{i=1}^{k} \\lambda\_i(X) \\geq c, where X \\in \\mathbf{S}^n (a symmetric matrix), c is a constant, and \\lambda\_1(X) \\leq \\lambda\_2(X) \\leq \\ldot…

---

## [Constructing JuMP problems is surprisingly slow](https://discourse.julialang.org/t/constructing-jump-problems-is-surprisingly-slow/63114)

<div class="topic-metadata">

**Author:** [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Replies:** 5\
**Last updated:** [June 17, 2021, 10:29pm UTC](https://discourse.julialang.org/t/constructing-jump-problems-is-surprisingly-slow/63114 "2021-06-17T22:29:30Z")

</div>

I’m in a situation where I’d like to solve a lot of small nonlinear programming problems as quickly as possible. I’ve been surprised to find that JuMP model construction is much slower than I expected. I have a very smal…

---

## [The conflict of variables using @build\_constraint](https://discourse.julialang.org/t/the-conflict-of-variables-using-build-constraint/62998)

<div class="topic-metadata">

**Author:** [@BYS](https://discourse.julialang.org/u/BYS)\
**Replies:** 7\
**Last updated:** [June 17, 2021, 1:58am UTC](https://discourse.julialang.org/t/the-conflict-of-variables-using-build-constraint/62998 "2021-06-17T01:58:19Z")

</div>

Hi, If there are two models in my code model1=Model() @variable(model1,x\[1:5\]) model2=Model() @variable(model2,x\[1:5\]) If I use con=@build\_constraint(x\[1\]\<=1) the x\[1\] belongs to model1 or model2? Thanks in advance…

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

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