Skip to content

Commit cde59f6

Browse files
committed
Set up RTD documentation
1 parent 8688101 commit cde59f6

File tree

13 files changed

+189
-20
lines changed

13 files changed

+189
-20
lines changed

.readthedocs.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-20.04
11+
tools:
12+
python: "3.8"
13+
apt_packages:
14+
- swig
15+
16+
sphinx:
17+
configuration: conf.py
18+
19+
python:
20+
install:
21+
- requirements: rtd_requirements.txt
22+

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _readthedocs
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Selector: Ensemble-based Offline Algorithm Configuration
1+
# Selector: Ensemble-based Automated Algorithm Configuration
22

33
An algorithm configurator in Python using multiple configuration generators and models derived from state-of-the-art methods.
44

@@ -10,7 +10,7 @@ An algorithm configurator in Python using multiple configuration generators and
1010

1111
# Installation
1212

13-
You can use selector from the files in this repository or install it via
13+
You can use selector from the files the github repository or install it via
1414

1515
```
1616
pip install selector-ac

conf.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import os
2+
import sys
3+
4+
# Add the module path (if needed)
5+
sys.path.insert(0, os.path.abspath('.'))
6+
7+
# -- Project information -----------------------------------------------------
8+
project = 'selector'
9+
copyright = '2024, Dimitri Weiss'
10+
author = 'Dimitri Weiss'
11+
release = '0.0.1'
12+
13+
# -- Sphinx Extensions ------------------------------------------------------
14+
extensions = [
15+
'sphinx.ext.autodoc',
16+
'sphinx.ext.autosectionlabel',
17+
]
18+
19+
# -- Mocking Missing Modules ------------------------------------------------
20+
# This prevents Sphinx from failing when importing unavailable dependencies
21+
#autodoc_mock_imports = ["selector", "selector.run_ac", "irace"]
22+
23+
# Alternatively, you can mock them explicitly using unittest.mock
24+
#MOCK_MODULES = ["selector", "selector.run_ac"]
25+
#for mod_name in MOCK_MODULES:
26+
# sys.modules[mod_name] = mock.Mock()
27+
28+
# MOCK_MODULES = ["selector", "selector.run_ac"]
29+
# sys.modules.update((mod, mock.Mock()) for mod in MOCK_MODULES)
30+
31+
# autodoc_mock_imports = ["selector", "selector.run_ac", "irace", "ac", "up_lpg",
32+
# "smac"]
33+
34+
# -- HTML Output ------------------------------------------------------------
35+
html_theme = "sphinx_rtd_theme"
36+
templates_path = ['_templates']
37+
html_static_path = ['_static']
38+
html_build_dir = '$READTHEDOCS_OUTPUT/html/'

index.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
===============
2+
Selector
3+
===============
4+
5+
Welcome to Selectors's documentation! Please check out how to install it using the :ref:`installation` guide.
6+
For information about how to use it and what general functions there are look at the :ref:`usage` section.
7+
8+
.. toctree::
9+
:maxdepth: 2
10+
:caption: Contents:
11+
12+
installation
13+
usage

installation.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.. _installation:
2+
3+
Installation Guide
4+
==================
5+
6+
Requirements
7+
------------
8+
9+
10+
The project is developed in Python 3.8.5. It is highly recommended to use a virtual environment in linux.
11+
12+
13+
AC Methods
14+
----------------
15+
16+
You can install it via:
17+
18+
.. code-block:: bash
19+
20+
pip install selector-ac
21+
22+
Currently these:
23+
24+
- GGA
25+
- CPPL
26+
- SMAC
27+

make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_READTHEDOCS_OUTPUT
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

rtd_requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-r requirements.txt
2+
mock
3+
sphinx-rtd-theme==1.3.0
4+
sphinx==7.1.2

selector/best_conf.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,21 @@ def safe_best(path, penalty):
8686

8787
inst_sizes = list(perfs.keys())
8888
inst_sizes.reverse()
89+
best = list(perfs[inst_sizes[0]].keys())[0]
90+
best_perf = perfs[inst_sizes[0]][best]
91+
92+
# Check if last entry had enough evaluation
8993
for i, isize in enumerate(inst_sizes):
90-
if len(perfs[isize]) > 1:
91-
nn_1 = sum(1 for v in data[list(perfs[isize].keys())[0]].values()
94+
if len(perfs[isize]) > 1 and len(inst_sizes) > i + 1:
95+
if (perfs[isize][list(perfs[isize].keys())[0]]
96+
< perfs[inst_sizes[i + 1]]
97+
[list(perfs[inst_sizes[i + 1]].keys())[0]]):
98+
best = list(perfs[isize].keys())[0]
99+
best_perf = perfs[isize][best]
100+
break
101+
102+
nn_1 = sum(1 for v in data[list(perfs[isize].keys())[0]]
103+
.values()
92104
if not math.isnan(v))
93105
nn_sum_1 = sum(v for v in data[list(perfs[isize]
94106
.keys())[0]].values()
@@ -99,18 +111,11 @@ def safe_best(path, penalty):
99111
.keys())[0]].values()
100112
if not math.isnan(v))
101113

102-
if (perfs[isize][list(perfs[isize].keys())[0]]
103-
< perfs[inst_sizes[i + 1]]
104-
[list(perfs[inst_sizes[i + 1]].keys())[0]]):
105-
best = list(perfs[isize].keys())[0]
106-
best_perf = perfs[isize][best]
107-
break
108-
109-
elif nn_1 >= nn_2 and nn_sum_1 <= nn_sum_2:
114+
if nn_1 < nn_2 and nn_sum_1 < nn_sum_2:
110115
best = list(perfs[isize].keys())[0]
111116
best_perf = perfs[isize][best]
112117

113-
elif nn_1 <= nn_2 and nn_sum_1 >= nn_sum_2:
118+
elif nn_1 > nn_2 and nn_sum_1 > nn_sum_2:
114119
best = list(perfs[inst_sizes[i + 1]].keys())[0]
115120
best_perf = perfs[inst_sizes[i + 1]][best]
116121

selector/scenario.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def parse_args():
204204
so.add_argument('--run_obj', type=str)
205205
so.add_argument('--overall_obj', type=str)
206206
so.add_argument('--cutoff_time', type=str)
207-
so.add_argument('--crash_cost', type=str, default='10000000')
207+
so.add_argument('--crash_cost', type=float, default='10000000')
208208
so.add_argument('--wallclock_limit', type=str)
209209
so.add_argument('--instance_file', type=str)
210210
so.add_argument('--feature_file', type=str)

0 commit comments

Comments
 (0)