pydmoo 0.0.7__tar.gz → 0.0.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. pydmoo-0.0.9/.github/workflows/docs.yml +71 -0
  2. {pydmoo-0.0.7 → pydmoo-0.0.9}/PKG-INFO +1 -1
  3. pydmoo-0.0.9/docs/api-auto/pydmoo.md +12 -0
  4. pydmoo-0.0.9/docs/api-auto/response.ar_model.md +9 -0
  5. pydmoo-0.0.9/docs/api-auto/response.tca_model.md +9 -0
  6. pydmoo-0.0.9/docs/api-auto.md +10 -0
  7. pydmoo-0.0.9/docs/index.md +2 -0
  8. pydmoo-0.0.9/docs/reference/algorithms/diversity-based.md +1 -0
  9. pydmoo-0.0.9/docs/reference/algorithms/index.md +1 -0
  10. pydmoo-0.0.9/docs/reference/applications/index.md +1 -0
  11. pydmoo-0.0.9/docs/reference/index.md +1 -0
  12. pydmoo-0.0.9/docs/reference/metrics/index.md +1 -0
  13. pydmoo-0.0.9/docs/reference/problems/benchmarks.md +1 -0
  14. pydmoo-0.0.9/docs/reference/problems/index.md +1 -0
  15. pydmoo-0.0.9/docs/users-guide/bug-report.md +1 -0
  16. pydmoo-0.0.9/docs/users-guide/installation.md +19 -0
  17. pydmoo-0.0.9/docs/users-guide/pull-request.md +1 -0
  18. pydmoo-0.0.9/generate_docs.py +255 -0
  19. pydmoo-0.0.9/mkdocs.yml +150 -0
  20. pydmoo-0.0.9/pydmoo/response/__init__.py +0 -0
  21. pydmoo-0.0.9/pydmoo/response/ar_model.py +96 -0
  22. pydmoo-0.0.9/pydmoo/response/tca_model.py +152 -0
  23. pydmoo-0.0.9/pydmoo.sublime-project +39 -0
  24. {pydmoo-0.0.7 → pydmoo-0.0.9}/pyproject.toml +11 -4
  25. {pydmoo-0.0.7 → pydmoo-0.0.9}/uv.lock +521 -4
  26. {pydmoo-0.0.7 → pydmoo-0.0.9}/.github/workflows/publish.yml +0 -0
  27. {pydmoo-0.0.7 → pydmoo-0.0.9}/.gitignore +0 -0
  28. {pydmoo-0.0.7 → pydmoo-0.0.9}/.python-version +0 -0
  29. {pydmoo-0.0.7 → pydmoo-0.0.9}/CODE_OF_CONDUCT.md +0 -0
  30. {pydmoo-0.0.7 → pydmoo-0.0.9}/LICENSE +0 -0
  31. {pydmoo-0.0.7 → pydmoo-0.0.9}/README.md +0 -0
  32. {pydmoo-0.0.7 → pydmoo-0.0.9}/pydmoo/__init__.py +0 -0
