From 1ee31762275e0b871f526e60f518f353654d3da4 Mon Sep 17 00:00:00 2001 From: davidedellagiustina Date: Tue, 6 Feb 2024 11:53:01 +0000 Subject: [PATCH] Examples documentation --- justfile | 2 +- src/examples/grover_search_known_m.py | 5 ++++- src/examples/oracle_construction.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/justfile b/justfile index f79805d..bd8b67f 100644 --- a/justfile +++ b/justfile @@ -14,7 +14,7 @@ list: # Run a selected example from the examples folder run example: - ( \ + @ ( \ export PYTHONPATH={{python_path}}; \ export NAME=`echo {{example}} | sed 's/\.py//'`; \ python ./src/examples/$NAME.py \ diff --git a/src/examples/grover_search_known_m.py b/src/examples/grover_search_known_m.py index 2f6d782..66954ff 100644 --- a/src/examples/grover_search_known_m.py +++ b/src/examples/grover_search_known_m.py @@ -1,6 +1,9 @@ '''Find the models of an ASP program using the naive Grover search algorithm. + +Exapmple 4.1.1 in the thesis document shows how to use the Grover Search algorithm \ +to find the stable models of an ASP program. This example provides an implementation \ +of that technique, to show how it can be used in practice. ''' -# TODO: Better docstring with reference to the corresponding example in the thesis. from src import qasp from src.examples.util import tab, pause diff --git a/src/examples/oracle_construction.py b/src/examples/oracle_construction.py index adc7d4f..67e8a45 100644 --- a/src/examples/oracle_construction.py +++ b/src/examples/oracle_construction.py @@ -1,6 +1,6 @@ '''Grover Search with a quantum oracle built from the classical procedure. -Example 4.1.1 in the thesis shows how to build a quantum oracle for a trivial ASP program using the +Example 4.2.1 in the thesis shows how to build a quantum oracle for a trivial ASP program using the classical procedure. This example applies the Grover Search algorithm in order to demonstrate the correctness of the built operator. '''