This code works for me in Julia v0.3.5 and v0.4. Can you provide the output of versioninfo() and Pkg.status()?
Also, there is a julia-opt <https://groups.google.com/forum/#!forum/julia-opt> mailing list that is the best venue to ask questions specific to optimization in Julia. On Sunday, March 8, 2015 at 3:08:32 PM UTC-4, Lauren Clisby wrote: > > 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! >