Changeset 5812


Ignore:
Timestamp:
May 26, 2012 4:11:59 PM (7 years ago)
Author:
wehart
Message:

Changing example to use xrange instead of range.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.data.pyomo/trunk/coopr/data/pyomo/performance/diagA100000.py

    r5810 r5812  
    55
    66def f(model, N):
    7     for i in range(1,N+1):   
     7    for i in xrange(1,N+1):   
    88        setattr(model, 'x'+str(i), Var())
    99
    10     expr=sum(i*getattr(model, 'x'+str(i)) for i in range(1,N+1))
     10    expr=sum(i*getattr(model, 'x'+str(i)) for i in xrange(1,N+1))
    1111    model.obj = Objective(expr=expr)
    1212
    13     for i in range(1,N+1):
     13    for i in xrange(1,N+1):
    1414        setattr(model, 'c'+str(i), Constraint(expr = (N-i+1)*getattr(model, 'x'+str(i)) >= N))
    1515
Note: See TracChangeset for help on using the changeset viewer.