Just started using Julia, JuMP, Cbc, GLPK, and Gurobi this week for a
class. Trying to solve a basic LP and compare Cbc, GLPK, and Gurobi for
speed (as a class project).
I've had a lot of issues trying to learn these from scratch (I've coded in
VBA, HTML, and Java, and use MATLAB regularly) so please help me out with
these beginner questions.
I've loaded the packages without errors, it's just when I try to solve an
LP that it breaks.
Right now I'm just trying to run a basic model and get this error:
*ERROR: stack overflow in Model at none:2 (repeats 63846 times)*
Here's the code I'm trying to run, which is basically straight from an
online example:
*using JuMP*
*function Model2()*
*m = Model()*
*@defVar(m, x[1:5], Bin)*
*profit = [ 5, 3, 2, 7, 4 ]*
*weight = [ 2, 8, 4, 2, 5 ]*
*capacity = 10*
*# Objective: maximize profit*
*@setObjective(m, Max, dot(profit, x))*
*# Constraint: can carry all*
*@addConstraint(m, dot(weight, x) <= capacity)*
*# Solve problem using MIP solver*
*status = solve(m)*
*println("Objective is: ", getObjectiveValue(m))*
*println("Solution is:")*
*for i = 1:5*
* print("x[$i] = ", getValue(x[i]))*
* println(", p[$i]/w[$i] = ", profit[i]/weight[i])*
*end*
*end*
*Model2()*
I'm using it as a function because I'm using the command window version and
otherwise it runs every line separately and breaks.
Thanks!