start work om distributed decision making

This commit is contained in:
Alexandre Linhares
2017-09-07 19:26:10 -03:00
committed by Alexandre Linhares
parent 0a54c0ee83
commit 0905d35680
5 changed files with 176596 additions and 128289 deletions

View File

@ -4,12 +4,14 @@ import logging
from copycat import Copycat, Reporter
class SimpleReporter(Reporter):
def report_answer(self, answer):
print('Answered %s (time %d, final temperature %.1f)' % (
answer['answer'], answer['time'], answer['temp'],
))
def main():
logging.basicConfig(level=logging.INFO, format='%(message)s', filename='./copycat.log', filemode='w')
@ -27,5 +29,6 @@ def main():
for answer, d in sorted(iter(answers.items()), key=lambda kv: kv[1]['avgtemp']):
print('%s: %d (avg time %.1f, avg temp %.1f)' % (answer, d['count'], d['avgtime'], d['avgtemp']))
if __name__ == '__main__':
main()