def chain_test(n):
 global planner
 planner = Planner()
 (prev, first, last) = (None, None, None)
 for i in range((n + 1)):
  name = ('v%s' % i)
  v = Variable(name)
  if (prev is not None):
   EqualityConstraint(prev, v, Strength.REQUIRED)
  if (i == 0):
   first = v
  if (i == n):
   last = v
  prev = v
 StayConstraint(last, Strength.STRONG_DEFAULT)
 edit = EditConstraint(first, Strength.PREFERRED)
 edits = OrderedCollection()
 edits.append(edit)
 plan = planner.extract_plan_from_constraints(edits)
 for i in range(100):
  first.value = i
  plan.execute()
  if (last.value != i):
   print('Chain test failed.')

def chain_test ( n ) : global planner planner = Planner ( ) ( prev , first , last ) = ( None , None , None ) for i in range ( ( n + 1 ) ) : name = ( 'v%s' % i ) v = Variable ( name ) if ( prev is not None ) : EqualityConstraint ( prev , v , Strength . REQUIRED ) if ( i == 0 ) : first = v if ( i == n ) : last = v prev = v StayConstraint ( last , Strength . STRONG_DEFAULT ) edit = EditConstraint ( first , Strength . PREFERRED ) edits = OrderedCollection ( ) edits . append ( edit ) plan = planner . extract_plan_from_constraints ( edits ) for i in range ( 100 ) : first . value = i plan . execute ( ) if ( last . value != i ) : print ( 'Chain test failed.' )
this is the standard deltablue benchmark .