Skip to content

Commit

Permalink
Include remaining examples in docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jendrikseipp committed Sep 14, 2020
1 parent 53df190 commit 57dd692
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 32 deletions.
12 changes: 7 additions & 5 deletions docs/downward.tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ Run tutorial experiment
-----------------------
.. highlight:: python

The script below is an example Fast Downward experiment. It is located at
``${LAB}/examples/lmcut.py``. After adapting ``REPO`` and
``BENCHMARKS_DIR`` to your setup, you can see the available steps with ::
The script below is an example Fast Downward experiment. After adapting
``REPO`` and ``BENCHMARKS_DIR`` to your setup, saving the file as
``lmcut.py`` and making it executable, you can see the available steps
with ::

./lmcut.py

Expand All @@ -83,6 +84,7 @@ Run individual steps with ::
You can use this file as a basis for your own experiments.

.. literalinclude:: ../examples/lmcut.py
:caption:

Have a look at other Fast Downward experiments in the ``examples``
directory and the `downward API <downward.experiment.html>`_.
The `Downward Lab API <downward.experiment.html>`_ shows you how to adjust
this example to your needs.
2 changes: 1 addition & 1 deletion docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ add ``exp.add_parse_again_step()`` to your experiment script
How can I make reports and plots for results obtained without Lab?
------------------------------------------------------------------

See `examples/report-external-results.py
See `report-external-results.py
<https://github.com/aibasel/lab/blob/master/examples/report-external-results.py>`_
for an example.

Expand Down
9 changes: 7 additions & 2 deletions docs/ff.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ Running other planners

The script below shows how to run the `FF planner
<http://fai.cs.uni-saarland.de/hoffmann/ff.html>`_ on a number of
classical planning benchmarks. It is located at ``examples/ff/ff.py``.
You can see the available steps with ::
classical planning benchmarks. You can see the available steps with ::

./ff.py

Expand All @@ -24,3 +23,9 @@ Downward experiments, we recommend taking a look at the
`<downward.tutorial>`_.

.. literalinclude:: ../examples/ff/ff.py
:caption:

Here is a simple parser for FF:

.. literalinclude:: ../examples/ff/ff-parser.py
:caption:
9 changes: 5 additions & 4 deletions docs/lab.tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Run tutorial experiment
.. highlight:: python

The following script shows a simple experiment that runs a naive vertex
cover solver on a set of benchmarks. You can find the whole experiment
under ``examples/vertex-cover/``.
cover solver on a set of benchmarks.

.. literalinclude:: ../examples/vertex-cover/exp.py
:caption:

You can see the available steps with ::

Expand All @@ -31,6 +31,7 @@ Select steps by name or index::
Here is the parser that the experiment uses:

.. literalinclude:: ../examples/vertex-cover/parser.py
:caption:

Have a look at other example experiments under ``examples/`` or go
directly to the `Lab API <lab.experiment.html>`_.
Find out how to create your own experiments by browsing the `Lab API
<lab.experiment.html>`_.
3 changes: 3 additions & 0 deletions docs/singularity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ The script below shows how to run Singularity planner images using
Downward Lab.

.. literalinclude:: ../examples/singularity/singularity-exp.py
:caption:

The experiment script needs a parser and a helper script:

.. literalinclude:: ../examples/singularity/singularity-parser.py
:caption:

.. literalinclude:: ../examples/singularity/run-singularity.sh
:caption:
35 changes: 17 additions & 18 deletions lab/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,32 @@
"""
Parse logs and output files.
A parser can be any program that analyzes files in the run's
directory (e.g. ``run.log``) and manipulates the ``properties``
file in the same directory.
A parser can be any program that analyzes files in the run's directory
(e.g. ``run.log``) and manipulates the ``properties`` file in the same
directory.
To make parsing easier, however, you can use the ``Parser`` class. The
parser ``examples/ff/ff-parser.py`` serves as an example:
To make parsing easier, however, you can use the ``Parser`` class. Here is
an example parser for the FF planner:
.. literalinclude:: ../examples/ff/ff-parser.py
:caption:
You can add this parser to alls runs by using
:meth:`add_parser() <lab.experiment.Experiment.add_parser>`:
You can add this parser to alls runs by using :meth:`add_parser()
<lab.experiment.Experiment.add_parser>`:
>>> import os.path
>>> from lab import experiment
>>> exp = experiment.Experiment()
>>> # The path can be absolute or relative to the working directory
>>> # at build time.
>>> parser = os.path.abspath(
... os.path.join(__file__, '../../examples/ff/ff-parser.py'))
>>> from pathlib import Path
>>> from lab.experiment import Experiment
>>> exp = Experiment()
>>> # The path can be absolute or relative to the working directory at build time.
>>> parser = Path(__file__).resolve().parents[1] / "examples/ff/ff-parser.py"
>>> exp.add_parser(parser)
All added parsers will be run in the order in which they were added
after executing the run's commands.
All added parsers will be run in the order in which they were added after
executing the run's commands.
If you need to change your parsers and execute them again, use the
:meth:`~lab.experiment.Experiment.add_parse_again_step` method to
re-parse your results.
:meth:`~lab.experiment.Experiment.add_parse_again_step` method to re-parse
your results.
"""

Expand Down
3 changes: 1 addition & 2 deletions lab/reports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ def __init__(self, attributes=None, format="html", filter=None, **kwargs):
>>> report = Report(
... filter=rename_algorithms, filter_algorithm=algorithms)
Compute a new attribute from multiple runs (from
`examples/showcase-options.py`):
Compute a new attribute from multiple runs:
.. literalinclude:: ../examples/showcase-options.py
:pyobject: QualityFilters
Expand Down

0 comments on commit 57dd692

Please sign in to comment.