# returns each singleton ask within some range
# of he asking price
for prices in AskPrices(myprice,bounds)
Mkke this iterator have option arguments for bouding the search.
for g in groups(2,4) # select all blocks containing 2-4 singletons
for n in probable(p1,p2) # all graphs with probability p1 and p2
The framework, in this suggestion, uses the iterators as the base search class for bots. Every for loop will start counting from the top, usually skipping blocks util he start target is reached.
There is the possibility of making one master iterator, and it is called with a dictionary that defines he more specific selection process. Or, incorporate the graphoperator constant again as in:
for z in iterate(fun) # specify the specific selection condition for iterator class iterate.
In all classes, the descent is from the top, until the specified target node is reached, the condition is then applied in steps as it is met, until the ending range is reached. So mapping my concept of traversal to the python concept of iteration puts the developers in a very comfortable position.
Here is my untested iterator.
class collection:
def __init(self,id,fun,arglist=None) :
nodes.fun = fun
nodes.arg = arglist
node.ids
def __iter__ (self): return(self)
def __next__(self)
while ids.len() :
id = ids.pop()
self = G.GET(id)
end = id + self.count # warning here, a function call may alter node values
if fun(self,id,arglist) != CONTINUE : return(end)
id = id + 1 # skip the anchor
if self.return_val == BLOCK :
self.return_val = CONTINUE
ids.push(end)
raise(StopIteration)
The iterator is used as in:
class collection:
def __init(self,id,fun,arglist=None) :
nodes.fun = fun
nodes.arg = arglist
node.ids
def __iter__ (self): return(self)
def __next__(self)
while ids.len() :
id = ids.pop()
self = G.GET(id)
end = id + self.count # warning here, a function call may alter node values
if fun(self,id,arglist) != CONTINUE : return(self)
id = id + 1 # skip the anchor
if self.return_val == BLOCK :
self.return_val = CONTINUE
ids.push(end)
raise StopIteration)
#now let's use it
for single in collection(minimum,maximum=5) :
#find the minimum price over the graph
if makebid(self,single) : return()
Look at the five minimum prices over the graph and try to deal, up to five attempts
No comments:
Post a Comment