diff --git a/code/python/.ipynb_checkpoints/EventLattice-checkpoint.ipynb b/code/python/.ipynb_checkpoints/EventLattice-checkpoint.ipynb new file mode 100644 index 0000000..829cb1d --- /dev/null +++ b/code/python/.ipynb_checkpoints/EventLattice-checkpoint.ipynb @@ -0,0 +1,113 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "57fc5921-9d6b-4b43-a8f6-743a03650d63", + "metadata": {}, + "outputs": [], + "source": [ + "import event_lattice as el" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "00f0eb68", + "metadata": {}, + "outputs": [], + "source": [ + "def zoom_event(event_str, lattice, lower_op=el.sum_op, upper_op=el.prod_op):\n", + " event = el.Event.from_str(event_str)\n", + " event_class = lattice.event_class(event)\n", + " propagated = lattice.propagated_value(\n", + " event, lower_op=lower_op, upper_op=upper_op)\n", + "\n", + " print(\n", + " f\"Event: {event}\\n\\tClass: {event_class} \\n\\tValue: {propagated}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cdd8c6d6", + "metadata": {}, + "outputs": [], + "source": [ + "smodels = el.Lattice.parse({\n", + " \"A\": 2,\n", + " \"ab\": 3,\n", + " \"ac\": 5\n", + "})\n", + "\n", + "lattice = el.Lattice(smodels)\n", + "\n", + "print(lattice)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2b445339", + "metadata": {}, + "outputs": [], + "source": [ + "zoom_event(\"abc\", lattice)\n", + "zoom_event(\"a\", lattice)\n", + "zoom_event(\"b\", lattice)\n", + "zoom_event(\"bc\", lattice)\n", + "zoom_event(\"ac\", lattice)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f1b85255", + "metadata": {}, + "outputs": [], + "source": [ + "from itertools import *\n", + "\n", + "lits = lattice.literals()\n", + "for len_lit in range(len(lits)+1):\n", + " events = list(\"\".join(c) for c in combinations(lits, len_lit))\n", + " for event in events:\n", + " zoom_event(event, lattice)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "07973a47", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.9.13 ('base')", + "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.9.13" + }, + "vscode": { + "interpreter": { + "hash": "a59afa236e16843183c59a167f072b6fa0409044b3c4938e82ac98aad91bf217" + } + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/code/python/EventLattice.ipynb b/code/python/EventLattice.ipynb index ebc474a..6fa5074 100644 --- a/code/python/EventLattice.ipynb +++ b/code/python/EventLattice.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 7, "id": "57fc5921-9d6b-4b43-a8f6-743a03650d63", "metadata": {}, "outputs": [], @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 8, "id": "00f0eb68", "metadata": {}, "outputs": [], @@ -29,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "id": "cdd8c6d6", "metadata": {}, "outputs": [ @@ -62,7 +62,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "id": "2b445339", "metadata": {}, "outputs": [ @@ -71,10 +71,10 @@ "output_type": "stream", "text": [ "Event: abc\n", - "\tClass: <|ab,ac> \n", + "\tClass: <|ac,ab> \n", "\tValue: 8\n", "Event: a\n", - "\tClass: \n", + "\tClass: \n", "\tValue: 15\n", "Event: b\n", "\tClass: \n", @@ -98,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "id": "f1b85255", "metadata": {}, "outputs": [ @@ -107,7 +107,7 @@ "output_type": "stream", "text": [ "Event: \n", - "\tClass: \n", + "\tClass: \n", "\tValue: 30\n", "Event: A\n", "\tClass: \n", @@ -115,188 +115,188 @@ "Event: b\n", "\tClass: \n", "\tValue: 3\n", + "Event: a\n", + "\tClass: \n", + "\tValue: 15\n", "Event: B\n", "\tClass: <|> \n", "\tValue: 0\n", - "Event: C\n", - "\tClass: <|> \n", - "\tValue: 0\n", "Event: c\n", "\tClass: \n", "\tValue: 5\n", - "Event: a\n", - "\tClass: \n", - "\tValue: 15\n", + "Event: C\n", + "\tClass: <|> \n", + "\tValue: 0\n", "Event: Ab\n", "\tClass: <|A> \n", "\tValue: 2\n", - "Event: AB\n", + "Event: Aa\n", "\tClass: <|A> \n", - "\tValue: 2\n", - "Event: AC\n", + "\tValue: 0\n", + "Event: AB\n", "\tClass: <|A> \n", "\tValue: 2\n", "Event: Ac\n", "\tClass: <|A> \n", "\tValue: 2\n", - "Event: Aa\n", + "Event: AC\n", "\tClass: <|A> \n", - "\tValue: 0\n", + "\tValue: 2\n", + "Event: ab\n", + "\tClass: \n", + "\tValue: 3\n", "Event: Bb\n", "\tClass: <|> \n", "\tValue: 0\n", + "Event: bc\n", + "\tClass: <|> \n", + "\tValue: 0\n", "Event: Cb\n", "\tClass: <|> \n", "\tValue: 0\n", - "Event: bc\n", + "Event: Ba\n", "\tClass: <|> \n", "\tValue: 0\n", - "Event: ab\n", - "\tClass: \n", - "\tValue: 3\n", - "Event: BC\n", + "Event: ac\n", + "\tClass: \n", + "\tValue: 5\n", + "Event: Ca\n", "\tClass: <|> \n", "\tValue: 0\n", "Event: Bc\n", "\tClass: <|> \n", "\tValue: 0\n", - "Event: Ba\n", + "Event: BC\n", "\tClass: <|> \n", "\tValue: 0\n", "Event: Cc\n", "\tClass: <|> \n", "\tValue: 0\n", - "Event: Ca\n", - "\tClass: <|> \n", + "Event: Aab\n", + "\tClass: <|A,ab> \n", "\tValue: 0\n", - "Event: ac\n", - "\tClass: \n", - "\tValue: 5\n", "Event: ABb\n", "\tClass: <|A> \n", "\tValue: 0\n", - "Event: ACb\n", - "\tClass: <|A> \n", - "\tValue: 2\n", "Event: Abc\n", "\tClass: <|A> \n", "\tValue: 2\n", - "Event: Aab\n", - "\tClass: <|A,ab> \n", - "\tValue: 0\n", - "Event: ABC\n", - "\tClass: <|A> \n", - "\tValue: 2\n", - "Event: ABc\n", + "Event: ACb\n", "\tClass: <|A> \n", "\tValue: 2\n", "Event: ABa\n", "\tClass: <|A> \n", "\tValue: 0\n", - "Event: ACc\n", - "\tClass: <|A> \n", - "\tValue: 0\n", - "Event: ACa\n", - "\tClass: <|A> \n", - "\tValue: 0\n", "Event: Aac\n", "\tClass: <|A,ac> \n", "\tValue: 0\n", - "Event: BCb\n", - "\tClass: <|> \n", + "Event: ACa\n", + "\tClass: <|A> \n", "\tValue: 0\n", - "Event: Bbc\n", - "\tClass: <|> \n", + "Event: ABc\n", + "\tClass: <|A> \n", + "\tValue: 2\n", + "Event: ABC\n", + "\tClass: <|A> \n", + "\tValue: 2\n", + "Event: ACc\n", + "\tClass: <|A> \n", "\tValue: 0\n", "Event: Bab\n", "\tClass: <|ab> \n", "\tValue: 0\n", - "Event: Cbc\n", - "\tClass: <|> \n", - "\tValue: 0\n", + "Event: abc\n", + "\tClass: <|ac,ab> \n", + "\tValue: 8\n", "Event: Cab\n", "\tClass: <|ab> \n", "\tValue: 3\n", - "Event: abc\n", - "\tClass: <|ab,ac> \n", - "\tValue: 8\n", - "Event: BCc\n", + "Event: Bbc\n", "\tClass: <|> \n", "\tValue: 0\n", - "Event: BCa\n", + "Event: BCb\n", + "\tClass: <|> \n", + "\tValue: 0\n", + "Event: Cbc\n", "\tClass: <|> \n", "\tValue: 0\n", "Event: Bac\n", "\tClass: <|ac> \n", "\tValue: 5\n", + "Event: BCa\n", + "\tClass: <|> \n", + "\tValue: 0\n", "Event: Cac\n", "\tClass: <|ac> \n", "\tValue: 0\n", - "Event: ABCb\n", - "\tClass: <|A> \n", - "\tValue: 0\n", - "Event: ABbc\n", - "\tClass: <|A> \n", + "Event: BCc\n", + "\tClass: <|> \n", "\tValue: 0\n", "Event: ABab\n", "\tClass: <|A,ab> \n", "\tValue: 0\n", - "Event: ACbc\n", - "\tClass: <|A> \n", + "Event: Aabc\n", + "\tClass: <|A,ac,ab> \n", "\tValue: 0\n", "Event: ACab\n", "\tClass: <|A,ab> \n", "\tValue: 0\n", - "Event: Aabc\n", - "\tClass: <|A,ab,ac> \n", + "Event: ABbc\n", + "\tClass: <|A> \n", "\tValue: 0\n", - "Event: ABCc\n", + "Event: ABCb\n", "\tClass: <|A> \n", "\tValue: 0\n", - "Event: ABCa\n", + "Event: ACbc\n", "\tClass: <|A> \n", "\tValue: 0\n", "Event: ABac\n", "\tClass: <|A,ac> \n", "\tValue: 0\n", + "Event: ABCa\n", + "\tClass: <|A> \n", + "\tValue: 0\n", "Event: ACac\n", "\tClass: <|A,ac> \n", "\tValue: 0\n", - "Event: BCbc\n", - "\tClass: <|> \n", + "Event: ABCc\n", + "\tClass: <|A> \n", + "\tValue: 0\n", + "Event: Babc\n", + "\tClass: <|ac,ab> \n", "\tValue: 0\n", "Event: BCab\n", "\tClass: <|ab> \n", "\tValue: 0\n", - "Event: Babc\n", - "\tClass: <|ab,ac> \n", - "\tValue: 0\n", "Event: Cabc\n", - "\tClass: <|ab,ac> \n", + "\tClass: <|ac,ab> \n", + "\tValue: 0\n", + "Event: BCbc\n", + "\tClass: <|> \n", "\tValue: 0\n", "Event: BCac\n", "\tClass: <|ac> \n", "\tValue: 0\n", - "Event: ABCbc\n", - "\tClass: <|A> \n", + "Event: ABabc\n", + "\tClass: <|A,ac,ab> \n", "\tValue: 0\n", "Event: ABCab\n", "\tClass: <|A,ab> \n", "\tValue: 0\n", - "Event: ABabc\n", - "\tClass: <|A,ab,ac> \n", - "\tValue: 0\n", "Event: ACabc\n", - "\tClass: <|A,ab,ac> \n", + "\tClass: <|A,ac,ab> \n", + "\tValue: 0\n", + "Event: ABCbc\n", + "\tClass: <|A> \n", "\tValue: 0\n", "Event: ABCac\n", "\tClass: <|A,ac> \n", "\tValue: 0\n", "Event: BCabc\n", - "\tClass: <|ab,ac> \n", + "\tClass: <|ac,ab> \n", "\tValue: 0\n", "Event: ABCabc\n", - "\tClass: <|A,ab,ac> \n", + "\tClass: <|A,ac,ab> \n", "\tValue: 0\n" ] } @@ -305,10 +305,11 @@ "from itertools import *\n", "\n", "lits = lattice.literals()\n", + "events = []\n", "for len_lit in range(len(lits)+1):\n", - " events = list(\"\".join(c) for c in combinations(lits, len_lit))\n", - " for event in events:\n", - " zoom_event(event, lattice)" + " events = events + list(\"\".join(c) for c in combinations(lits, len_lit))\n", + "for event in events:\n", + " zoom_event(event, lattice)" ] }, { @@ -322,7 +323,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3.9.13 ('base')", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -336,7 +337,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.9.15" }, "vscode": { "interpreter": { diff --git a/code/python/event_lattice.py b/code/python/event_lattice.py index 28d5c11..9b6376d 100644 --- a/code/python/event_lattice.py +++ b/code/python/event_lattice.py @@ -110,7 +110,6 @@ class Event: class Lattice: - @staticmethod def parse(d): result = dict() diff --git a/meetings.md b/meetings.md index b709af4..aa8bdf7 100644 --- a/meetings.md +++ b/meetings.md @@ -1,10 +1,15 @@ ## Zugzwang Meetings + ### 2022-12-12 - Is the project proposal ok? How long/detailed should it be? - Initial exploratory code `event_lattice.py` and `EventLattice.ipynb` done. -- Start writing paper: Introduction, state of the art, motivation, _etc._ +- Start writing paper: Introduction, state of the art, motivation, key problems, _etc._ + - Target Conferences + - KR; + - [ICLP](https://waset.org/language-planning-conference-in-april-2023-in-lisbon); + - [ECAI](https://ecai2023.eu/) - Next task for prototype: - Get stable models from potassco/s(casp) - other? -- libgit2 0.21.2