Changeset 3167


Ignore:
Timestamp:
Oct 26, 2010 10:05:25 PM (10 years ago)
Author:
jwatson
Message:

Restoring older version of rangeset.py - the latest commit caused all kinds of test failures, for reasons I haven't had time to explore.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pyomo/trunk/coopr/pyomo/base/rangeset.py

    r3149 r3167  
    1111__all__ = ['RangeSet']
    1212
    13 import itertools
    1413import sets
    1514import expr
    1615from numvalue import value
    1716from pyutilib.component.core import *
    18 
    19 def count(start=0, step=1):
    20     n = start
    21     while True:
    22         yield n
    23         n += step
    2417
    2518class RangeSetValidator(object):
     
    9790        lb = self._start_val
    9891        ub = self._start_val
    99         #for val in xrange(self._start_val, self._end_val+1, self._step_val):
    100         for val in itertools.islice(count(self._start_val, self._step_val), (self._end_val-self._start_val+self._step_val-1)//self._step_val):
     92        for val in xrange(self._start_val, self._end_val+1, self._step_val):
    10193          if self._verify(val,False):
    10294             ub=val
Note: See TracChangeset for help on using the changeset viewer.