# Optimization (Mathematical)

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

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

**Page:** 48

---

## [Error with HiGHS independent parallel solves](https://discourse.julialang.org/t/error-with-highs-independent-parallel-solves/96048)

<div class="topic-metadata">

**Author:** [@Naunet](https://discourse.julialang.org/u/Naunet)\
**Replies:** 1\
**Last updated:** [March 14, 2023, 9:33pm UTC](https://discourse.julialang.org/t/error-with-highs-independent-parallel-solves/96048 "2023-03-14T21:33:04Z")

</div>

A parallel example using HiGHS was recently published here : Parallelism · JuMP However, when I change the model used to something that requires several iterations instead of just presolve it prints a bunch of Iteration…

---

## [Issue with memoization with JuMP for NLP when adding @NLObjective](https://discourse.julialang.org/t/issue-with-memoization-with-jump-for-nlp-when-adding-nlobjective/96033)

<div class="topic-metadata">

**Author:** [@YuriS](https://discourse.julialang.org/u/YuriS)\
**Replies:** 3\
**Last updated:** [March 14, 2023, 2:36am UTC](https://discourse.julialang.org/t/issue-with-memoization-with-jump-for-nlp-when-adding-nlobjective/96033 "2023-03-14T02:36:59Z")

</div>

Hello, I’ve been following this tutorial from JuMP on memorization for NLP via JuMP with user-defined, vector-output functions One issue I am having currently is that once I have a memorized function registered to the m…

---

## [How to obtain dual variables (shadow price) for a set of constraints](https://discourse.julialang.org/t/how-to-obtain-dual-variables-shadow-price-for-a-set-of-constraints/95986)

<div class="topic-metadata">

**Author:** [@kevinqiao](https://discourse.julialang.org/u/kevinqiao)\
**Replies:** 4\
**Last updated:** [March 14, 2023, 1:48am UTC](https://discourse.julialang.org/t/how-to-obtain-dual-variables-shadow-price-for-a-set-of-constraints/95986 "2023-03-14T01:48:46Z")

</div>

Hello, I have time-related constraints and I modeled it as for time in 1:nTime @constraint(model, a\[time\] + b\[time\] == c\[time\], base\_name = "cons" end The model is solved and I want to obtain the dual variables, …

---

## [Nonlinear optimization using JuMP, The solver does not support nonlinear problems (i.e., NLobjective and NLconstraint)](https://discourse.julialang.org/t/nonlinear-optimization-using-jump-the-solver-does-not-support-nonlinear-problems-i-e-nlobjective-and-nlconstraint/95978)

<div class="topic-metadata">

**Author:** [@mosby](https://discourse.julialang.org/u/mosby)\
**Replies:** 10\
**Last updated:** [March 13, 2023, 7:30pm UTC](https://discourse.julialang.org/t/nonlinear-optimization-using-jump-the-solver-does-not-support-nonlinear-problems-i-e-nlobjective-and-nlconstraint/95978 "2023-03-13T19:30:14Z")

</div>

I am solving a nonlinear optimization problem using Mosek, I am running the following script model = Model(Mosek.Optimizer) @variable(model, y\[1:n\]) @NLconstraint(model, sum((Ay-b)\[i\]^4 for i=1:m) \<= 1.0) # The constr…

---

## [Error in using KNITRO with JuMP](https://discourse.julialang.org/t/error-in-using-knitro-with-jump/95951)

<div class="topic-metadata">

**Author:** [@Rick](https://discourse.julialang.org/u/Rick)\
**Replies:** 6\
**Last updated:** [March 12, 2023, 9:51pm UTC](https://discourse.julialang.org/t/error-in-using-knitro-with-jump/95951 "2023-03-12T21:51:31Z")

</div>

Hi everyone, I have just updated my packages, then I am unable to use KNITRO.jl with JuMP anymore. The code I run is: using KNITRO, JuMP model = Model(KNITRO.Optimizer) Then, I get the following error: The provided …

---

## [Maximizing a term with barrier in JuMP](https://discourse.julialang.org/t/maximizing-a-term-with-barrier-in-jump/95884)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 7\
**Last updated:** [March 11, 2023, 5:39pm UTC](https://discourse.julialang.org/t/maximizing-a-term-with-barrier-in-jump/95884 "2023-03-11T17:39:01Z")

</div>

I’m sorry that the title isn’t clear enough; I promise to provide a suitable description with a minimal reproducible example. I want to optimize the following model to achieve the optimal set of w\_j (which is a vector): …

---

## [Constriant in ADNLPModels package](https://discourse.julialang.org/t/constriant-in-adnlpmodels-package/95832)

<div class="topic-metadata">

**Author:** [@X\_Chen](https://discourse.julialang.org/u/X_Chen)\
**Replies:** 4\
**Last updated:** [March 10, 2023, 8:29pm UTC](https://discourse.julialang.org/t/constriant-in-adnlpmodels-package/95832 "2023-03-10T20:29:09Z")

</div>

Hi everyone, I am trying to do a nonlinear optimization with six parameters using the ADNLModles package. For example: function constriants(para) cons=1-para\[1\]^2-para\[2\]^2-para\[3\]^2+2\*para\[1\]\*para\[2\]\*para\[3\] r…

---

## [JuMP/CPLEX: seemingly not all lazy cuts are respected](https://discourse.julialang.org/t/jump-cplex-seemingly-not-all-lazy-cuts-are-respected/95798)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 4\
**Last updated:** [March 10, 2023, 5:44pm UTC](https://discourse.julialang.org/t/jump-cplex-seemingly-not-all-lazy-cuts-are-respected/95798 "2023-03-10T17:44:41Z")

</div>

Dear folks, it seems that CPLEX sometimes does not respect all lazy cuts in the final solution. I know that there is no guarantee that it respects submitted cuts immediately, but it should do in the final solution afaik…

---

## [Help with nested optimization](https://discourse.julialang.org/t/help-with-nested-optimization/95453)

<div class="topic-metadata">

**Author:** [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Replies:** 18\
**Last updated:** [March 9, 2023, 10:28am UTC](https://discourse.julialang.org/t/help-with-nested-optimization/95453 "2023-03-09T10:28:11Z")

</div>

After a few weeks of thinking about this on and off with a lot of help from the good folks in Slack’s #math-optimization channel I’ve decided I don’t trust myself to come up with an optimal (no pun intended) solution to …

---

## [JuMP and Ipopt optimization: How to reduce run time for iterative optimization?](https://discourse.julialang.org/t/jump-and-ipopt-optimization-how-to-reduce-run-time-for-iterative-optimization/95684)

<div class="topic-metadata">

**Author:** [@codingfriend](https://discourse.julialang.org/u/codingfriend)\
**Replies:** 3\
**Last updated:** [March 8, 2023, 6:48pm UTC](https://discourse.julialang.org/t/jump-and-ipopt-optimization-how-to-reduce-run-time-for-iterative-optimization/95684 "2023-03-08T18:48:53Z")

</div>

Hi everyone! I am seeking help to speed up my code using JuMP and Ipopt. My current approach is too slow for my needs. :grinning: My original code looks something like this: ‘’‘julia for i = 1:N optimizer = optimizer…

---

## [\[ANN\] DataFitting.jl general purpose data fitting framework](https://discourse.julialang.org/t/ann-datafitting-jl-general-purpose-data-fitting-framework/8433)

<div class="topic-metadata">

**Author:** [@gcalderone](https://discourse.julialang.org/u/gcalderone)\
**Replies:** 25\
**Last updated:** [March 8, 2023, 10:40am UTC](https://discourse.julialang.org/t/ann-datafitting-jl-general-purpose-data-fitting-framework/8433 "2023-03-08T10:40:07Z")

</div>

Dear community, I’m happy to announce that the first working (and reasonably complete) version of the DataFitting.jl package is available on Github. The main purpose of DataFitting is to provide a general purpose data …

---

## [Efficient implementation of a convolution within a auto-differentiable objective function](https://discourse.julialang.org/t/efficient-implementation-of-a-convolution-within-a-auto-differentiable-objective-function/95616)

<div class="topic-metadata">

**Author:** [@mgreifenstein](https://discourse.julialang.org/u/mgreifenstein)\
**Replies:** 9\
**Last updated:** [March 8, 2023, 8:21am UTC](https://discourse.julialang.org/t/efficient-implementation-of-a-convolution-within-a-auto-differentiable-objective-function/95616 "2023-03-08T08:21:21Z")

</div>

Hi all, I have an optimization problem for which I am using JuMP with Ipopt at the moment. The objective function involves 7 convolutions of two vectors. These convolutions are at the moment the bottleneck in performanc…

---

## [Possible to save compiled GradientTape after compile in ReverseDiff](https://discourse.julialang.org/t/possible-to-save-compiled-gradienttape-after-compile-in-reversediff/95693)

<div class="topic-metadata">

**Author:** [@xxxxx](https://discourse.julialang.org/u/xxxxx)\
**Replies:** 8\
**Last updated:** [March 8, 2023, 12:38am UTC](https://discourse.julialang.org/t/possible-to-save-compiled-gradienttape-after-compile-in-reversediff/95693 "2023-03-08T00:38:25Z")

</div>

Hi, I was wondering if it would be possible to save the compiled GradientTape that is used in ReverseDiff.jl. Using the gradient example from the package, I’d like to save compiled\_f\_tape # some objective function t…

---

## [How to identify a constraint in JuMp?](https://discourse.julialang.org/t/how-to-identify-a-constraint-in-jump/95434)

<div class="topic-metadata">

**Author:** [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Replies:** 4\
**Last updated:** [March 7, 2023, 9:14pm UTC](https://discourse.julialang.org/t/how-to-identify-a-constraint-in-jump/95434 "2023-03-07T21:14:02Z")

</div>

Hi, I’m writing all constrained with a given name, as follows: @constraint(m, constraint\[j in 1:20\], sum(A\[j,i\]\*x\[i\] for i in 1:30) \<= b\[j\]) after runing the model, it returns Infeasibility row 'c11': 0 = 1. how ca…

---

## [Solver BARON with user-defined function in nonlinear constraint](https://discourse.julialang.org/t/solver-baron-with-user-defined-function-in-nonlinear-constraint/95663)

<div class="topic-metadata">

**Author:** [@naouess](https://discourse.julialang.org/u/naouess)\
**Replies:** 4\
**Last updated:** [March 7, 2023, 7:17pm UTC](https://discourse.julialang.org/t/solver-baron-with-user-defined-function-in-nonlinear-constraint/95663 "2023-03-07T19:17:18Z")

</div>

Hello dear Julia-community, I am having an issue in using BARON for a nonlinear optimization problem. The problem includes nonlinearities in the constraints with a registered user-defined function. I define the function…

---

## [JuMP - Nested Optimization with user defined functions](https://discourse.julialang.org/t/jump-nested-optimization-with-user-defined-functions/83199)

<div class="topic-metadata">

**Author:** [@jmcastro2109](https://discourse.julialang.org/u/jmcastro2109)\
**Replies:** 10\
**Last updated:** [March 6, 2023, 10:02pm UTC](https://discourse.julialang.org/t/jump-nested-optimization-with-user-defined-functions/83199 "2023-03-06T22:02:33Z")

</div>

Hi! I have a Nested Optimization problem that I am trying to solve using JuMP. Inside, I have a linear problem with power constraints where I use JuMP + Mosek to solve. Outside, I have a concave problem defined on a set…

---

## [Reuse a JuMP model with different solvers](https://discourse.julialang.org/t/reuse-a-jump-model-with-different-solvers/95629)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 3\
**Last updated:** [March 6, 2023, 8:09pm UTC](https://discourse.julialang.org/t/reuse-a-jump-model-with-different-solvers/95629 "2023-03-06T20:09:56Z")

</div>

Is there an efficient way to change the solver associated with a JuMP model? For example, I want to solve a model that takes a nontrivial amount of time to setup with a few different solvers. I am wondering if it is poss…

---

## [Registering user-defined functions in JuMP for mixed-integer non-linear programming](https://discourse.julialang.org/t/registering-user-defined-functions-in-jump-for-mixed-integer-non-linear-programming/95522)

<div class="topic-metadata">

**Author:** [@gmantegazza](https://discourse.julialang.org/u/gmantegazza)\
**Replies:** 4\
**Last updated:** [March 6, 2023, 5:13am UTC](https://discourse.julialang.org/t/registering-user-defined-functions-in-jump-for-mixed-integer-non-linear-programming/95522 "2023-03-06T05:13:56Z")

</div>

Hello everyone, I have been a Julia user for some years now and I really love JuMP, however I am finding particularly difficult setting up a NLobjective in a mixed-integer program with linear constraints which correspon…

---

## [Enzyme modifies my objective function after computing a gradient?](https://discourse.julialang.org/t/enzyme-modifies-my-objective-function-after-computing-a-gradient/95219)

<div class="topic-metadata">

**Author:** [@zornsllama](https://discourse.julialang.org/u/zornsllama)\
**Replies:** 3\
**Last updated:** [March 6, 2023, 3:14am UTC](https://discourse.julialang.org/t/enzyme-modifies-my-objective-function-after-computing-a-gradient/95219 "2023-03-06T03:14:06Z")

</div>

Hi, I’m trying to use Enzyme.jl to compute gradients for a nonlinear least squares objective function I’d like to optimize for data assimilation (to my understanding this is equivalent to what is known as weak 4DVar). T…

---

## [Issue with lazy constraints on Xpress](https://discourse.julialang.org/t/issue-with-lazy-constraints-on-xpress/95463)

<div class="topic-metadata">

**Author:** [@Diego](https://discourse.julialang.org/u/Diego)\
**Replies:** 4\
**Last updated:** [March 3, 2023, 8:56pm UTC](https://discourse.julialang.org/t/issue-with-lazy-constraints-on-xpress/95463 "2023-03-03T20:56:05Z")

</div>

Dear community, I am giving a try to Lazy Constraints and can make a very simple case run with Xpress, however, there is not an issue at all with GLPK. Can you please have a look and let us know where the problem is? T…

---

## [Example for solving a QP (or LP) in Gurobi directly (without JuMP)](https://discourse.julialang.org/t/example-for-solving-a-qp-or-lp-in-gurobi-directly-without-jump/94108)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 12\
**Last updated:** [March 2, 2023, 1:21am UTC](https://discourse.julialang.org/t/example-for-solving-a-qp-or-lp-in-gurobi-directly-without-jump/94108 "2023-03-02T01:21:55Z")

</div>

Similar to this question, I am wondering if anyone has example Julia code that they would be willing to share for how to pass vectors and matrices directly into Gurobi.jl to construct/solve a model. The Gurobi C interfac…

---

## [JuMP: Control automatic differentiation of user defined function](https://discourse.julialang.org/t/jump-control-automatic-differentiation-of-user-defined-function/95380)

<div class="topic-metadata">

**Author:** [@mgreifenstein](https://discourse.julialang.org/u/mgreifenstein)\
**Replies:** 4\
**Last updated:** [March 1, 2023, 8:33pm UTC](https://discourse.julialang.org/t/jump-control-automatic-differentiation-of-user-defined-function/95380 "2023-03-01T20:33:54Z")

</div>

Hi all, I am currently working on a code that is supposed to fit a model to experimental coherent Anti-Stokes Raman spectra which has about 9 decision variables, depending on the case. Because the computations in this m…

---

## [JuMP/Gurobi: optimize! returns INFEASIBLE, but there is feasible point](https://discourse.julialang.org/t/jump-gurobi-optimize-returns-infeasible-but-there-is-feasible-point/95019)

<div class="topic-metadata">

**Author:** [@Ethan-Russell](https://discourse.julialang.org/u/Ethan-Russell)\
**Replies:** 12\
**Last updated:** [March 1, 2023, 2:30pm UTC](https://discourse.julialang.org/t/jump-gurobi-optimize-returns-infeasible-but-there-is-feasible-point/95019 "2023-03-01T14:30:13Z")

</div>

I am solving a very large (\>1M variables) linear program with Gurobi. After 3 hours, Gurobi returns with status INFEASIBLE. However, if I run primal\_feasibility\_report with all variables being zero, it returns an empty…

---

## [Issues with broadcasting min and max operators to matrixes in JuMP expression](https://discourse.julialang.org/t/issues-with-broadcasting-min-and-max-operators-to-matrixes-in-jump-expression/95385)

<div class="topic-metadata">

**Author:** [@templenash](https://discourse.julialang.org/u/templenash)\
**Replies:** 1\
**Last updated:** [March 1, 2023, 1:20pm UTC](https://discourse.julialang.org/t/issues-with-broadcasting-min-and-max-operators-to-matrixes-in-jump-expression/95385 "2023-03-01T13:20:13Z")

</div>

Hello, New to JuMP and trying to implement a matrix-based expression in JuMP that uses min and max operators broadcasted to the vector. Having trouble getting the min and max operators working in the ‘tx’ expression, wa…

---

## [There could be better error messages for @constraints macro](https://discourse.julialang.org/t/there-could-be-better-error-messages-for-constraints-macro/95293)

<div class="topic-metadata">

**Author:** [@Charlie\_Ruppe](https://discourse.julialang.org/u/Charlie_Ruppe)\
**Replies:** 7\
**Last updated:** [March 1, 2023, 2:43am UTC](https://discourse.julialang.org/t/there-could-be-better-error-messages-for-constraints-macro/95293 "2023-03-01T02:43:21Z")

</div>

I believe it would be good to add to the error messages for the @constraints macro, to draw attention to the fact that a valid input for @constraint is not a valid input for @constraints. This is a mistake that is easy t…

---

## [Deleting a container of constraints](https://discourse.julialang.org/t/deleting-a-container-of-constraints/95257)

<div class="topic-metadata">

**Author:** [@A\_M](https://discourse.julialang.org/u/A_M)\
**Replies:** 3\
**Last updated:** [February 27, 2023, 11:10pm UTC](https://discourse.julialang.org/t/deleting-a-container-of-constraints/95257 "2023-02-27T23:10:08Z")

</div>

I am trying to remove a container of constraints after solving it to add a new set of constraints before resolving it: @constraint(model, A\[s=1:n\], x\[s\] == y\[s\]) I tried for s in 1:n delete(model, A\[s\]) end or del…

---

## [Error when constraining variable to be Hermitian PSD](https://discourse.julialang.org/t/error-when-constraining-variable-to-be-hermitian-psd/95223)

<div class="topic-metadata">

**Author:** [@araujoms](https://discourse.julialang.org/u/araujoms)\
**Replies:** 12\
**Last updated:** [February 27, 2023, 10:50pm UTC](https://discourse.julialang.org/t/error-when-constraining-variable-to-be-hermitian-psd/95223 "2023-02-27T22:50:41Z")

</div>

I’m writing an SDP for a traditional problem in quantum information, state discrimination. When I constrain the variables to real symmetric, it works. But the problem really needs them to be complex Hermitian. The code i…

---

## [Naming variable bound and integrality constraints in Jump](https://discourse.julialang.org/t/naming-variable-bound-and-integrality-constraints-in-jump/95270)

<div class="topic-metadata">

**Author:** [@Di11on](https://discourse.julialang.org/u/Di11on)\
**Replies:** 2\
**Last updated:** [February 27, 2023, 7:03pm UTC](https://discourse.julialang.org/t/naming-variable-bound-and-integrality-constraints-in-jump/95270 "2023-02-27T19:03:12Z")

</div>

Diagnosing an infeasible model can be tricky. Sometimes solvers provide useful information like conflict reports and the constraints involved in the infeasibility - for these to be useful, we have to be able to relate th…

---

## [JuMP Support for solver specific methods to create fixed MIP](https://discourse.julialang.org/t/jump-support-for-solver-specific-methods-to-create-fixed-mip/94775)

<div class="topic-metadata">

**Author:** [@Di11on](https://discourse.julialang.org/u/Di11on)\
**Replies:** 5\
**Last updated:** [February 27, 2023, 6:56pm UTC](https://discourse.julialang.org/t/jump-support-for-solver-specific-methods-to-create-fixed-mip/94775 "2023-02-27T18:56:14Z")

</div>

It seems that a very common requirement is to get duals from a MIP problem. The traditional way of doing this is to relax the integer variables in the problem and fix them to their MIP solution and obtain the duals from …

---

## [JuMP Empty Constraint when using SumOfSquares](https://discourse.julialang.org/t/jump-empty-constraint-when-using-sumofsquares/95208)

<div class="topic-metadata">

**Author:** [@Kevin\_Shu](https://discourse.julialang.org/u/Kevin_Shu)\
**Replies:** 5\
**Last updated:** [February 27, 2023, 9:49am UTC](https://discourse.julialang.org/t/jump-empty-constraint-when-using-sumofsquares/95208 "2023-02-27T09:49:29Z")

</div>

Hello, I’m trying to find some sum of squares representation for some polynomials, but I have been receiving some errors. Here is a shortened version of this code that gives this error: using TypedPolynomials using Co…

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

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