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
1
vote
1 answer

How to define variables separately where you need to index over a list of lists?

I'd like to define a binary variable x_ijk where i in I is an n-element Vector{Vector{Int64}}, k in K is an n-element Vectors, and j in J is a m-elemts vectors. Always the length of K is equal to the number of vectors in I. How to index over each…
user9990604
1
vote
1 answer

Julia JuMP feasibility slack of constraints

In Julia, by using JuMP am setting up a simple optimization problem (MWE, the real problem is much bigger). model = Model() set_optimizer(model, MosekTools.Optimizer) @variable(model, 0 <= x[1:2]) @constraint(model, sum(x) <= 2) @constraint(model, 1…
1
vote
0 answers

In Julia using StochasticPrograms.jl and using @sampler micro, how to define a sampler which matches a 2 dimensional @uncertain variable?

This matter is partially discussed here: In Julia using StochasticPrograms.jl package how can I get the @sampler object as a n*m matrix not a vector? But there are significant new issues in this question: In the julia programming language I use…
alex_nas
  • 37
  • 4
1
vote
0 answers

get value of a uncertain variable in Julia JuMPeR

I want to solve a robust optimization problem with Julia JuMPeR. Is there any way to get the values of uncertain variables in the solution in Julia JuMPeR? I am using Julia v1.5.
1
vote
2 answers

Instead of defining an objective function, gradient, and hessian function seperatley, can you have one function return all?

Is there a way in JuMP to define a function that returns for example a tuple containing the objective function and the gradient, which you can pass to register? In the documentation :…
Eigenvalue
  • 1,093
  • 1
  • 14
  • 35
1
vote
2 answers

How to have conditions for constraints?

How can I code a constraint like this in JUMP? Suppose i,j,k,m are indices and capital letters associated with them are set, like J. x_{i,j,k,m'} + sum((j in J, k in K), y_{j,k,m})<= z_{i,m} for all i in I and for all m and m' in M ; m !=m' just…
Hemfri
  • 313
  • 1
  • 8
1
vote
1 answer

Ctrl+C does not interrupt optimize!() regardless of solver

The problem pertains to JuMP, an optimization package for Julia. I realize this problem is likely specific to my machine; however, I have tried many of the obvious remedies with no luck. When I run a JuMP model using optimize!(), I cannot interrupt…
1
vote
1 answer

In Julia using StochasticPrograms.jl package how can I get the @sampler object as a n*m matrix not a vector?

In the julia programming language I use StochasticPrograms.jl package to model a two stage stochastic problem. I use @sampler object to develop scenarios and random values. The random variable follows a normal distribution. The @sampler output…
alex_nas
  • 37
  • 4
1
vote
1 answer

Constraints of type MathOptInterface.VariableIndex-in-MathOptInterface.ZeroOne are not supported by the solver. When using Ipopt solver in Julia

Need help in resolving issue of Constraints of type MathOptInterface.VariableIndex-in-MathOptInterface.ZeroOne are not supported by the solver. When using Ipopt solver in Julia for BinPacking problem #variables declaration @variable(model,…
Dones
  • 5
  • 1
1
vote
1 answer

How can I remove the "type VariableIndex has no field head" error?

Would you please help me, why the error"type VariableIndex has no field head" was happened when I run the bellow code using JuMP,CPUTime, Distributions, Ipopt,Juniper,Gurobi #-----Model…
Soma
  • 743
  • 6
  • 19
1
vote
1 answer

How is it possible to collect NLexpression in a loop?

Would you please help me that how I can collect some NLexpressions in a loop? I Want to keep k8 and k9 for all i=1:10 as scenarios. It means in the end of the loop, Q equal to collection of k8 and k9 under each scenario ( i ). I couldn't define a…
Soma
  • 743
  • 6
  • 19
1
vote
2 answers

Coding arrays in constraint JuMP

Please consider the following image: I know when I use a:b in @constraint it means an array from a to b. I need to code the arrays like {a_j,b_j} in @constraint of the mentioned code. Can you please help me to code that?
Mahsa
  • 69
  • 1
1
vote
1 answer

In JuMP How can we use VariableRef for mapping values?

I am trying to solve an optimisation problem in Julia Jump using Gurobi Pkg. I have created 2 matrices (A and B) that should be mapped using the 3rd one (Matrix C). @variable(model, lb_C[i,j] <= C[i=1:m, j=1:n] <= ub_C[i,j],…
Adi
  • 13
  • 3
1
vote
2 answers

How to get values from every iteration in JuMP

I'm solving a particular optimization problem in julia using JuMP, Ipopt and I have a problem finding the history of values i.e. value of x from every iteration. I couldn't find anything useful in documentations. Minimal example: using JuMP import…
1
vote
2 answers

Julia JuMP Constraint from Vector

I'm practicing with Julia but got stuck trying to make a constraint. # Server Costs > df_custos = DataFrame(C1=[2,4,3],C2=[1,2,1],C3=[3,3,2],C4=[6,2,3],) # City num > num_cidades=ncol(df_custos) # Server num > num_servidores =…