diff --git a/.ipynb_checkpoints/Copycat-checkpoint.ipynb b/.ipynb_checkpoints/Copycat-checkpoint.ipynb new file mode 100644 index 0000000..2fd6442 --- /dev/null +++ b/.ipynb_checkpoints/Copycat-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/Copycat.ipynb b/Copycat.ipynb new file mode 100644 index 0000000..2225b63 --- /dev/null +++ b/Copycat.ipynb @@ -0,0 +1,81 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Copycat \n", + "\n", + "Just type your copycat example, and the number of iterations." + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Answered iijjkl (time 1374, final temperature 13.5)\n", + "Answered iijjll (time 665, final temperature 19.6)\n", + "Answered iijjll (time 406, final temperature 16.6)\n", + "Answered iijjkl (time 379, final temperature 47.9)\n", + "Answered iijjll (time 556, final temperature 19.2)\n", + "Answered iijjkl (time 813, final temperature 42.8)\n", + "Answered iijjll (time 934, final temperature 15.5)\n", + "Answered iijjkl (time 1050, final temperature 49.5)\n", + "Answered iijjkl (time 700, final temperature 44.0)\n", + "Answered iijjkl (time 510, final temperature 34.8)\n", + "Answered iijjkl (time 673, final temperature 18.1)\n", + "Answered iijjkl (time 1128, final temperature 19.8)\n", + "Answered iijjll (time 961, final temperature 19.9)\n", + "Answered iijjll (time 780, final temperature 16.5)\n", + "Answered iijjll (time 607, final temperature 17.8)\n", + "Answered iijjll (time 594, final temperature 39.7)\n", + "Answered iijjll (time 736, final temperature 18.4)\n", + "Answered iijjll (time 903, final temperature 18.6)\n", + "Answered iijjll (time 601, final temperature 20.6)\n", + "Answered iijjll (time 949, final temperature 42.4)\n", + "iijjll: 12 (avg time 724.3, avg temp 22.1)\n", + "iijjkl: 8 (avg time 828.4, avg temp 33.8)\n" + ] + } + ], + "source": [ + "%run main.py abc abd iijjkk --iterations 20" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.1" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/copycat/workspace.py b/copycat/workspace.py index fa679cf..658b36c 100644 --- a/copycat/workspace.py +++ b/copycat/workspace.py @@ -1,3 +1,6 @@ +"""Workspace module.""" + + from . import formulas from .bond import Bond from .correspondence import Correspondence @@ -14,6 +17,7 @@ def __adjustUnhappiness(values): class Workspace(object): def __init__(self, ctx): + """To initialize the workspace.""" self.ctx = ctx self.totalUnhappiness = 0.0 self.intraStringUnhappiness = 0.0 @@ -82,7 +86,7 @@ class Workspace(object): self.initial.updateIntraStringUnhappiness() self.target.updateIntraStringUnhappiness() - #TODO: use entropy + # TODO: use entropy def getUpdatedTemperature(self): self.calculateIntraStringUnhappiness() self.calculateInterStringUnhappiness()