-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitialize_project.py
77 lines (64 loc) · 2.37 KB
/
initialize_project.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Import necessary libraries and packages
import os
from pathlib import Path
def create_project_structure():
"""Create the full project directory structure and initial files."""
# Define the directory structure
directories = [
'data/raw',
'data/processed',
'algorithms',
'models/pointer_network/checkpoints',
'utils',
'tests',
'logs',
'results/visualizations',
'notebooks',
'docs',
'scripts'
]
# Create directories
for dir_path in directories:
Path(dir_path).mkdir(parents=True, exist_ok=True)
# Create initial files
initial_files = {
'algorithms/__init__.py': '',
'algorithms/greedy.py': '"""Implementation of the Greedy TSP solver."""\n',
'algorithms/dynamic_programming.py': '"""Implementation of the Dynamic Programming TSP solver."""\n',
'algorithms/beam_search.py': '"""Implementation of the Beam Search TSP solver."""\n',
'models/__init__.py': '',
'models/pointer_network/__init__.py': '',
'utils/__init__.py': '',
'utils/data_generator.py': '"""Utilities for generating TSP test data."""\n',
'utils/visualizer.py': '"""Utilities for visualizing TSP solutions."""\n',
'utils/metrics.py': '"""Performance metrics calculation utilities."""\n',
'tests/__init__.py': '',
'tests/test_greedy.py': '"""Test cases for the Greedy TSP solver."""\n',
'tests/test_utils.py': '"""Test cases for utility functions."""\n',
'docs/README.md': '# TSP Optimizer Documentation\n\nThis directory contains project documentation.',
'scripts/run_tests.sh': '#!/bin/bash\npytest tests/',
'.gitignore': '''
venv/
__pycache__/
*.pyc
.DS_Store
logs/*.log
results/*.json
*.egg-info/
dist/
build/
'''.strip()
}
for file_path, content in initial_files.items():
file = Path(file_path)
if not file.exists():
file.parent.mkdir(parents=True, exist_ok=True)
file.write_text(content)
# Make scripts executable
scripts_dir = Path('scripts')
if scripts_dir.exists():
for script in scripts_dir.glob('*.sh'):
script.chmod(0o755)
print("Project structure initialized successfully!")
if __name__ == "__main__":
create_project_structure()