# Optimization (Mathematical)

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

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

**Page:** 58

---

## [Issues with PSO within Optim.jl](https://discourse.julialang.org/t/issues-with-pso-within-optim-jl/86638)

<div class="topic-metadata">

**Author:** [@NTmuir](https://discourse.julialang.org/u/NTmuir)\
**Replies:** 0\
**Last updated:** [September 1, 2022, 11:56am UTC](https://discourse.julialang.org/t/issues-with-pso-within-optim-jl/86638 "2022-09-01T11:56:17Z")

</div>

Hi there, I am fairly new to Julia and I am struggling to get a PSO to work within Optim.jl, I am using PETLION which is physical based battery simulation tool to get voltage data while changing a single physical parame…

---

## [How to save nonlinear JuMP model to file?](https://discourse.julialang.org/t/how-to-save-nonlinear-jump-model-to-file/86322)

<div class="topic-metadata">

**Author:** [@a6a3uh](https://discourse.julialang.org/u/a6a3uh)\
**Replies:** 21\
**Last updated:** [August 31, 2022, 11:13am UTC](https://discourse.julialang.org/t/how-to-save-nonlinear-jump-model-to-file/86322 "2022-08-31T11:13:37Z")

</div>

Is it unsupported feature yet? Ivoking write\_to\_file I get: ERROR: MathOptInterface.UnsupportedAttribute{MathOptInterface.NLPBlock}: Attribute MathOptInterface.NLPBlock() is not supported by the model. Could someone p…

---

## [Error : no method matching getindex](https://discourse.julialang.org/t/error-no-method-matching-getindex/86537)

<div class="topic-metadata">

**Author:** [@Eric.O](https://discourse.julialang.org/u/Eric.O)\
**Replies:** 4\
**Last updated:** [August 31, 2022, 10:33am UTC](https://discourse.julialang.org/t/error-no-method-matching-getindex/86537 "2022-08-31T10:33:44Z")

</div>

I have my code displaying the objective function with the constraints but the final answer is not reflecting. I always get the error " No method matching getindex". I look through the work severally but am not able to r…

---

## [User cut with JuMP and Gurobi](https://discourse.julialang.org/t/user-cut-with-jump-and-gurobi/86518)

<div class="topic-metadata">

**Author:** [@Luiz\_Monteiro](https://discourse.julialang.org/u/Luiz_Monteiro)\
**Replies:** 1\
**Last updated:** [August 29, 2022, 11:18pm UTC](https://discourse.julialang.org/t/user-cut-with-jump-and-gurobi/86518 "2022-08-29T23:18:57Z")

</div>

Hi, I am trying to insert user cuts in a mixed-integer linear programming model (Location-routing problem). I’m using the sintax presented in JuMP documentation (Callbacks · JuMP), and model in direct mode (model1 = dir…

---

## [How to multiply matrices with different structure?](https://discourse.julialang.org/t/how-to-multiply-matrices-with-different-structure/86428)

<div class="topic-metadata">

**Author:** [@ivzktch99](https://discourse.julialang.org/u/ivzktch99)\
**Replies:** 2\
**Last updated:** [August 28, 2022, 9:42pm UTC](https://discourse.julialang.org/t/how-to-multiply-matrices-with-different-structure/86428 "2022-08-28T21:42:10Z")

</div>

I am defining a variable X as a lower trianglar matrix (to reduce the number of variables). How can I multiply it with another dense matrix Y? The following gives me an error using JuMP using LinearAlgebra model = Mode…

---

## [Problem with MathOptInterface.jl @ 1.7.0](https://discourse.julialang.org/t/problem-with-mathoptinterface-jl-1-7-0/86450)

<div class="topic-metadata">

**Author:** [@lionisxn](https://discourse.julialang.org/u/lionisxn)\
**Replies:** 5\
**Last updated:** [August 28, 2022, 11:29am UTC](https://discourse.julialang.org/t/problem-with-mathoptinterface-jl-1-7-0/86450 "2022-08-28T11:29:04Z")

</div>

Does anyone encounter a crash on Julia 1.8.0 when using the latest version JuMP.jl and MathOptInterface.jl @ 1.7.0? The following pop-up messages are displayed on my computer running windows 11. However, when switched t…

---

## [Optimiser to get the best selection of a set of penalty values](https://discourse.julialang.org/t/optimiser-to-get-the-best-selection-of-a-set-of-penalty-values/86376)

<div class="topic-metadata">

**Author:** [@ayodyas](https://discourse.julialang.org/u/ayodyas)\
**Replies:** 5\
**Last updated:** [August 26, 2022, 11:48pm UTC](https://discourse.julialang.org/t/optimiser-to-get-the-best-selection-of-a-set-of-penalty-values/86376 "2022-08-26T23:48:31Z")

</div>

I have an optimisation model in Julia using Jump model and Cbc optimiser. The model is highly dependent on the initial inputs. What will be best method to select the initial input such that, the error penalty in the orig…

---

## [Obtaining sub-optimal results from the model when the time limit is reached](https://discourse.julialang.org/t/obtaining-sub-optimal-results-from-the-model-when-the-time-limit-is-reached/85635)

<div class="topic-metadata">

**Author:** [@AAAG](https://discourse.julialang.org/u/AAAG)\
**Replies:** 11\
**Last updated:** [August 26, 2022, 8:47pm UTC](https://discourse.julialang.org/t/obtaining-sub-optimal-results-from-the-model-when-the-time-limit-is-reached/85635 "2022-08-26T20:47:02Z")

</div>

Hi, I am working on a model that includes both linear and non-linear constraints. I am using Ipopt and Juniper solvers for my model. What I am trying to do is to limit the time of the model and obtain the sub-optimal s…

---

## [Parameter Estimation of ODE system where the response variables are not the state variables](https://discourse.julialang.org/t/parameter-estimation-of-ode-system-where-the-response-variables-are-not-the-state-variables/86171)

<div class="topic-metadata">

**Author:** [@jonlym](https://discourse.julialang.org/u/jonlym)\
**Replies:** 8\
**Last updated:** [August 26, 2022, 12:46pm UTC](https://discourse.julialang.org/t/parameter-estimation-of-ode-system-where-the-response-variables-are-not-the-state-variables/86171 "2022-08-26T12:46:50Z")

</div>

I am new to Julia and I would like to write a program to estimate the kinetic parameters for a chemical system. I am aware of Catalyst.jl but my work involves systems with complex geometries so I often have to modify my …

---

## [Problem setting the Local Optimizer](https://discourse.julialang.org/t/problem-setting-the-local-optimizer/86257)

<div class="topic-metadata">

**Author:** [@Yagiz\_Dereboy](https://discourse.julialang.org/u/Yagiz_Dereboy)\
**Replies:** 4\
**Last updated:** [August 26, 2022, 6:56am UTC](https://discourse.julialang.org/t/problem-setting-the-local-optimizer/86257 "2022-08-26T06:56:24Z")

</div>

I have problem with the Augmented Lagrangian Method. With my syntax algorithm does not move and gets a forced stop. I am almost sure problem is with the setting of the local optimizer. I am not very familiar with the Jul…

---

## [BilevelJuMP: Setting start values for lower level dual variables in ProductMode()](https://discourse.julialang.org/t/bileveljump-setting-start-values-for-lower-level-dual-variables-in-productmode/86272)

<div class="topic-metadata">

**Author:** [@LukasBarner](https://discourse.julialang.org/u/LukasBarner)\
**Replies:** 4\
**Last updated:** [August 26, 2022, 12:41am UTC](https://discourse.julialang.org/t/bileveljump-setting-start-values-for-lower-level-dual-variables-in-productmode/86272 "2022-08-26T00:41:06Z")

</div>

Hi everyone, I have started to use BilevelJuMP and I’m really beginning to enjoy its flexibility! I’m trying to solve a larger scale calibration problem, where the lower level is a QP with affine (in-)equality constrai…

---

## [Efficient way to restrict the domain of variables?](https://discourse.julialang.org/t/efficient-way-to-restrict-the-domain-of-variables/86314)

<div class="topic-metadata">

**Author:** [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Replies:** 1\
**Last updated:** [August 25, 2022, 7:38pm UTC](https://discourse.julialang.org/t/efficient-way-to-restrict-the-domain-of-variables/86314 "2022-08-25T19:38:09Z")

</div>

Which one is more efficient in term of computational time? (I’m looking forward to read a general answer, but below is a simple example to describe the situation) Suppose you have a large network (over 1K nodes and 10K …

---

## [Error using CPXcallbackgetrelaxationpoint at CPLEX.jl solver specifc callback](https://discourse.julialang.org/t/error-using-cpxcallbackgetrelaxationpoint-at-cplex-jl-solver-specifc-callback/86230)

<div class="topic-metadata">

**Author:** [@afazevedo](https://discourse.julialang.org/u/afazevedo)\
**Replies:** 2\
**Last updated:** [August 25, 2022, 2:55pm UTC](https://discourse.julialang.org/t/error-using-cpxcallbackgetrelaxationpoint-at-cplex-jl-solver-specifc-callback/86230 "2022-08-25T14:55:24Z")

</div>

Hey guys, you know how I get this right? I’m getting an error on “CPXcallbackgetrelaxationpoint” call on CPLEX solver-specific callback. Here’s a example: using JuMP, CPLEX, Test cb\_calls = Clong\[\] function my\_callba…

---

## [MethodError: no method matching ^(::VariableRef, ::Vector{VariableRef})](https://discourse.julialang.org/t/methoderror-no-method-matching-variableref-vector-variableref/86299)

<div class="topic-metadata">

**Author:** [@Eric.O](https://discourse.julialang.org/u/Eric.O)\
**Replies:** 6\
**Last updated:** [August 25, 2022, 4:25am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-variableref-vector-variableref/86299 "2022-08-25T04:25:18Z")

</div>

Please I need help to get this code running. I am using mosek to solve this optimization problem but I keep getting errors. I tried correcting it severally but I keep getting the error " no method matching ^ ". I will be…

---

## [Optimizing a 2 parameter simple ODE](https://discourse.julialang.org/t/optimizing-a-2-parameter-simple-ode/86290)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 1\
**Last updated:** [August 25, 2022, 3:22am UTC](https://discourse.julialang.org/t/optimizing-a-2-parameter-simple-ode/86290 "2022-08-25T03:22:13Z")

</div>

I am having trouble understanding the results of code that optimizes a two parameter ODE. using DifferentialEquations using DiffEqParamEstim using Optim data = \[3140, 3232, 3488, 3415, 3192, 3265, 2961, 3548, 4269, 468…

---

## [Stop Criteria using JuMP with Gurobi when find the first feasible solution](https://discourse.julialang.org/t/stop-criteria-using-jump-with-gurobi-when-find-the-first-feasible-solution/86262)

<div class="topic-metadata">

**Author:** [@Luiz\_Monteiro](https://discourse.julialang.org/u/Luiz_Monteiro)\
**Replies:** 3\
**Last updated:** [August 25, 2022, 12:12am UTC](https://discourse.julialang.org/t/stop-criteria-using-jump-with-gurobi-when-find-the-first-feasible-solution/86262 "2022-08-25T00:12:02Z")

</div>

Hello! I have a MILP problem and I am using Gurobi solver through JuMP in Julia Language. I want to stop the model run when the solver find the first feasible solution. Is there a way to set the stop criteria with this c…

---

## [Constraint to hold on some region](https://discourse.julialang.org/t/constraint-to-hold-on-some-region/86261)

<div class="topic-metadata">

**Author:** [@irezvyakova](https://discourse.julialang.org/u/irezvyakova)\
**Replies:** 5\
**Last updated:** [August 24, 2022, 9:53pm UTC](https://discourse.julialang.org/t/constraint-to-hold-on-some-region/86261 "2022-08-24T21:53:06Z")

</div>

Hi, I am solving an optimization problem of the following interface: find max A such that x^A + y \< = 100 for all 0 \<= x \<= y \<= 1 How can I write the following type of constraint in JuMP? And how it is better to de…

---

## [Latest recommendations for global optimization](https://discourse.julialang.org/t/latest-recommendations-for-global-optimization/17718)

<div class="topic-metadata">

**Author:** [@davidzentlermunro](https://discourse.julialang.org/u/davidzentlermunro)\
**Replies:** 92\
**Last updated:** [August 23, 2022, 12:29pm UTC](https://discourse.julialang.org/t/latest-recommendations-for-global-optimization/17718 "2022-08-23T12:29:08Z")

</div>

What are people’s recommendations for a global optimizer? I’m trying to do simulated method of moments (choosing a set of parameters for an economic model to minimise the distance between model predictions and data) and …

---

## [Nonlinear programming function calls involving sine and cosine](https://discourse.julialang.org/t/nonlinear-programming-function-calls-involving-sine-and-cosine/86153)

<div class="topic-metadata">

**Author:** [@sky](https://discourse.julialang.org/u/sky)\
**Replies:** 1\
**Last updated:** [August 22, 2022, 9:22pm UTC](https://discourse.julialang.org/t/nonlinear-programming-function-calls-involving-sine-and-cosine/86153 "2022-08-22T21:22:01Z")

</div>

Dear all, I’m trying to build a nonlinear optimization problem and solve it by Ipopt. I have the following code using MosekTools using JuMP using Ipopt model = Model(Ipopt.Optimizer) @variable(model,x1) cons = \[ (x…

---

## [Network flow problem in JuMP](https://discourse.julialang.org/t/network-flow-problem-in-jump/86108)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 3\
**Last updated:** [August 22, 2022, 2:18am UTC](https://discourse.julialang.org/t/network-flow-problem-in-jump/86108 "2022-08-22T02:18:53Z")

</div>

Dear all, I have the shortest path problem coded in JuMP as follows: using JuMP import HiGHS import LinearAlgebra G = \[ 0 100 30 0 0 0 0 20 0 0 0 0 0 10 60 0 15 0 0 50 0 0 0 0 0 \] n = size(G)\[1\] s…

---

## [Optimization crashes Julia 1.8](https://discourse.julialang.org/t/optimization-crashes-julia-1-8/86050)

<div class="topic-metadata">

**Author:** [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)\
**Replies:** 1\
**Last updated:** [August 20, 2022, 2:48am UTC](https://discourse.julialang.org/t/optimization-crashes-julia-1-8/86050 "2022-08-20T02:48:42Z")

</div>

The issue description is here: Does anybody see something like it? Any idea? Thanks!

---

## [Automatic differentiation with subset of parameters in ModelingToolkit](https://discourse.julialang.org/t/automatic-differentiation-with-subset-of-parameters-in-modelingtoolkit/85917)

<div class="topic-metadata">

**Author:** [@Antomek](https://discourse.julialang.org/u/Antomek)\
**Replies:** 6\
**Last updated:** [August 19, 2022, 1:01pm UTC](https://discourse.julialang.org/t/automatic-differentiation-with-subset-of-parameters-in-modelingtoolkit/85917 "2022-08-19T13:01:09Z")

</div>

Hello, I am building a large ODESystem using ModelingToolkit, on which I’d like to use automatic differentiation. Because it is large, there are many parameters, resulting from the many subsystems. However, I want to…

---

## [Automatically generated API and Frontend for a JuMP model](https://discourse.julialang.org/t/automatically-generated-api-and-frontend-for-a-jump-model/85333)

<div class="topic-metadata">

**Author:** [@merrickj](https://discourse.julialang.org/u/merrickj)\
**Replies:** 4\
**Last updated:** [August 18, 2022, 10:28am UTC](https://discourse.julialang.org/t/automatically-generated-api-and-frontend-for-a-jump-model/85333 "2022-08-18T10:28:37Z")

</div>

Dear JuMP community, We would like to share with you MOS, software that automatically generates an API and Frontend for an annotated optimization model: MOS Software Documentation — MOS documentation There are instruct…

---

## [Generate Variables JuMP](https://discourse.julialang.org/t/generate-variables-jump/85900)

<div class="topic-metadata">

**Author:** [@Yuri\_Mizusawa](https://discourse.julialang.org/u/Yuri_Mizusawa)\
**Replies:** 3\
**Last updated:** [August 18, 2022, 1:58am UTC](https://discourse.julialang.org/t/generate-variables-jump/85900 "2022-08-18T01:58:07Z")

</div>

Hi, I’m not sure if I had to make a new post or continue the old one, but as I have a new question I created a new topic. I am solving an optimization problem with jump using the following table: Row │ time room\_1 …

---

## [JuMP @Variable](https://discourse.julialang.org/t/jump-variable/85853)

<div class="topic-metadata">

**Author:** [@Yuri\_Mizusawa](https://discourse.julialang.org/u/Yuri_Mizusawa)\
**Replies:** 2\
**Last updated:** [August 17, 2022, 11:05pm UTC](https://discourse.julialang.org/t/jump-variable/85853 "2022-08-17T23:05:15Z")

</div>

Hi, I am solving an optimization problem with jump using the following table: Row │ time room\_1 room\_2 room\_3 w\_day │ Float64 Float64 Float64 Float64 String ─────┼────────────────────────────────…

---

## [How is Optim.jl's IPNewton so good compared to (exponentiated) gradient descent?](https://discourse.julialang.org/t/how-is-optim-jls-ipnewton-so-good-compared-to-exponentiated-gradient-descent/85685)

<div class="topic-metadata">

**Author:** [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Replies:** 4\
**Last updated:** [August 17, 2022, 9:27pm UTC](https://discourse.julialang.org/t/how-is-optim-jls-ipnewton-so-good-compared-to-exponentiated-gradient-descent/85685 "2022-08-17T21:27:45Z")

</div>

This question is about implementing an optimization algorithm in Julia and comparing it with IPNewton from Optim.jl. It’s kind of broad, so not sure if it fits here. Let me know if it doesn’t. I wrote some code to minim…

---

## [How to correctly track optimization loss value with callback using particle swarm?](https://discourse.julialang.org/t/how-to-correctly-track-optimization-loss-value-with-callback-using-particle-swarm/85799)

<div class="topic-metadata">

**Author:** [@thompsonmj](https://discourse.julialang.org/u/thompsonmj)\
**Replies:** 1\
**Last updated:** [August 17, 2022, 4:02am UTC](https://discourse.julialang.org/t/how-to-correctly-track-optimization-loss-value-with-callback-using-particle-swarm/85799 "2022-08-17T04:02:30Z")

</div>

I’d like to track loss values in a particle swarm optimization with a callback, but I’m not sure where exactly the loss numbers being tracked in the callback are coming from. Comparing the trace printed by the optimizer…

---

## [JuMPing with Unitful?](https://discourse.julialang.org/t/jumping-with-unitful/85839)

<div class="topic-metadata">

**Author:** [@bcon](https://discourse.julialang.org/u/bcon)\
**Replies:** 3\
**Last updated:** [August 16, 2022, 9:04pm UTC](https://discourse.julialang.org/t/jumping-with-unitful/85839 "2022-08-16T21:04:04Z")

</div>

The function I would like to optimize uses Unitful variables in its internal calculations, but when optimizing I receive MethodError: no method matching \_float(::Quantity{Int64, 𝐋, Unitful.FreeUnits{(mm,), 𝐋, nothing}}),…

---

## [ANN: upcoming refactoring of JuMP's nonlinear API](https://discourse.julialang.org/t/ann-upcoming-refactoring-of-jumps-nonlinear-api/83052)

<div class="topic-metadata">

**Author:** [@odow](https://discourse.julialang.org/u/odow)\
**Replies:** 9\
**Last updated:** [August 16, 2022, 8:24am UTC](https://discourse.julialang.org/t/ann-upcoming-refactoring-of-jumps-nonlinear-api/83052 "2022-08-16T08:24:23Z")

</div>

tl;dr: The next feature release of JuMP (probably v1.2.0) introduces a large refactoring of JuMP’s nonlinear API. If you have code that accessed private features of the nonlinear API, such as JuMP.\_Derivatives or mode…

---

## [User defined objective function from external pkl file](https://discourse.julialang.org/t/user-defined-objective-function-from-external-pkl-file/85759)

<div class="topic-metadata">

**Author:** [@chenr86](https://discourse.julialang.org/u/chenr86)\
**Replies:** 4\
**Last updated:** [August 15, 2022, 6:30pm UTC](https://discourse.julialang.org/t/user-defined-objective-function-from-external-pkl-file/85759 "2022-08-15T18:30:04Z")

</div>

Hello, I have a complex function wrapped in a pkl file and I want to use to define my objective function. Here is a small example that I want to realize and the problem I meet: using JuMP using PyCall py""" import pic…

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

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