@@ -0,0 +1,71 @@
1
+ name: Deploy Documentation
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v5
14
+
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v6
17
+ with:
18
+ python-version: "3.12"
19
+
20
+ - name: Cache pip
21
+ uses: actions/cache@v4
22
+ with:
23
+ path: ~/.cache/pip
24
+ key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
25
+ restore-keys: |
26
+ ${{ runner.os }}-pip-
27
+
28
+ - name: Install dependencies
29
+ run: |
30
+ pip install mkdocs mkdocs-autorefs mkdocs-material mkdocs-material-extensions mkdocstrings[python] mkdocs-minify-plugin mkdocs-redirects
31
+
32
+ - name: Generate API docs
33
+ run: python generate_docs.py
34
+
35
+ - name: Build documentation (strict)
36
+ run: mkdocs build --strict
37
+
38
+ deploy:
39
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
40
+ runs-on: ubuntu-latest
41
+ needs: test
42
+ steps:
43
+ - uses: actions/checkout@v5
44
+
45
+ - name: Set up Python
46
+ uses: actions/setup-python@v6
47
+ with:
48
+ python-version: "3.12"
49
+
50
+ - name: Cache pip
51
+ uses: actions/cache@v4
52
+ with:
53
+ path: ~/.cache/pip
54
+ key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
55
+ restore-keys: |
56
+ ${{ runner.os }}-pip-
57
+
58
+ - name: Install dependencies
59
+ run: |
60
+ pip install mkdocs mkdocs-autorefs mkdocs-material mkdocs-material-extensions mkdocstrings[python] mkdocs-minify-plugin mkdocs-redirects
61
+
62
+ - name: Generate API docs
63
+ run: python generate_docs.py
64
+
65
+ - name: Configure Git
66
+ run: |
67
+ git config user.name "GitHub Actions"
68
+ git config user.email "actions@github.com"
69
+
70
+ - name: Deploy to GitHub Pages
71
+ run: mkdocs gh-deploy --force --remote-branch gh-pages
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydmoo
3
- Version: 0.0.7
3
+ Version: 0.0.9
4
4
  Summary: pydmoo
5
5
  Project-URL: Homepage, https://github.com/dynoptimization/pydmoo
6
6
  Project-URL: Repository, https://github.com/dynoptimization/pydmoo
