Hi Iain,

Awesome! Yes, JuMP is what I had in mind when I said using julia to code my 
models.

The following code snippet is representative of 90% of the code in my AMPL 
models.

How would I code the following AMPL variable, CC_OWN, and its support, in 
JuMP/julia? 

# Mapping of stand_type, timber_yield_type and period to timber yield 
generated.
# Derived from the set yields and param Yield
set timber_yields:= setof{ (i,y,t) in yields: y in timber_yield_types } 
(i,y,t);
param Timber_Yield{ (i,y,t) in timber_yields }, default Yield[i,y,t];

# All stands and prescriptions belonging to ownership u with a clearcut 
intervention
# scheduled for period t
set clearcuts_own{u in ownerships, t in 0..Own_Periods}:= 
setof{ (i,j) in harvestable[t] : (Harv_Types[ISA[i],j,t] = 11 or 
Harv_Types[ISA[i],j,t] = 8) and Stand_Ownership[i] = u } (i,j);

# Clearcuts take all volume off a stand. Clearcut volume
# of type y, from ownership u, timbershed r, and period t.
s.t. cc_own{u in ownerships, y in timber_yield_types, r in tsheds, t in 
0..Own_Periods}:
CC_OWN[u,y,r,t] = (sum{ (i,j) in clearcuts_own[u,t] : Stand_Tshed[i] = r } 
(Timber_Yield[Stand_Type[i,j,t],y, Stand_Age[ISA[i],j,t]]*x[i,j]));


Andrew

On Tuesday, January 14, 2014 5:49:13 PM UTC-5, Iain Dunning wrote:
>
> Hi Andrew,
>
> JuMP is exactly what you are looking for.
> https://github.com/JuliaOpt/JuMP.jl
> https://jump.readthedocs.org/en/release-0.2/jump.html
>
> The documentation is quite comprehensive, and there is a lot of example 
> code. The code base is stable too, its ready for use (I use it for my own 
> research).
> Feel free to file issues for anything you might want to know.
> We achieve near-AMPL speeds if you use our @addConstraint macros, and 
> support directly calling CPLEX, Gurobi, GLPK, Cbc as well as output to LP 
> and MPS file formats.
> It blows PuLP out of the water - I recommend JuMP over PuLP for people in 
> my department now. See http://www.mit.edu/~mlubin/juliacomputing.pdf for 
> benchmarks.
>
> We don't have the full "helper" capabilities of AMPL but we'd be happy to 
> help translate those to Julia equivalents if you need help.
>
> Cheers,
> Iain
>
> On Tuesday, January 14, 2014 3:35:55 PM UTC-5, João Felipe Santos wrote:
>>
>> Did you have a look at JuMP? I believe it is equivalent to PuLP, but 
>> written in Julia: https://github.com/JuliaOpt/JuMP.jl
>>
>> --
>> João Felipe Santos
>>
>>
>> On Tue, Jan 14, 2014 at 2:52 PM, Andrew B. Martin <[email protected]
>> > wrote:
>>
>>> Hello,
>>>
>>> I'm new to julia; I discovered it when I posted in the python pulp-or 
>>> google group about generating large LP models.
>>>
>>> I currently use AMPL for model generation, but I'd like to switch to an 
>>> open-source alternative. I first went to pulp-or because I'm familiar with 
>>> python, but it's too slow; julia looks promising, but I'm concerned that 
>>> since I don't have a solid grasp of the language I might code the 
>>> constraints very inefficiently.
>>>
>>> The LP models I'm generating are about 1.5Gb as .lp files and take ~20 
>>> minutes to generate on an 8Gb machine using AMPL.
>>>
>>> It would help me get started if someone here could translate a piece of 
>>> my AMPL code to julia. I think I can translate the whole model if I have an 
>>> example to compare against.
>>>
>>> Anyone here interested? It would be about 10 lines of AMPL code, 
>>> describing a variable defined by two derived sets.
>>>
>>> Regards,
>>> Andrew
>>>
>>
>> 

Reply via email to