Questions tagged [julia-jump]

JuMP is a domain-specific modeling language for mathematical programming embedded in the Julia language.

JuMP is a domain-specific modeling language for mathematical programming embedded in the Julia language.

https://github.com/JuliaOpt/JuMP.jl

362 questions
2
votes
1 answer

using quoted expressions and arrays in julia

I am having some trouble dealing with the differences between an array indexed at a spot and a the item at that spot in a quoted expression can be seen with this simple example: julia> A=[:(2+3),:(4),:(9-8)]; julia> t=A[1]; julia> eval(quote …
2
votes
1 answer

add a constraint in JuMP

I'm trying to add a constraint to a JuMP model in Julia as follows: @constraint(m, sum{z[i,j]>=2, i in N, j in K}) where N and K are two sets. But, when I debug it, I get the following error message. LoadError: In @constraint(m,sum{z[i,j] >= 2,i…
ccc
  • 574
  • 2
  • 9
  • 22
2
votes
1 answer

Cox Proportional Hazard in JuMP.jl

I am trying JuMP.jl in Julia for the first time and can't seem to get around an error. Here is my set up. using DataFrames, DataFramesMeta, JuMP, Ipopt #time to event times =…
Alex
  • 2,603
  • 4
  • 40
  • 73
2
votes
0 answers

Julia error with JuMP with vector norm objective

When I run the Julia code below: using Convex using DataFrames using SCS using JuMP dim = 5 A = rand(dim,dim); B = rand(dim,dim); m = Model(solver=SCSSolver(max_iters=5000,eps=1e-4)); @variable(m,X[i=1:dim,j=1:dim]); @objective(m,Min,…
Shew
  • 1,557
  • 1
  • 21
  • 36
2
votes
2 answers

Quadratically constrained MIQP with julia and gurobi

This is an attempt to answer the following question: https://matheducators.stackexchange.com/questions/11757/small-data-sets-with-integral-sample-standard-deviations So the intent of the following code is to find examples of small datasets with…
kjetil b halvorsen
  • 1,206
  • 2
  • 18
  • 28
2
votes
1 answer

Which characteristics from commercial Algebraic Modeling Languages are still missing from open source ones?

Which characteristics the main commercial Algebraic Modeling Languages (AML), like GAMS or AMPL, have, that open source AMLs, like Pyomo or JuMP, do not yet have (aside obviously the user base and availability of established models) ?
Antonello
  • 6,092
  • 3
  • 31
  • 56
2
votes
1 answer

How to model the VRP flow constraint

I'm having some trouble modeling this constraint in Julia right now I have for k=1:v for j = 2:nodes @constraint(model,sum(x[i,j,k] for i=1:nodes) == sum(x[j,i,k] for i=1:n)) end end where nodes is the customer set, n includes the depot and…
DJK
  • 8,924
  • 4
  • 24
  • 40
2
votes
1 answer

How to get solve time using JuMP/GLPK

I can't get the solve time and node count of a MIP model using JuMP, with GLPK. Using Gurobi it works fine. Here is a minimum example to reproduce the error I am getting: using JuMP using GLPKMathProgInterface m =…
pbc1303
  • 142
  • 9
2
votes
1 answer

List available solvers in JuMP

I installed JuMP and tried to initialize a Model(), while doing so I would like to specify the solver based on what is available. For this how could I get a list of available solvers?
Abhijith
  • 1,158
  • 1
  • 13
  • 27
2
votes
1 answer

UndefVarError: Model not defined

How should I fix the following error? Pkg.add("JuMP") Pkg.add("Clp") m = Model() and I get the following error: LoadError: UndefVarError: Model not defined while loading In[4], in expression starting on line 1
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
2
votes
1 answer

How to use matrices to set constraints in Julia?

I am trying to write a linear optimization model in Julia. I have several constraints to add, and I wanted to try and set them using matrices instead of setting each one manually. I have upwards of 5 constraints but I narrowed it down to two just…
Cam
  • 421
  • 2
  • 8
  • 18
2
votes
2 answers

How to convert type of a variable when using JuMP

I am using Julia/JuMP to implement an algorithm. In one part, I define a model with continues variables and solve the linear model. I do some other calculations based on which I add a couple constraints to the model, and then I want to solve the…
Ana
  • 1,516
  • 3
  • 15
  • 26
2
votes
2 answers

Sum only for elements less than N

I want to add the following constraint: @addConstraint(m, sum{sum{x[:alpha, d, s], s in S}, d in D} >= 5) where x is a decision variable and D = [1:50] but I want the sum to be calculated only for d less than 10. Is there a built-in way or do I…
HAL9000
  • 3,562
  • 3
  • 25
  • 47
2
votes
2 answers

How do I define AMPL like sets and parameters in Julia+JuMP?

I need to define some constant parameter in Julia+JuMP, similarly to what you do in AMPL when you define set A := a0 a1 a2; param p := a0 1 a1 5 a2 10 ; How do I define something like A and p in Julia?
HAL9000
  • 3,562
  • 3
  • 25
  • 47
1
vote
1 answer

Correct way to enter constraints using derivative values in JuMP?

I was wondering if there is a best practices to calculating variables, or more specifically, adding constraints to an optimization model using derivatives of variables. To provide a concrete example. I have a function let's call output which I know…
Adam
  • 313
  • 1
  • 3
  • 11