@@ -0,0 +1,12 @@
1
+ # pydmoo API Reference
2
+
3
+ pydmoo is a dynamic multi-objective optimization library providing various optimization algorithms and tools.
4
+
5
+ ## Module Overview
6
+
7
+ ::: pydmoo
8
+ options:
9
+ show_root_heading: false
10
+ show_submodules: true
11
+ heading_level: 3
12
+ show_source: false
@@ -0,0 +1,9 @@
1
+ # response.ar_model
2
+
3
+ ::: pydmoo.response.ar_model
4
+ options:
5
+ show_root_heading: false
6
+ show_submodules: true
7
+ heading_level: 2
8
+ show_source: true
9
+ show_category_heading: true
@@ -0,0 +1,9 @@
1
+ # response.tca_model
2
+
3
+ ::: pydmoo.response.tca_model
4
+ options:
5
+ show_root_heading: false
6
+ show_submodules: true
7
+ heading_level: 2
8
+ show_source: true
9
+ show_category_heading: true
@@ -0,0 +1,10 @@
1
+ # API Reference
2
+
3
+ This is the complete API reference documentation for the pydmoo library.
4
+
5
+ ## Module List
6
+
7
+ ### Root Modules
8
+
9
+ - [response.ar_model](api-auto/response.ar_model.md)
10
+ - [response.tca_model](api-auto/response.tca_model.md)
@@ -0,0 +1,2 @@
1
+
2
+ pydmoo: Dynamic Multi-Objective Optimization in Python
@@ -0,0 +1 @@
1
+ # Diversity-Based Algorithms
@@ -0,0 +1 @@
1
+ # Algorithms
@@ -0,0 +1 @@
1
+ # Applications
@@ -0,0 +1 @@
1
+ # Reference
@@ -0,0 +1 @@
1
+ # Metrics
@@ -0,0 +1 @@
1
+ # Benchmarks
@@ -0,0 +1 @@
1
+ # Problems
@@ -0,0 +1 @@
1
+ # Bug report
@@ -0,0 +1,19 @@
1
+ # Installation
2
+
3
+ ## [uv](https://docs.astral.sh/uv/)
4
+
5
+ ```shell
6
+ uv add pydmoo
7
+ ```
8
+
9
+ ## [poetry](https://python-poetry.org/)
10
+
11
+ ```shell
12
+ poetry add pydmoo
13
+ ```
14
+
15
+ ## [pip](https://pip.pypa.io/en/stable/)
16
+
17
+ ```shell
18
+ pip install pydmoo
19
+ ```
@@ -0,0 +1 @@
1
+ # Pull Requests
@@ -0,0 +1,255 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """
4
+ Documentation Generation Script.
5
+
6
+ This script is used to automatically generate API documentation for the pydmoo library.
7
+ It scans the source code directory and generates corresponding Markdown files for MkDocs build.
8
+ """
9
+
10
+ import os
11
+ import sys
12
+ from pathlib import Path
13
+ from typing import Any, Dict, List
14
+
15
+
16
+ class DocGenerator:
17
+ """Documentation generator class."""
18
+
19
+ def __init__(self, source_dir: str = "pydmoo", docs_dir: str = "docs"):
20
+ """
21
+ Initialize the documentation generator.
22
+
23
+ Parameters
24
+ ----------
25
+ source_dir : str
26
+ Python source code directory
27
+ docs_dir : str
28
+ Documentation output directory
29
+ """
30
+ self.source_dir = Path(source_dir)
31
+ self.docs_dir = Path(docs_dir)
32
+ self.api_dir = self.docs_dir / "api-auto"
33
+
34
+ # Create necessary directories
35
+ self.api_dir.mkdir(parents=True, exist_ok=True)
36
+
37
+ def discover_modules(self) -> List[Path]:
38
+ """
39
+ Discover all Python modules.
40
+
41
+ Returns
42
+ -------
43
+ List[Path]
44
+ List of found Python module paths
45
+ """
46
+ modules = []
47
+
48
+ for py_file in self.source_dir.rglob("*.py"):
49
+ # Skip __pycache__ directories and test files
50
+ if "__pycache__" in str(py_file) or "test" in str(py_file).lower():
51
+ continue
52
+
53
+ # Skip empty files and __init__.py files (handled separately)
54
+ if py_file.name == "__init__.py":
55
+ continue
56
+
57
+ modules.append(py_file)
58
+
59
+ return modules
60
+
61
+ def get_module_info(self, module_path: Path) -> Dict[str, Any]:
62
+ """
63
+ Get module information.
64
+
65
+ Parameters
66
+ ----------
67
+ module_path : Path
68
+ Module file path
69
+
70
+ Returns
71
+ -------
72
+ Dict[str, Any]
73
+ Module information dictionary
74
+ """
75
+ # Calculate relative import path
76
+ relative_path = module_path.relative_to(self.source_dir)
77
+ module_name = str(relative_path).replace("/", ".").replace("\\", ".").replace(".py", "")
78
+
79
+ return {
80
+ "path": module_path,
81
+ "name": module_name,
82
+ "import_path": f"pydmoo.{module_name}",
83
+ "doc_path": self.api_dir / f"{module_name}.md"
84
+ }
85
+
86
+ def generate_module_doc(self, module_info: Dict[str, Any]) -> str:
87
+ """
88
+ Generate documentation content for a single module.
89
+
90
+ Parameters
91
+ ----------
92
+ module_info : Dict[str, Any]
93
+ Module information
94
+
95
+ Returns
96
+ -------
97
+ str
98
+ Markdown formatted documentation content
99
+ """
100
+ module_name = module_info["name"]
101
+ import_path = module_info["import_path"]
102
+
103
+ content = [
104
+ f"# {module_name}",
105
+ "",
106
+ f"::: {import_path}",
107
+ " options:",
108
+ " show_root_heading: false",
109
+ " show_submodules: true",
110
+ " heading_level: 2",
111
+ " show_source: true",
112
+ " show_category_heading: true",
113
+ ""
114
+ ]
115
+
116
+ return "\n".join(content)
117
+
118
+ def generate_package_doc(self) -> str:
119
+ """
120
+ Generate documentation for the main package.
121
+
122
+ Returns
123
+ -------
124
+ str
125
+ Main package documentation content
126
+ """
127
+ content = [
128
+ "# pydmoo API Reference",
129
+ "",
130
+ "pydmoo is a dynamic multi-objective optimization library providing various optimization algorithms and tools.",
131
+ "",
132
+ "## Module Overview",
133
+ "",
134
+ "::: pydmoo",
135
+ " options:",
136
+ " show_root_heading: false",
137
+ " show_submodules: true",
138
+ " heading_level: 3",
139
+ " show_source: false",
140
+ ""
141
+ ]
142
+
143
+ return "\n".join(content)
144
+
145
+ def generate_api_index(self) -> str:
146
+ """
147
+ Generate API index page.
148
+
149
+ Returns
150
+ -------
151
+ str
152
+ Index page content
153
+ """
154
+ modules = self.discover_modules()
155
+ module_infos = [self.get_module_info(module) for module in modules]
156
+
157
+ content = [
158
+ "# API Reference",
159
+ "",
160
+ "This is the complete API reference documentation for the pydmoo library.",
161
+ "",
162
+ "## Module List",
163
+ ""
164
+ ]
165
+
166
+ # Group modules by directory
167
+ modules_by_dir = {}
168
+ for info in module_infos:
169
+ dir_path = str(Path(info["name"]).parent)
170
+ if dir_path == ".":
171
+ dir_path = "Root Modules"
172
+ if dir_path not in modules_by_dir:
173
+ modules_by_dir[dir_path] = []
174
+ modules_by_dir[dir_path].append(info)
175
+
176
+ # Generate directory structure
177
+ for dir_name in sorted(modules_by_dir.keys()):
178
+ content.append(f"### {dir_name}")
179
+ content.append("")
180
+
181
+ for info in sorted(modules_by_dir[dir_name], key=lambda x: x["name"]):
182
+ module_name = info["name"]
183
+ doc_file = f"api-auto/{module_name}.md"
184
+ content.append(f"- [{module_name}]({doc_file})")
185
+
186
+ content.append("")
187
+
188
+ return "\n".join(content)
189
+
190
+ def write_file(self, filepath: Path, content: str) -> None:
191
+ """
192
+ Write content to file.
193
+
194
+ Parameters
195
+ ----------
196
+ filepath : Path
197
+ File path
198
+ content : str
199
+ File content
200
+ """
201
+ # Ensure directory exists
202
+ filepath.parent.mkdir(parents=True, exist_ok=True)
203
+
204
+ with open(filepath, "w", encoding="utf-8") as f:
205
+ f.write(content)
206
+
207
+ print(f"✓ Generated documentation: {filepath}")
208
+
209
+ def generate_all(self) -> None:
210
+ """Generate all documentation."""
211
+ print("Starting API documentation generation...")
212
+
213
+ # Generate documentation for individual modules
214
+ modules = self.discover_modules()
215
+ print(f"Found {len(modules)} modules")
216
+
217
+ for module_path in modules:
218
+ module_info = self.get_module_info(module_path)
219
+ doc_content = self.generate_module_doc(module_info)
220
+ self.write_file(module_info["doc_path"], doc_content)
221
+
222
+ # Generate API index
223
+ api_index_content = self.generate_api_index()
224
+ self.write_file(self.docs_dir / "api-auto.md", api_index_content)
225
+
226
+ # Generate main package documentation
227
+ package_content = self.generate_package_doc()
228
+ self.write_file(self.api_dir / "pydmoo.md", package_content)
229
+
230
+ print("Documentation generation completed!")
231
+
232
+
233
+ def main():
234
+ try:
235
+ # Check if source code directory exists
236
+ if not os.path.exists("pydmoo"):
237
+ print("Error: pydmoo directory not found")
238
+ print("Please ensure you are running this script from the project root directory")
239
+ sys.exit(1)
240
+
241
+ # Generate documentation
242
+ generator = DocGenerator()
243
+ generator.generate_all()
244
+
245
+ # Verify generated files
246
+ api_files = list(Path("docs/api").glob("*.md"))
247
+ print(f"Generated {len(api_files)} API documentation files")
248
+
249
+ except Exception as e:
250
+ print(f"Error generating documentation: {e}")
251
+ sys.exit(1)
252
+
253
+
254
+ if __name__ == "__main__":
255
+ main()
@@ -0,0 +1,150 @@
1
+ # Project information
2
+ site_name: pydmoo Documentations
3
+ site_url: https://github.com/dynoptimization/pydmoo
4
+ site_author: DynOpt
5
+ site_description: >-
6
+ Dynamic Multi-Objective Optimization in Python (pydmoo)
7
+
8
+ # Repository
9
+ repo_url: https://github.com/dynoptimization/pydmoo
10
+ repo_name: dynoptimization/pydmoo
11
+
12
+ # Copyright
13
+ copyright: Copyright © 2025 - 2025 DynOpt
14
+
15
+ # Configuration
16
+ theme:
17
+ name: material
18
+ features:
19
+ - announce.dismiss
20
+ # - content.action.edit
21
+ # - content.action.view
22
+ - content.code.annotate
23
+ - content.code.copy
24
+ # - content.code.select
25
+ # - content.footnote.tooltips
26
+ # - content.tabs.link
27
+ - content.tooltips
28
+ # - header.autohide
29
+ # - navigation.expand
30
+ - navigation.footer
31
+ - navigation.indexes
32
+ # - navigation.instant
33
+ # - navigation.instant.prefetch
34
+ # - navigation.instant.progress
35
+ # - navigation.prune
36
+ - navigation.sections
37
+ - navigation.tabs
38
+ # - navigation.tabs.sticky
39
+ - navigation.top
40
+ - navigation.tracking
41
+ - search.highlight
42
+ - search.share
43
+ - search.suggest
44
+ - toc.follow
45
+ # - toc.integrate
46
+ palette:
47
+ - scheme: default
48
+ primary: teal
49
+ accent: purple
50
+ toggle:
51
+ icon: material/brightness-7
52
+ name: Switch to dark mode
53
+ - scheme: slate
54
+ primary: teal
55
+ accent: purple
56
+ toggle:
57
+ icon: material/brightness-4
58
+ name: Switch to light mode
59
+
60
+ plugins:
61
+ - search:
62
+ lang: en
63
+ separator: '[\s\u200b\-_,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
64
+ - autorefs
65
+ - mkdocstrings:
66
+ default_handler: python
67
+ handlers:
68
+ python:
69
+ paths: [pydmoo]
70
+ options:
71
+ docstring_style: numpy
72
+ show_root_heading: true
73
+ show_source: true
74
+ show_category_heading: true
75
+ separate_signature: true
76
+ merge_init_into_class: true
77
+ - minify:
78
+ minify_html: true
79
+
80
+ # Extensions
81
+ markdown_extensions:
82
+ - abbr
83
+ - admonition
84
+ - attr_list
85
+ - def_list
86
+ - footnotes
87
+ - md_in_html
88
+ - toc:
89
+ permalink: true
90
+ - pymdownx.arithmatex:
91
+ generic: true
92
+ - pymdownx.betterem:
93
+ smart_enable: all
94
+ - pymdownx.caret
95
+ - pymdownx.details
96
+ - pymdownx.emoji:
97
+ emoji_generator: !!python/name:material.extensions.emoji.to_svg
98
+ emoji_index: !!python/name:material.extensions.emoji.twemoji
99
+ - pymdownx.highlight:
100
+ anchor_linenums: true
101
+ line_spans: __span
102
+ pygments_lang_class: true
103
+ - pymdownx.inlinehilite
104
+ - pymdownx.keys
105
+ - pymdownx.magiclink:
106
+ normalize_issue_symbols: true
107
+ repo_url_shorthand: true
108
+ user: squidfunk
109
+ repo: mkdocs-material
110
+ - pymdownx.mark
111
+ - pymdownx.smartsymbols
112
+ - pymdownx.snippets:
113
+ auto_append:
114
+ - includes/mkdocs.md
115
+ - pymdownx.superfences:
116
+ custom_fences:
117
+ - name: mermaid
118
+ class: mermaid
119
+ format: !!python/name:pymdownx.superfences.fence_code_format
120
+ - pymdownx.tabbed:
121
+ alternate_style: true
122
+ combine_header_slug: true
123
+ slugify: !!python/object/apply:pymdownx.slugs.slugify
124
+ kwds:
125
+ case: lower
126
+ - pymdownx.tasklist:
127
+ custom_checkbox: true
128
+ - pymdownx.tilde
129
+
130
+ nav:
131
+ - Home: index.md
132
+
133
+ - Getting Started:
134
+ - Installation: users-guide/installation.md
135
+
136
+ - API:
137
+ - pydmoo: api-auto/pydmoo.md
138
+ - API reference: api-auto.md
139
+
140
+ - Reference:
141
+ - reference/index.md
142
+ - Benchmarks: reference/problems/benchmarks.md
143
+ - Algorithms: reference/algorithms/diversity-based.md
144
+ - Metrics: reference/metrics/index.md
145
+ - Applications: reference/applications/index.md
146
+
147
+ - Community:
148
+ - Contributing:
149
+ - Reporting a bug: users-guide/bug-report.md
150
+ - Making a pull request: users-guide/pull-request.md
File without changes
@@ -0,0 +1,96 @@
1
+ import numpy as np
2
+
3
+
4
+ class ARModel:
5
+ """
6
+ Autoregressive (AR) model implementation from scratch.
7
+
8
+ Parameters
9
+ ----------
10
+ p : int
11
+ Order of the AR model (number of lagged observations)
12
+ """
13
+
14
+ def __init__(self, p):
15
+ self.p = p # AR order
16
+ self.coef_ = None # Model coefficients (including intercept if present)
17
+ self.resid_ = None # Residuals after fitting
18
+
19
+ def fit(self, y, trend="c"):
20
+ """
21
+ Fit AR model to time series data.
22
+
23
+ Parameters
24
+ ----------
25
+ y : ndarray, shape (M,)
26
+ Time series data of length M
27
+ trend : str, optional
28
+ 'c' for constant (default), 'n' for no intercept
29
+
30
+ Returns
31
+ -------
32
+ self : returns an instance of self
33
+ """
34
+ M = len(y)
35
+ if M <= self.p:
36
+ raise ValueError(f"Time series length M={M} must be > order p={self.p}")
37
+
38
+ # Construct design matrix X and target vector Y
39
+ X = np.zeros((M - self.p, self.p))
40
+ for i in range(self.p):
41
+ X[:, i] = y[(self.p - i - 1) : (M - i - 1)]
42
+
43
+ Y = y[self.p :]
44
+
45
+ # Add intercept if specified
46
+ if trend == "c":
47
+ X = np.column_stack([np.ones(X.shape[0]), X])
48
+
49
+ # Solve least squares problem
50
+ self.coef_ = np.linalg.lstsq(X, Y, rcond=None)[0]
51
+
52
+ # Store residuals
53
+ self.resid_ = Y - X @ self.coef_
54
+
55
+ return self
56
+
57
+ def predict(self, y, steps=1):
58
+ """
59
+ Predict future values using the fitted AR model.
60
+
61
+ Parameters
62
+ ----------
63
+ y : ndarray, shape (K,)
64
+ Input sequence (K >= p)
65
+ steps : int, optional
66
+ Number of steps to predict (default=1)
67
+
68
+ Returns
69
+ -------
70
+ predictions : ndarray, shape (steps,)
71
+ Predicted values
72
+ """
73
+ if len(y) < self.p:
74
+ raise ValueError(f"Input length {len(y)} must be >= model order {self.p}")
75
+ if self.coef_ is None:
76
+ raise ValueError("Model must be fitted before prediction")
77
+
78
+ predictions = np.zeros(steps)
79
+ history = y[-self.p :].copy() # Last p observations
80
+
81
+ for i in range(steps):
82
+ # Prepare input vector
83
+ x = history[-self.p :][::-1] # Latest p observations in reverse order
84
+
85
+ # Add intercept if present (coef[0] is intercept)
86
+ if len(self.coef_) == self.p + 1:
87
+ x = np.insert(x, 0, 1)
88
+
89
+ # Make prediction
90
+ pred = np.dot(x, self.coef_)
91
+ predictions[i] = pred
92
+
93
+ # Update history
94
+ history = np.append(history, pred)
95
+
96
+ return predictions