# Optimization (Mathematical)

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

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

**Page:** 68

---

## [Parameter setting](https://discourse.julialang.org/t/parameter-setting/76836)

<div class="topic-metadata">

**Author:** [@mamo](https://discourse.julialang.org/u/mamo)\
**Replies:** 10\
**Last updated:** [February 27, 2022, 9:40pm UTC](https://discourse.julialang.org/t/parameter-setting/76836 "2022-02-27T21:40:48Z")

</div>

Dear all, I need to set a parameter with the structure equivalent to this AMPL declaration: param wg{c in C, cont in CONT\[c\]}; sets C and CONT\[c\] are as follows: set C := C1 C2; set CONT\[C1\] := 1 2 3 4 5; set CONT\[…

---

## [Issue providing start/hint values to variables with Gurobi](https://discourse.julialang.org/t/issue-providing-start-hint-values-to-variables-with-gurobi/77079)

<div class="topic-metadata">

**Author:** [@umbe](https://discourse.julialang.org/u/umbe)\
**Replies:** 4\
**Last updated:** [February 25, 2022, 6:54pm UTC](https://discourse.julialang.org/t/issue-providing-start-hint-values-to-variables-with-gurobi/77079 "2022-02-25T18:54:22Z")

</div>

Hello to everyone! I am trying to provide initial guess values or hint values to some variables of an optimization problem, which is intended to be solved using Gurobi. I have read this previous topic for the assignment…

---

## [JuMP v0.23 is released](https://discourse.julialang.org/t/jump-v0-23-is-released/77045)

<div class="topic-metadata">

**Author:** [@odow](https://discourse.julialang.org/u/odow)\
**Replies:** 8\
**Last updated:** [February 25, 2022, 4:55pm UTC](https://discourse.julialang.org/t/jump-v0-23-is-released/77045 "2022-02-25T16:55:51Z")

</div>

We are pleased to announce the release of JuMP v0.23 and MathOptInterface v1.0. This is an important release for two reasons. First, it serves as a release candidate for JuMP v1.0. Our criteria for tagging an official …

---

## [Symbolic Optimization](https://discourse.julialang.org/t/symbolic-optimization/77077)

<div class="topic-metadata">

**Author:** [@jmcastro2109](https://discourse.julialang.org/u/jmcastro2109)\
**Replies:** 0\
**Last updated:** [February 25, 2022, 3:30pm UTC](https://discourse.julialang.org/t/symbolic-optimization/77077 "2022-02-25T15:30:29Z")

</div>

Hello, Is there a way to use Julia to solve for symbolic optimization problems. What I have in mind is something that works like Mathematica (or Wolfram Alpha) but with a nice syntax and decent computation speeds that c…

---

## [JuMP dual inside loop](https://discourse.julialang.org/t/jump-dual-inside-loop/76895)

<div class="topic-metadata">

**Author:** [@Mariana](https://discourse.julialang.org/u/Mariana)\
**Replies:** 2\
**Last updated:** [February 23, 2022, 7:35pm UTC](https://discourse.julialang.org/t/jump-dual-inside-loop/76895 "2022-02-23T19:35:19Z")

</div>

Hello! I am trying to run a code using the dual function from JuMP inside a loop, but I’m not getting the results I expected. The code is a bit extensive, so I’ll try to put here the most relevant parts of the model fo…

---

## [\`optimizer\_with\_attributes\` failing when called inside a module](https://discourse.julialang.org/t/optimizer-with-attributes-failing-when-called-inside-a-module/76912)

<div class="topic-metadata">

**Author:** [@Di11on](https://discourse.julialang.org/u/Di11on)\
**Replies:** 2\
**Last updated:** [February 23, 2022, 4:40pm UTC](https://discourse.julialang.org/t/optimizer-with-attributes-failing-when-called-inside-a-module/76912 "2022-02-23T16:40:49Z")

</div>

Hi folks, I am having some problems getting some code to run inside a module. It runs fine when run directly in the REPL. Here is it: mod\_name = Symbol("HiGHS") @eval using $mod\_name mod = getproperty(@\_\_MO…

---

## [GenX model : Configurable Capacity Expansion Model](https://discourse.julialang.org/t/genx-model-configurable-capacity-expansion-model/76887)

<div class="topic-metadata">

**Author:** [@iAnkiit](https://discourse.julialang.org/u/iAnkiit)\
**Replies:** 4\
**Last updated:** [February 23, 2022, 7:11am UTC](https://discourse.julialang.org/t/genx-model-configurable-capacity-expansion-model/76887 "2022-02-23T07:11:06Z")

</div>

This model is developed for power generation and related stuff. It is completely written in Julia and JuMP. Can someone please help out with understanding of this model ? GenX model by MIT I need to understand the code…

---

## [Optim user-supplied gradient and hessian MLE](https://discourse.julialang.org/t/optim-user-supplied-gradient-and-hessian-mle/76848)

<div class="topic-metadata">

**Author:** [@luischanci](https://discourse.julialang.org/u/luischanci)\
**Replies:** 3\
**Last updated:** [February 22, 2022, 5:19pm UTC](https://discourse.julialang.org/t/optim-user-supplied-gradient-and-hessian-mle/76848 "2022-02-22T17:19:10Z")

</div>

I’m moving my MLE class notes to incorporate Julia, so I’m exploring how to incorporate the analytical gradient and hessian into an optimization problem using Optim. I created a toy model to check the commands first. Ho…

---

## [Segmentation fault error with JuMP and Ipopt on HPC cluster](https://discourse.julialang.org/t/segmentation-fault-error-with-jump-and-ipopt-on-hpc-cluster/67642)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 2\
**Last updated:** [September 3, 2021, 7:19pm UTC](https://discourse.julialang.org/t/segmentation-fault-error-with-jump-and-ipopt-on-hpc-cluster/67642 "2021-09-03T19:19:52Z")

</div>

Dear All, I am trying to solve a large-scale optimization problem that uses JuMP and Ipopt. I get a signal (11): Segmentation fault error trying to run the code on an HPC cluster (details below), however if I switch to …

---

## [How to understand the optimization behavior JuMP?](https://discourse.julialang.org/t/how-to-understand-the-optimization-behavior-jump/76736)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 4\
**Last updated:** [February 19, 2022, 2:19pm UTC](https://discourse.julialang.org/t/how-to-understand-the-optimization-behavior-jump/76736 "2022-02-19T14:19:47Z")

</div>

Hi, I am new to Julia and JuMP package. Recently I am trying to use JuMP to solve similar optimization problems like Power Systems posted in JuMP’s tutorial. I read through the page, find the section unit commitment is…

---

## [Xpress NonLinear](https://discourse.julialang.org/t/xpress-nonlinear/74669)

<div class="topic-metadata">

**Author:** [@andreab](https://discourse.julialang.org/u/andreab)\
**Replies:** 1\
**Last updated:** [February 19, 2022, 3:33am UTC](https://discourse.julialang.org/t/xpress-nonlinear/74669 "2022-02-19T03:33:50Z")

</div>

Is there a package in the JuMP ecosystem providing an interface to FICO Xpress NonLinear solver? Xpress.jl seems to support only Xpress Optimizer. If I try to use Xpress.jl to solve a non-convex NLP, I get the followin…

---

## [Optim: loading Information from previous runs](https://discourse.julialang.org/t/optim-loading-information-from-previous-runs/76620)

<div class="topic-metadata">

**Author:** [@Shmuley95](https://discourse.julialang.org/u/Shmuley95)\
**Replies:** 13\
**Last updated:** [February 18, 2022, 3:57pm UTC](https://discourse.julialang.org/t/optim-loading-information-from-previous-runs/76620 "2022-02-18T15:57:37Z")

</div>

I am trying to run a large nonlinear optimization problem on a HPC cluster, where I can only get 10 consecutive days of computing before my code is aborted due to the time limit in the cluster. As my problem involves 19 …

---

## [Export Ampl format from jump model](https://discourse.julialang.org/t/export-ampl-format-from-jump-model/76584)

<div class="topic-metadata">

**Author:** [@thiagonovaesb](https://discourse.julialang.org/u/thiagonovaesb)\
**Replies:** 5\
**Last updated:** [February 17, 2022, 9:50pm UTC](https://discourse.julialang.org/t/export-ampl-format-from-jump-model/76584 "2022-02-17T21:50:05Z")

</div>

Using AmplNLWriter.jl I can export a jump model as .NL format (.nl and .opt). There is a simple way to export the model in AMPL format? (.mod, .dat, .run)?

---

## [Can you define a JuMP variable using the keys of an existing DenseAxisArray?](https://discourse.julialang.org/t/can-you-define-a-jump-variable-using-the-keys-of-an-existing-denseaxisarray/76443)

<div class="topic-metadata">

**Author:** [@MartinBonde](https://discourse.julialang.org/u/MartinBonde)\
**Replies:** 2\
**Last updated:** [February 14, 2022, 7:08pm UTC](https://discourse.julialang.org/t/can-you-define-a-jump-variable-using-the-keys-of-an-existing-denseaxisarray/76443 "2022-02-14T19:08:59Z")

</div>

Say I have a variable defined over two axes: @variable(m, x\[1:3,\[:a, :b\]\]) 2-dimensional DenseAxisArray{VariableRef,2,...} with index sets: Dimension 1, Base.OneTo(3) Dimension 2, \[:a, :b\] And data, a 3×2 Matri…

---

## [Error in running a tutor model](https://discourse.julialang.org/t/error-in-running-a-tutor-model/76405)

<div class="topic-metadata">

**Author:** [@tonyhur](https://discourse.julialang.org/u/tonyhur)\
**Replies:** 2\
**Last updated:** [February 14, 2022, 5:33pm UTC](https://discourse.julialang.org/t/error-in-running-a-tutor-model/76405 "2022-02-14T17:33:20Z")

</div>

I’m trying to run the “urban planning problem” at https://jump.dev/JuMP.jl/stable/tutorials/linear/urban\_plan/. I installed Julia 1.5.3, JuMP v0.21.10, Test, and GLPK v0.14.14. When running I get an error: Test threw…

---

## [Solving Nonlinear constrained optimization](https://discourse.julialang.org/t/solving-nonlinear-constrained-optimization/75982)

<div class="topic-metadata">

**Author:** [@AhmedAlreweny](https://discourse.julialang.org/u/AhmedAlreweny)\
**Replies:** 6\
**Last updated:** [February 14, 2022, 3:37pm UTC](https://discourse.julialang.org/t/solving-nonlinear-constrained-optimization/75982 "2022-02-14T15:37:21Z")

</div>

Hello, I have been recently struggling to solve a NLP in julia. The problem can be written as: min f(x) st c(x)=0 It is important to mention that the objective function is a discretized integrat…

---

## [Can you control how indexes are printed when you print a model?](https://discourse.julialang.org/t/can-you-control-how-indexes-are-printed-when-you-print-a-model/76377)

<div class="topic-metadata">

**Author:** [@gleyland](https://discourse.julialang.org/u/gleyland)\
**Replies:** 3\
**Last updated:** [February 13, 2022, 11:33pm UTC](https://discourse.julialang.org/t/can-you-control-how-indexes-are-printed-when-you-print-a-model/76377 "2022-02-13T23:33:07Z")

</div>

Can you control how JuMP prints indexes in print(model) beyond overriding Base.show? If not, this would be a nice, but not super-important feature. Take as an example, an excerpt from the JuMP knapsack example, but ins…

---

## [Continuous Integration with Gurobi.jl](https://discourse.julialang.org/t/continuous-integration-with-gurobi-jl/76355)

<div class="topic-metadata">

**Author:** [@davide-f](https://discourse.julialang.org/u/davide-f)\
**Replies:** 2\
**Last updated:** [February 13, 2022, 7:03pm UTC](https://discourse.julialang.org/t/continuous-integration-with-gurobi-jl/76355 "2022-02-13T19:03:31Z")

</div>

Dear Community, For a project I am developing on github, I would like to set-up the CI.yml using Gurobi.jl as a solver. I do have a license, however, it is not clear to me how to successfully install gurobi and the lic…

---

## [Defining an if condition in a constraint](https://discourse.julialang.org/t/defining-an-if-condition-in-a-constraint/76228)

<div class="topic-metadata">

**Author:** [@Sahar](https://discourse.julialang.org/u/Sahar)\
**Replies:** 7\
**Last updated:** [February 12, 2022, 2:55pm UTC](https://discourse.julialang.org/t/defining-an-if-condition-in-a-constraint/76228 "2022-02-12T14:55:23Z")

</div>

Hello everyone! I want to define an if condition in a constraint. I will have different constraints if the variable is positive or negative (Pb \>0.0 or Pb \<0.0), and you can see this part of the code; for i in 1:5, t i…

---

## [Formulating a customized optimization problem in JuliaOpt](https://discourse.julialang.org/t/formulating-a-customized-optimization-problem-in-juliaopt/76260)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 2\
**Last updated:** [February 11, 2022, 11:40pm UTC](https://discourse.julialang.org/t/formulating-a-customized-optimization-problem-in-juliaopt/76260 "2022-02-11T23:40:28Z")

</div>

Hello everyone, I have clear modeling requirements, but not sure how to (or is it possible to) implement my problem with Julia optimization packages, like JuMP. General optimization problem: Objective function: obj(…

---

## [Dualization.jl PositiveSemidefiniteConeSquare not implemented](https://discourse.julialang.org/t/dualization-jl-positivesemidefiniteconesquare-not-implemented/74861)

<div class="topic-metadata">

**Author:** [@Thomas](https://discourse.julialang.org/u/Thomas)\
**Replies:** 2\
**Last updated:** [February 11, 2022, 6:00pm UTC](https://discourse.julialang.org/t/dualization-jl-positivesemidefiniteconesquare-not-implemented/74861 "2022-02-11T18:00:28Z")

</div>

When trying to dualize an SDP I got Constraints of function MathOptInterface.VectorAffineFunction{Float64} in the Set MathOptInterface.PositiveSemidefiniteConeSquare are not implemented Is this by any chance supporte…

---

## [Optimization error when using JuMP](https://discourse.julialang.org/t/optimization-error-when-using-jump/76160)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 13\
**Last updated:** [February 10, 2022, 11:57pm UTC](https://discourse.julialang.org/t/optimization-error-when-using-jump/76160 "2022-02-10T23:57:16Z")

</div>

Follow is the optimization problem I defined: Packages and constants: using JuMP, Ipopt const R0 = 0.1803 Lmin, Lnom, Lmax = 0.8, 2.4, 3.5 w1 = 0.4 w2 = 0.6 Rfc1 = 0.1803 + 0.01 Rfc2 = 0.1803 L11, L21 = 2.1, 2.…

---

## [How to implement a piece-wise defined function in JuMP](https://discourse.julialang.org/t/how-to-implement-a-piece-wise-defined-function-in-jump/76095)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 8\
**Last updated:** [February 9, 2022, 8:06pm UTC](https://discourse.julialang.org/t/how-to-implement-a-piece-wise-defined-function-in-jump/76095 "2022-02-09T20:06:08Z")

</div>

I have an optimization problem simplified as: function α(x) global Lmin, Lnom, Lmax, α\_0 # values calculated outside a = 0.0019727939 b = 0.0078887 if Lmin \<= x \< Lnom return a \* (x-Lnom)^2 + α\_0 elseif Lnom \<= x…

---

## [Can not Run nonlinear optimization example using Ipopt](https://discourse.julialang.org/t/can-not-run-nonlinear-optimization-example-using-ipopt/75998)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 3\
**Last updated:** [February 8, 2022, 1:48pm UTC](https://discourse.julialang.org/t/can-not-run-nonlinear-optimization-example-using-ipopt/75998 "2022-02-08T13:48:03Z")

</div>

I am new to Julia and recently try to learn to do optimization using JuMP. I use the Quadratically constrained programs example in JuMP document website. using JuMP import Ipopt import Test function example\_qcp(; …

---

## [Solving MPC using JuMP and Gurobi](https://discourse.julialang.org/t/solving-mpc-using-jump-and-gurobi/75962)

<div class="topic-metadata">

**Author:** [@alre5639](https://discourse.julialang.org/u/alre5639)\
**Replies:** 3\
**Last updated:** [February 7, 2022, 9:55pm UTC](https://discourse.julialang.org/t/solving-mpc-using-jump-and-gurobi/75962 "2022-02-07T21:55:06Z")

</div>

I am attempting to translate the MPC implemented in python and cvxpy here in Julia using JuMP and Gurobi. However when attempting to solve the first iteration of the optimization I set up I am getting an unconstrained/i…

---

## [Complex Number Support in NLSolve](https://discourse.julialang.org/t/complex-number-support-in-nlsolve/36748)

<div class="topic-metadata">

**Author:** [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)\
**Replies:** 0\
**Last updated:** [March 30, 2020, 3:17pm UTC](https://discourse.julialang.org/t/complex-number-support-in-nlsolve/36748 "2020-03-30T15:17:59Z")

</div>

What is the scope of complex number support in NLSolve? I found an example in this issue, Allow complex numbers · Issue #112 · JuliaNLSolvers/NLsolve.jl · GitHub using NLsolve function f!(x, fvec) fvec\[1\] = (x\[1\]+…

---

## [High precision summation functions not compatible with Optim.jl with autodiff=:forward](https://discourse.julialang.org/t/high-precision-summation-functions-not-compatible-with-optim-jl-with-autodiff-forward/75714)

<div class="topic-metadata">

**Author:** [@HJW019](https://discourse.julialang.org/u/HJW019)\
**Replies:** 9\
**Last updated:** [February 5, 2022, 2:36pm UTC](https://discourse.julialang.org/t/high-precision-summation-functions-not-compatible-with-optim-jl-with-autodiff-forward/75714 "2022-02-05T14:36:10Z")

</div>

I am doing high dimensional Monte Carlo integrations in a maximum likelihood estimation using Optim.jl with the autodiff = :forward option (based on ForwardDiff.jl). I use up to millions of quasi-random draws (e.g., Halt…

---

## [Problem realization of PCA](https://discourse.julialang.org/t/problem-realization-of-pca/75793)

<div class="topic-metadata">

**Author:** [@Sarah](https://discourse.julialang.org/u/Sarah)\
**Replies:** 2\
**Last updated:** [February 4, 2022, 9:59pm UTC](https://discourse.julialang.org/t/problem-realization-of-pca/75793 "2022-02-04T21:59:27Z")

</div>

Hi everyone! I’m new with Julia. I wanted to realise a PCA on Julia on the “iris” dataset, however I don’t understand why Julia doesn’t recognize my packages. I installed every needed package. Could someone please hel…

---

## [JuMP and Pluto.jl?](https://discourse.julialang.org/t/jump-and-pluto-jl/49210)

<div class="topic-metadata">

**Author:** [@gleyland](https://discourse.julialang.org/u/gleyland)\
**Replies:** 8\
**Last updated:** [February 4, 2022, 5:16pm UTC](https://discourse.julialang.org/t/jump-and-pluto-jl/49210 "2022-02-04T17:16:04Z")

</div>

Hi, Has anyone tried using JuMP inside a Pluto.jl notebook? Are there any tricks one needs to be aware of? I have a simple notebook with two cells: “”" using JuMP, GLPK “”" and “”" begin M = Model(GLPK.Optimize…

---

## [Optim.jl violates inequality constraint](https://discourse.julialang.org/t/optim-jl-violates-inequality-constraint/75573)

<div class="topic-metadata">

**Author:** [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Replies:** 3\
**Last updated:** [February 4, 2022, 4:49pm UTC](https://discourse.julialang.org/t/optim-jl-violates-inequality-constraint/75573 "2022-02-04T16:49:11Z")

</div>

I’m trying to do maximum likelihood estimation with constraints: p\[1\] + p\[2\] + p\[3\] + ... == 1 p\[1\] \* a\[1\] / (1 - b\[1\]) + p\[2\] \* a\[2\] / (1 - b\[2\]) + ... \< 1 However, Optim seems to ignore the inequality constraint. Co…

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

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