# Optimization (Mathematical)

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

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

**Page:** 25

---

## [JuMP - constraint for specific indices](https://discourse.julialang.org/t/jump-constraint-for-specific-indices/115550)

<div class="topic-metadata">

**Author:** [@priantop](https://discourse.julialang.org/u/priantop)\
**Replies:** 4\
**Last updated:** [June 12, 2024, 2:17pm UTC](https://discourse.julialang.org/t/jump-constraint-for-specific-indices/115550 "2024-06-12T14:17:08Z")

</div>

Hello, I am formulating LP problem using JuMP for energy system one of the constraints is the nodal electricity balance, say I have indices of node, time, and technologies How do I make a certain expression valid for …

---

## [Powell's Line Search Algorithm in Julia](https://discourse.julialang.org/t/powells-line-search-algorithm-in-julia/115459)

<div class="topic-metadata">

**Author:** [@TimOb](https://discourse.julialang.org/u/TimOb)\
**Replies:** 5\
**Last updated:** [June 11, 2024, 1:18pm UTC](https://discourse.julialang.org/t/powells-line-search-algorithm-in-julia/115459 "2024-06-11T13:18:15Z")

</div>

I’m looking for a Julia implementation of Powell’s line search algorithm. It’s essentially this algorithm from Scipy: https://docs.scipy.org/doc/scipy/reference/optimize.minimize-powell.html which is similar to the alg…

---

## [Huge increase in variables/constraints with Convex.jl](https://discourse.julialang.org/t/huge-increase-in-variables-constraints-with-convex-jl/115330)

<div class="topic-metadata">

**Author:** [@FriesischScott](https://discourse.julialang.org/u/FriesischScott)\
**Replies:** 8\
**Last updated:** [June 11, 2024, 12:40pm UTC](https://discourse.julialang.org/t/huge-increase-in-variables-constraints-with-convex-jl/115330 "2024-06-11T12:40:32Z")

</div>

I am new to Convex.jl and DCP in general. I am currently working on a convex optimization problem that involves 27 variables constrained to be non-negative. I have formulated the problem in Convex and it shows thefollow…

---

## [Programmatically fixing variables with near-zero coefficients to zero in JuMP](https://discourse.julialang.org/t/programmatically-fixing-variables-with-near-zero-coefficients-to-zero-in-jump/115452)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 6\
**Last updated:** [June 11, 2024, 8:32am UTC](https://discourse.julialang.org/t/programmatically-fixing-variables-with-near-zero-coefficients-to-zero-in-jump/115452 "2024-06-11T08:32:18Z")

</div>

In JuMP, is there a way to programmatically fix the variables, that have zero or near-zero multiplicative coefficients, to zero? A simple toy example (where it is very easy to compute the coefficients) that shows what I …

---

## [Mismatch in the cost function in MOSEK with Convex.jl](https://discourse.julialang.org/t/mismatch-in-the-cost-function-in-mosek-with-convex-jl/115374)

<div class="topic-metadata">

**Author:** [@CaG21](https://discourse.julialang.org/u/CaG21)\
**Replies:** 4\
**Last updated:** [June 11, 2024, 12:22am UTC](https://discourse.julialang.org/t/mismatch-in-the-cost-function-in-mosek-with-convex-jl/115374 "2024-06-11T00:22:02Z")

</div>

I am using Convex.jl and MOSEK to solve a mixed integer second-order cone programming problem. The cost function is encoded as minimize(-x + μ \* sum(abs.(v)) - a \* sum(γ)) where x (real value), v (real vector), and γ …

---

## [NLOPT forced stop with two constraints](https://discourse.julialang.org/t/nlopt-forced-stop-with-two-constraints/115371)

<div class="topic-metadata">

**Author:** [@mary](https://discourse.julialang.org/u/mary)\
**Replies:** 3\
**Last updated:** [June 9, 2024, 12:06am UTC](https://discourse.julialang.org/t/nlopt-forced-stop-with-two-constraints/115371 "2024-06-09T00:06:51Z")

</div>

Hi I am using NLOPT with two inequality constraints. It can do the optmization when I suppress the second constraint but with two constraints it stops after 1st iteration with forced stop. I also run objective function …

---

## [Multi-core parallel support for JuMP supported solvers?](https://discourse.julialang.org/t/multi-core-parallel-support-for-jump-supported-solvers/112392)

<div class="topic-metadata">

**Author:** [@charshaw](https://discourse.julialang.org/u/charshaw)\
**Replies:** 26\
**Last updated:** [May 8, 2024, 9:38am UTC](https://discourse.julialang.org/t/multi-core-parallel-support-for-jump-supported-solvers/112392 "2024-05-08T09:38:02Z")

</div>

I am looking for advice on how to enable solver parallelization when using JuMP on a high performance computing cluster. I have read this very informative page, but it is mostly about running many JuMP models in parallel…

---

## [How to maximize a scalar function of a scalar argument?](https://discourse.julialang.org/t/how-to-maximize-a-scalar-function-of-a-scalar-argument/115318)

<div class="topic-metadata">

**Author:** [@homocomputeris](https://discourse.julialang.org/u/homocomputeris)\
**Replies:** 1\
**Last updated:** [June 7, 2024, 12:24pm UTC](https://discourse.julialang.org/t/how-to-maximize-a-scalar-function-of-a-scalar-argument/115318 "2024-06-07T12:24:53Z")

</div>

I want to maximize a scala function, say NMaximize\[{1/(x - 1), -10 \< x \< 0}, {x}\] I tried: module test using Optimization, OptimizationOptimJL, NonlinearSolve function f(x, p) return 1 / (x - 1) end u0 = -0.5 p …

---

## [JuMP write\_to\_file: Writing legacy model to file is much smaller](https://discourse.julialang.org/t/jump-write-to-file-writing-legacy-model-to-file-is-much-smaller/115299)

<div class="topic-metadata">

**Author:** [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Replies:** 7\
**Last updated:** [June 7, 2024, 12:57am UTC](https://discourse.julialang.org/t/jump-write-to-file-writing-legacy-model-to-file-is-much-smaller/115299 "2024-06-07T00:57:40Z")

</div>

I construct a model for a nonlinear optimization problem in the Julia JuMP code below, using either the non-legacy (use\_legacy\_model = false) or legacy (use\_legacy\_model = true) model interface and save the model to a .n…

---

## [How to determine which variables are fixed to 0 or 1 in a node of a branch and bound tree using CPLEX.jl?](https://discourse.julialang.org/t/how-to-determine-which-variables-are-fixed-to-0-or-1-in-a-node-of-a-branch-and-bound-tree-using-cplex-jl/115028)

<div class="topic-metadata">

**Author:** [@ASUKaiwenFang](https://discourse.julialang.org/u/ASUKaiwenFang)\
**Replies:** 10\
**Last updated:** [June 7, 2024, 12:56am UTC](https://discourse.julialang.org/t/how-to-determine-which-variables-are-fixed-to-0-or-1-in-a-node-of-a-branch-and-bound-tree-using-cplex-jl/115028 "2024-06-07T00:56:04Z")

</div>

For example, at node A, x\_1 = 0, x\_2 = 1, x\_3 = 1, which API should I use to query this information?

---

## [NLP: Attribute ScalarNonlinearFunction is not supported by the model](https://discourse.julialang.org/t/nlp-attribute-scalarnonlinearfunction-is-not-supported-by-the-model/110444)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 21\
**Last updated:** [June 6, 2024, 10:13pm UTC](https://discourse.julialang.org/t/nlp-attribute-scalarnonlinearfunction-is-not-supported-by-the-model/110444 "2024-06-06T22:13:50Z")

</div>

Hi, I am working on an optimization problem as described in the PDF document in the GitHub repository. The nonlinearity is introduced mainly the equation G in (16). I implemented the model following closely the PDF desc…

---

## [Workarounds for splatting in index sets?](https://discourse.julialang.org/t/workarounds-for-splatting-in-index-sets/115212)

<div class="topic-metadata">

**Author:** [@solliolli](https://discourse.julialang.org/u/solliolli)\
**Replies:** 10\
**Last updated:** [June 6, 2024, 7:19am UTC](https://discourse.julialang.org/t/workarounds-for-splatting-in-index-sets/115212 "2024-06-06T07:19:40Z")

</div>

Hi! I ran into a small issue when writing a MILP model, namely the fact that the splatting operator cannot be used in the definition of an index set. What I’m trying to achieve is to define JuMP variables with dimensions…

---

## [ANN: JuMP-dev 2024: tickets now on sale](https://discourse.julialang.org/t/ann-jump-dev-2024-tickets-now-on-sale/111168)

<div class="topic-metadata">

**Author:** [@odow](https://discourse.julialang.org/u/odow)\
**Replies:** 2\
**Last updated:** [June 6, 2024, 9:30am UTC](https://discourse.julialang.org/t/ann-jump-dev-2024-tickets-now-on-sale/111168 "2024-06-06T09:30:18Z")

</div>

Dear all, Tickets for JuMP-dev 2024 are now on sale. The early bird cost is CAD50 before June 19, and CAD75 after. To sign up directly, go to https://symposia.gerad.ca/JumpDev-2024/register. For more details, includi…

---

## [Parameter support is broken used with direct\_model](https://discourse.julialang.org/t/parameter-support-is-broken-used-with-direct-model/115266)

<div class="topic-metadata">

**Author:** [@metab0t](https://discourse.julialang.org/u/metab0t)\
**Replies:** 1\
**Last updated:** [June 6, 2024, 3:47am UTC](https://discourse.julialang.org/t/parameter-support-is-broken-used-with-direct-model/115266 "2024-06-06T03:47:27Z")

</div>

using JuMP, Ipopt model = direct\_model(Ipopt.Optimizer()); set\_silent(model) x = @variable(model, lower\_bound = 0.0) @variable(model, p in Parameter(1.0), set\_string\_name=false) @objective(model, Min, x^2) con = @cons…

---

## [JuMPER using solver(Clp,GLPK)](https://discourse.julialang.org/t/jumper-using-solver-clp-glpk/115206)

<div class="topic-metadata">

**Author:** [@jackfr0st11](https://discourse.julialang.org/u/jackfr0st11)\
**Replies:** 4\
**Last updated:** [June 5, 2024, 8:11pm UTC](https://discourse.julialang.org/t/jumper-using-solver-clp-glpk/115206 "2024-06-05T20:11:51Z")

</div>

I have installed JuMPER with specified Julia(1.0) and JuMP(0.18) and i want to try the example code, but failed to add a solver for the model. Here is my code and reported error: I am wondering if it is feasible to …

---

## [Error while defining binary variable in JuMP](https://discourse.julialang.org/t/error-while-defining-binary-variable-in-jump/115249)

<div class="topic-metadata">

**Author:** [@vineetjnair9](https://discourse.julialang.org/u/vineetjnair9)\
**Replies:** 2\
**Last updated:** [June 5, 2024, 8:02pm UTC](https://discourse.julialang.org/t/error-while-defining-binary-variable-in-jump/115249 "2024-06-05T20:02:44Z")

</div>

Hi, I’m trying to initialize a vector of binary variables as follows: model = Model(Gurobi.Optimizer) @variable(model, z\[1:12\], Bin) But I get this error: Exception has occurred: MethodError MethodError: no method m…

---

## [Issues in solving Parameter Estimation Optimization with SciMLSensitivity.jl](https://discourse.julialang.org/t/issues-in-solving-parameter-estimation-optimization-with-scimlsensitivity-jl/114791)

<div class="topic-metadata">

**Author:** [@MarcoDellOro](https://discourse.julialang.org/u/MarcoDellOro)\
**Replies:** 11\
**Last updated:** [June 5, 2024, 3:45pm UTC](https://discourse.julialang.org/t/issues-in-solving-parameter-estimation-optimization-with-scimlsensitivity-jl/114791 "2024-06-05T15:45:13Z")

</div>

Hello everybody, I have already asked a question on the same topic (ODEs parameter estimation) but unfortunately I am experiencing some early user issues which I cannot understand how to solve. I am currently using the…

---

## [How to decipher SciMLBase OptimizationBase OptimizationForwardDiffExt warnings?](https://discourse.julialang.org/t/how-to-decipher-scimlbase-optimizationbase-optimizationforwarddiffext-warnings/115225)

<div class="topic-metadata">

**Author:** [@homocomputeris](https://discourse.julialang.org/u/homocomputeris)\
**Replies:** 1\
**Last updated:** [June 5, 2024, 12:45pm UTC](https://discourse.julialang.org/t/how-to-decipher-scimlbase-optimizationbase-optimizationforwarddiffext-warnings/115225 "2024-06-05T12:45:28Z")

</div>

When fitting a DE params to data, I get warnings like this one: ┌ Warning: dt(2.842170943040401e-14) \<= eps(t)(218.2272500679591) , and step error estimate = 2.359923922574841. Aborting. There is either an error in yo…

---

## [Parameter Estimation 10 dimensional ODE using Turing.jl for 0/1 data](https://discourse.julialang.org/t/parameter-estimation-10-dimensional-ode-using-turing-jl-for-0-1-data/115115)

<div class="topic-metadata">

**Author:** [@Marta\_Pardo\_Araujo](https://discourse.julialang.org/u/Marta_Pardo_Araujo)\
**Replies:** 6\
**Last updated:** [June 4, 2024, 1:45pm UTC](https://discourse.julialang.org/t/parameter-estimation-10-dimensional-ode-using-turing-jl-for-0-1-data/115115 "2024-06-04T13:45:01Z")

</div>

Hi, I am trying to estimate the parameters of a ODE model, the model is N equations that represent a metapopulation, where at each node you have the probability of presence at time t. I want to compare this with the obs…

---

## [SumOfSquares with BigFloat](https://discourse.julialang.org/t/sumofsquares-with-bigfloat/115009)

<div class="topic-metadata">

**Author:** [@jezzaparker](https://discourse.julialang.org/u/jezzaparker)\
**Replies:** 2\
**Last updated:** [June 4, 2024, 9:22am UTC](https://discourse.julialang.org/t/sumofsquares-with-bigfloat/115009 "2024-06-04T09:22:18Z")

</div>

I’m trying to use SumOfSquares with arbitrary precision. Is this possible? if I do model = GenericModel{BigFloat}(COSMO.Optimizer{BigFloat}) #... @constraint(model, con1 in SOSCone()) where con1 is a Polynomial{Dy…

---

## [Compatible Gurobi with Julia 1.10.3](https://discourse.julialang.org/t/compatible-gurobi-with-julia-1-10-3/115148)

<div class="topic-metadata">

**Author:** [@benjamin.nunez](https://discourse.julialang.org/u/benjamin.nunez)\
**Replies:** 1\
**Last updated:** [June 4, 2024, 3:42am UTC](https://discourse.julialang.org/t/compatible-gurobi-with-julia-1-10-3/115148 "2024-06-04T03:42:32Z")

</div>

Hi! I am working with Julia version 1.10.3. Does anyone know which is the latest version of Gurobi that is compatible with this version of Julia? Alternatively, does anyone know how I can find this information? Thank y…

---

## [Domain Error when using Zygote to differentiate MultiStart minimization](https://discourse.julialang.org/t/domain-error-when-using-zygote-to-differentiate-multistart-minimization/115013)

<div class="topic-metadata">

**Author:** [@paul188](https://discourse.julialang.org/u/paul188)\
**Replies:** 2\
**Last updated:** [June 3, 2024, 12:05pm UTC](https://discourse.julialang.org/t/domain-error-when-using-zygote-to-differentiate-multistart-minimization/115013 "2024-06-03T12:05:57Z")

</div>

I have the following MWE, with most of the code just copied from the MultiStartOptimization.jl documentation: using Optimization, OptimizationMultistartOptimization, OptimizationNLopt using Zygote using ForwardDiff ros…

---

## [Efficient multi-objective LP implementation](https://discourse.julialang.org/t/efficient-multi-objective-lp-implementation/114615)

<div class="topic-metadata">

**Author:** [@PaterPen](https://discourse.julialang.org/u/PaterPen)\
**Replies:** 5\
**Last updated:** [May 31, 2024, 1:22pm UTC](https://discourse.julialang.org/t/efficient-multi-objective-lp-implementation/114615 "2024-05-31T13:22:45Z")

</div>

Hi, I want to solve the following problem (maximum flow with losses): For a graph with source node s and target node t let \\forall v \\notin \\{s,t\\}: \\sum\_{u} f\_{u, v} = \\sum\_u \\alpha\_{v,u} f\_{v, u} where \\alpha\_{v,u} =…

---

## [Trajectory Optimization using Pseudospectral collocation](https://discourse.julialang.org/t/trajectory-optimization-using-pseudospectral-collocation/114017)

<div class="topic-metadata">

**Author:** [@DTdev](https://discourse.julialang.org/u/DTdev)\
**Replies:** 10\
**Last updated:** [May 30, 2024, 3:46pm UTC](https://discourse.julialang.org/t/trajectory-optimization-using-pseudospectral-collocation/114017 "2024-05-30T15:46:13Z")

</div>

Hi everyone! I am currently trying to solve a simple trajectory optimization problem using pseudospectral collocation or orthogonal collocation. I have written a simple UAV simulation using JuMP.jl with a moving obstac…

---

## [Second-order autodiff: which combinations should work?](https://discourse.julialang.org/t/second-order-autodiff-which-combinations-should-work/114892)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 13\
**Last updated:** [May 30, 2024, 10:13am UTC](https://discourse.julialang.org/t/second-order-autodiff-which-combinations-should-work/114892 "2024-05-30T10:13:09Z")

</div>

Hey there! My package DifferentiationInterface.jl provides the necessary infrastructure for second-order automatic differentiation (e.g. Hessians). It allows you to combine arbitrary pairs of AD backends, but of course …

---

## [How to get evenly distributed values from Highs](https://discourse.julialang.org/t/how-to-get-evenly-distributed-values-from-highs/114559)

<div class="topic-metadata">

**Author:** [@himgoy](https://discourse.julialang.org/u/himgoy)\
**Replies:** 9\
**Last updated:** [May 30, 2024, 6:09am UTC](https://discourse.julialang.org/t/how-to-get-evenly-distributed-values-from-highs/114559 "2024-05-30T06:09:20Z")

</div>

Hello Everyone, I am working on a linear programming problem. I want to solve variables for the constraints. The issue is I am able to get feasible values for all my variables from HiGHs for my problem, but these value…

---

## [NLopt Constraint](https://discourse.julialang.org/t/nlopt-constraint/114856)

<div class="topic-metadata">

**Author:** [@mary](https://discourse.julialang.org/u/mary)\
**Replies:** 4\
**Last updated:** [May 28, 2024, 10:27pm UTC](https://discourse.julialang.org/t/nlopt-constraint/114856 "2024-05-28T22:27:28Z")

</div>

Hi, I am using Nlopt for optimization. my objective function depends on three variables like x1,x2,x3 also I have a constraint which depends on all three variable. I want to do the optimization just for x3 variable. shou…

---

## [Adding new constraints](https://discourse.julialang.org/t/adding-new-constraints/114884)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 1\
**Last updated:** [May 29, 2024, 2:12am UTC](https://discourse.julialang.org/t/adding-new-constraints/114884 "2024-05-29T02:12:13Z")

</div>

Dear all, I have a MWE where I want to add new constraints into a model inside a function: m,n=10,20 A=rand(-10:10,m,n) b=\[sum(A\[i,:\]) for i in 1:m\]/2 function Basic\_model(A,b,n) modelo = Model(Gurobi.Optimizer) …

---

## [SCS and Mosek give very different answers](https://discourse.julialang.org/t/scs-and-mosek-give-very-different-answers/114739)

<div class="topic-metadata">

**Author:** [@Sam\_Hopkins](https://discourse.julialang.org/u/Sam_Hopkins)\
**Replies:** 6\
**Last updated:** [May 27, 2024, 11:00am UTC](https://discourse.julialang.org/t/scs-and-mosek-give-very-different-answers/114739 "2024-05-27T11:00:35Z")

</div>

Hi, I’m looking for help with semidefinite programming libraries, in particular Mosek.jl and SCS.jl, which I am accessing via JuMP. I have a particular semidefinite program, unfortunately not so small, for which SCS an…

---

## [Would it be possible to make a 4X game AI that plays well with MILP?](https://discourse.julialang.org/t/would-it-be-possible-to-make-a-4x-game-ai-that-plays-well-with-milp/114708)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 9\
**Last updated:** [May 26, 2024, 3:30pm UTC](https://discourse.julialang.org/t/would-it-be-possible-to-make-a-4x-game-ai-that-plays-well-with-milp/114708 "2024-05-26T15:30:34Z")

</div>

4X games like civilization, Stellaris, endless legends, etc… are known to have bad AI. The games often fix this issue by giving AI a massive handicap. This often restricts players into going into strategies that can nega…

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

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