pyhyflex 0.1.13__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 (175) hide show
  1. pyhyflex-0.1.13/PKG-INFO +21 -0
  2. pyhyflex-0.1.13/README.md +1 -0
  3. pyhyflex-0.1.13/hhrl/.gitignore +3 -0
  4. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/240409_prj_analysis-checkpoint.ipynb +131 -0
  5. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/240410_python_conda_parallel-checkpoint.ipynb +201 -0
  6. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/240415_Revised_jnius_env-checkpoint.py +388 -0
  7. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/241104.singlecell-hyflex-checkpoint.ipynb +577 -0
  8. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/241104_gym(0.26.1)_display_server-checkpoint.ipynb +187 -0
  9. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/241104_gym_pyhyflex-checkpoint.ipynb +712 -0
  10. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/241104_sb3_test-checkpoint.ipynb +298 -0
  11. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/Untitled-checkpoint.ipynb +6 -0
  12. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/__init__-checkpoint.py +0 -0
  13. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/compare_with_chesc-checkpoint.py +89 -0
  14. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/fix_experiment_dirs-checkpoint.py +15 -0
  15. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/generate_graphs-checkpoint.py +336 -0
  16. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/graphs-checkpoint.py +278 -0
  17. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/gym_env_wrapper-checkpoint.py +0 -0
  18. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/hh_project_summary-checkpoint.txt +3853 -0
  19. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/hh_project_summary_onlyfile-checkpoint.txt +440 -0
  20. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/requirements-checkpoint.txt +19 -0
  21. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/run-checkpoint.sh +81 -0
  22. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/runner-checkpoint.py +112 -0
  23. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/stattests-checkpoint.py +194 -0
  24. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/temp-checkpoint.txt +30 -0
  25. pyhyflex-0.1.13/hhrl/.ipynb_checkpoints/untitled-checkpoint.py +0 -0
  26. pyhyflex-0.1.13/hhrl/240409_prj_analysis.ipynb +213 -0
  27. pyhyflex-0.1.13/hhrl/240410_python_conda_parallel.ipynb +201 -0
  28. pyhyflex-0.1.13/hhrl/240415_Revised_jnius_env.py +394 -0
  29. pyhyflex-0.1.13/hhrl/241104.singlecell-hyflex.ipynb +7527 -0
  30. pyhyflex-0.1.13/hhrl/241104_gym(0.26.1)_display_server.ipynb +187 -0
  31. pyhyflex-0.1.13/hhrl/241104_gym_pyhyflex.ipynb +667 -0
  32. pyhyflex-0.1.13/hhrl/241104_sb3_test.ipynb +464 -0
  33. pyhyflex-0.1.13/hhrl/HH-RL.zip +0 -0
  34. pyhyflex-0.1.13/hhrl/LunarLander_result.gif +0 -0
  35. pyhyflex-0.1.13/hhrl/MountainCar_result.gif +0 -0
  36. pyhyflex-0.1.13/hhrl/README.md +16 -0
  37. pyhyflex-0.1.13/hhrl/Untitled.ipynb +6 -0
  38. pyhyflex-0.1.13/hhrl/__init__.py +1 -0
  39. pyhyflex-0.1.13/hhrl/compare_with_chesc.py +89 -0
  40. pyhyflex-0.1.13/hhrl/configs/.ipynb_checkpoints/default-config-checkpoint.ini +43 -0
  41. pyhyflex-0.1.13/hhrl/configs/.ipynb_checkpoints/epsilon_10-checkpoint.ini +24 -0
  42. pyhyflex-0.1.13/hhrl/configs/.ipynb_checkpoints/fir_discrete-checkpoint.ini +43 -0
  43. pyhyflex-0.1.13/hhrl/configs/.ipynb_checkpoints/rank_decay_05-checkpoint.ini +22 -0
  44. pyhyflex-0.1.13/hhrl/configs/default-config.ini +43 -0
  45. pyhyflex-0.1.13/hhrl/configs/epsilon_10.ini +24 -0
  46. pyhyflex-0.1.13/hhrl/configs/fir_discrete.ini +43 -0
  47. pyhyflex-0.1.13/hhrl/configs/lr_001.ini +23 -0
  48. pyhyflex-0.1.13/hhrl/configs/lr_01.ini +23 -0
  49. pyhyflex-0.1.13/hhrl/configs/rank_decay_05.ini +22 -0
  50. pyhyflex-0.1.13/hhrl/fix_experiment_dirs.py +15 -0
  51. pyhyflex-0.1.13/hhrl/generate_graphs.py +336 -0
  52. pyhyflex-0.1.13/hhrl/graphs.py +278 -0
  53. pyhyflex-0.1.13/hhrl/gym_env_wrapper.py +493 -0
  54. pyhyflex-0.1.13/hhrl/hh_project_summary.txt +3853 -0
  55. pyhyflex-0.1.13/hhrl/hh_project_summary_onlyfile.txt +440 -0
  56. pyhyflex-0.1.13/hhrl/hhrl/.ipynb_checkpoints/__init__-checkpoint.py +0 -0
  57. pyhyflex-0.1.13/hhrl/hhrl/.ipynb_checkpoints/hh-checkpoint.py +40 -0
  58. pyhyflex-0.1.13/hhrl/hhrl/__init__.py +0 -0
  59. pyhyflex-0.1.13/hhrl/hhrl/acceptance/.ipynb_checkpoints/accept_all-checkpoint.py +3 -0
  60. pyhyflex-0.1.13/hhrl/hhrl/acceptance/__init__.py +1 -0
  61. pyhyflex-0.1.13/hhrl/hhrl/acceptance/accept_all.py +3 -0
  62. pyhyflex-0.1.13/hhrl/hhrl/agent/.ipynb_checkpoints/__init__-checkpoint.py +2 -0
  63. pyhyflex-0.1.13/hhrl/hhrl/agent/.ipynb_checkpoints/agent-checkpoint.py +17 -0
  64. pyhyflex-0.1.13/hhrl/hhrl/agent/.ipynb_checkpoints/rand-checkpoint.py +39 -0
  65. pyhyflex-0.1.13/hhrl/hhrl/agent/__init__.py +2 -0
  66. pyhyflex-0.1.13/hhrl/hhrl/agent/agent.py +17 -0
  67. pyhyflex-0.1.13/hhrl/hhrl/agent/mab/.ipynb_checkpoints/__init__-checkpoint.py +3 -0
  68. pyhyflex-0.1.13/hhrl/hhrl/agent/mab/.ipynb_checkpoints/dmab-checkpoint.py +42 -0
  69. pyhyflex-0.1.13/hhrl/hhrl/agent/mab/.ipynb_checkpoints/frrmab-checkpoint.py +46 -0
  70. pyhyflex-0.1.13/hhrl/hhrl/agent/mab/.ipynb_checkpoints/ucb-checkpoint.py +23 -0
  71. pyhyflex-0.1.13/hhrl/hhrl/agent/mab/__init__.py +3 -0
  72. pyhyflex-0.1.13/hhrl/hhrl/agent/mab/dmab.py +42 -0
  73. pyhyflex-0.1.13/hhrl/hhrl/agent/mab/frrmab.py +46 -0
  74. pyhyflex-0.1.13/hhrl/hhrl/agent/mab/ucb.py +23 -0
  75. pyhyflex-0.1.13/hhrl/hhrl/agent/rand.py +39 -0
  76. pyhyflex-0.1.13/hhrl/hhrl/agent/rl/.ipynb_checkpoints/dqn-checkpoint.py +53 -0
  77. pyhyflex-0.1.13/hhrl/hhrl/agent/rl/.ipynb_checkpoints/dqnucb-checkpoint.py +60 -0
  78. pyhyflex-0.1.13/hhrl/hhrl/agent/rl/.ipynb_checkpoints/egreedy-checkpoint.py +15 -0
  79. pyhyflex-0.1.13/hhrl/hhrl/agent/rl/.ipynb_checkpoints/qlearning-checkpoint.py +50 -0
  80. pyhyflex-0.1.13/hhrl/hhrl/agent/rl/__init__.py +3 -0
  81. pyhyflex-0.1.13/hhrl/hhrl/agent/rl/dqn.py +53 -0
  82. pyhyflex-0.1.13/hhrl/hhrl/agent/rl/dqnucb.py +60 -0
  83. pyhyflex-0.1.13/hhrl/hhrl/agent/rl/egreedy.py +15 -0
  84. pyhyflex-0.1.13/hhrl/hhrl/agent/rl/qlearning.py +50 -0
  85. pyhyflex-0.1.13/hhrl/hhrl/hh.py +40 -0
  86. pyhyflex-0.1.13/hhrl/hhrl/problem/.ipynb_checkpoints/__init__-checkpoint.py +7 -0
  87. pyhyflex-0.1.13/hhrl/hhrl/problem/.ipynb_checkpoints/bp-checkpoint.py +22 -0
  88. pyhyflex-0.1.13/hhrl/hhrl/problem/.ipynb_checkpoints/hyflex_domain-checkpoint.py +43 -0
  89. pyhyflex-0.1.13/hhrl/hhrl/problem/.ipynb_checkpoints/tsp-checkpoint.py +15 -0
  90. pyhyflex-0.1.13/hhrl/hhrl/problem/.ipynb_checkpoints/vrp-checkpoint.py +6 -0
  91. pyhyflex-0.1.13/hhrl/hhrl/problem/__init__.py +7 -0
  92. pyhyflex-0.1.13/hhrl/hhrl/problem/bp.py +22 -0
  93. pyhyflex-0.1.13/hhrl/hhrl/problem/fs.py +15 -0
  94. pyhyflex-0.1.13/hhrl/hhrl/problem/hyflex_domain.py +43 -0
  95. pyhyflex-0.1.13/hhrl/hhrl/problem/ps.py +6 -0
  96. pyhyflex-0.1.13/hhrl/hhrl/problem/sat.py +21 -0
  97. pyhyflex-0.1.13/hhrl/hhrl/problem/tsp.py +15 -0
  98. pyhyflex-0.1.13/hhrl/hhrl/problem/vrp.py +6 -0
  99. pyhyflex-0.1.13/hhrl/hhrl/reward/.ipynb_checkpoints/raw_improvement-checkpoint.py +10 -0
  100. pyhyflex-0.1.13/hhrl/hhrl/reward/__init__.py +8 -0
  101. pyhyflex-0.1.13/hhrl/hhrl/reward/discrete_improvement_penalty.py +14 -0
  102. pyhyflex-0.1.13/hhrl/hhrl/reward/diversity.py +17 -0
  103. pyhyflex-0.1.13/hhrl/hhrl/reward/extreme_value.py +31 -0
  104. pyhyflex-0.1.13/hhrl/hhrl/reward/improvement_n_diversity.py +16 -0
  105. pyhyflex-0.1.13/hhrl/hhrl/reward/improvement_or_diversity.py +16 -0
  106. pyhyflex-0.1.13/hhrl/hhrl/reward/improvement_or_penalty.py +13 -0
  107. pyhyflex-0.1.13/hhrl/hhrl/reward/improvement_rate.py +10 -0
  108. pyhyflex-0.1.13/hhrl/hhrl/reward/raw_improvement.py +10 -0
  109. pyhyflex-0.1.13/hhrl/hhrl/solution/.ipynb_checkpoints/__init__-checkpoint.py +2 -0
  110. pyhyflex-0.1.13/hhrl/hhrl/solution/.ipynb_checkpoints/list_solution-checkpoint.py +18 -0
  111. pyhyflex-0.1.13/hhrl/hhrl/solution/.ipynb_checkpoints/solution-checkpoint.py +38 -0
  112. pyhyflex-0.1.13/hhrl/hhrl/solution/__init__.py +2 -0
  113. pyhyflex-0.1.13/hhrl/hhrl/solution/list_solution.py +18 -0
  114. pyhyflex-0.1.13/hhrl/hhrl/solution/solution.py +38 -0
  115. pyhyflex-0.1.13/hhrl/hhrl/state/.ipynb_checkpoints/__init__-checkpoint.py +9 -0
  116. pyhyflex-0.1.13/hhrl/hhrl/state/.ipynb_checkpoints/bollp-checkpoint.py +36 -0
  117. pyhyflex-0.1.13/hhrl/hhrl/state/.ipynb_checkpoints/dispersion-checkpoint.py +48 -0
  118. pyhyflex-0.1.13/hhrl/hhrl/state/.ipynb_checkpoints/elapsed_time-checkpoint.py +13 -0
  119. pyhyflex-0.1.13/hhrl/hhrl/state/.ipynb_checkpoints/fdc-checkpoint.py +70 -0
  120. pyhyflex-0.1.13/hhrl/hhrl/state/.ipynb_checkpoints/fitness_improvement_rate-checkpoint.py +27 -0
  121. pyhyflex-0.1.13/hhrl/hhrl/state/.ipynb_checkpoints/sliding_window_state-checkpoint.py +20 -0
  122. pyhyflex-0.1.13/hhrl/hhrl/state/.ipynb_checkpoints/state_builder-checkpoint.py +17 -0
  123. pyhyflex-0.1.13/hhrl/hhrl/state/__init__.py +9 -0
  124. pyhyflex-0.1.13/hhrl/hhrl/state/bollp.py +36 -0
  125. pyhyflex-0.1.13/hhrl/hhrl/state/dispersion.py +48 -0
  126. pyhyflex-0.1.13/hhrl/hhrl/state/elapsed_time.py +13 -0
  127. pyhyflex-0.1.13/hhrl/hhrl/state/fdc.py +70 -0
  128. pyhyflex-0.1.13/hhrl/hhrl/state/fitness_improvement_rate.py +27 -0
  129. pyhyflex-0.1.13/hhrl/hhrl/state/last_action_vector.py +17 -0
  130. pyhyflex-0.1.13/hhrl/hhrl/state/sliding_window_state.py +20 -0
  131. pyhyflex-0.1.13/hhrl/hhrl/state/state_builder.py +17 -0
  132. pyhyflex-0.1.13/hhrl/hhrl/state/ufdc.py +19 -0
  133. pyhyflex-0.1.13/hhrl/hhrl/util/.ipynb_checkpoints/page_hinkley-checkpoint.py +35 -0
  134. pyhyflex-0.1.13/hhrl/hhrl/util/.ipynb_checkpoints/stats_info-checkpoint.py +53 -0
  135. pyhyflex-0.1.13/hhrl/hhrl/util/__init__.py +6 -0
  136. pyhyflex-0.1.13/hhrl/hhrl/util/fifo_list.py +19 -0
  137. pyhyflex-0.1.13/hhrl/hhrl/util/loader.py +178 -0
  138. pyhyflex-0.1.13/hhrl/hhrl/util/ordered_fifo_list.py +46 -0
  139. pyhyflex-0.1.13/hhrl/hhrl/util/page_hinkley.py +35 -0
  140. pyhyflex-0.1.13/hhrl/hhrl/util/priority_fifo_list.py +67 -0
  141. pyhyflex-0.1.13/hhrl/hhrl/util/sliding_window.py +25 -0
  142. pyhyflex-0.1.13/hhrl/hhrl/util/solution_space.py +53 -0
  143. pyhyflex-0.1.13/hhrl/hhrl/util/stats_info.py +53 -0
  144. pyhyflex-0.1.13/hhrl/hyflex/chesc-fixed-no-ps.jar +0 -0
  145. pyhyflex-0.1.13/hhrl/hyflex/chesc-ps.jar +0 -0
  146. pyhyflex-0.1.13/hhrl/hyflex/hyflex_ext.jar +0 -0
  147. pyhyflex-0.1.13/hhrl/hyflex/problems_json/.ipynb_checkpoints/BP-checkpoint.json +16 -0
  148. pyhyflex-0.1.13/hhrl/hyflex/problems_json/.ipynb_checkpoints/BinPacking-checkpoint.json +16 -0
  149. pyhyflex-0.1.13/hhrl/hyflex/problems_json/.ipynb_checkpoints/TSP-checkpoint.json +16 -0
  150. pyhyflex-0.1.13/hhrl/hyflex/problems_json/.ipynb_checkpoints/VRP-checkpoint.json +16 -0
  151. pyhyflex-0.1.13/hhrl/hyflex/problems_json/BP.json +16 -0
  152. pyhyflex-0.1.13/hhrl/hyflex/problems_json/BinPacking.json +16 -0
  153. pyhyflex-0.1.13/hhrl/hyflex/problems_json/FS.json +16 -0
  154. pyhyflex-0.1.13/hhrl/hyflex/problems_json/PS.json +16 -0
  155. pyhyflex-0.1.13/hhrl/hyflex/problems_json/SAT.json +16 -0
  156. pyhyflex-0.1.13/hhrl/hyflex/problems_json/TSP.json +16 -0
  157. pyhyflex-0.1.13/hhrl/hyflex/problems_json/VRP.json +16 -0
  158. pyhyflex-0.1.13/hhrl/hyflex_dqn.zip +0 -0
  159. pyhyflex-0.1.13/hhrl/requirements.txt +19 -0
  160. pyhyflex-0.1.13/hhrl/results/0.dat/0.dat +0 -0
  161. pyhyflex-0.1.13/hhrl/run.sh +81 -0
  162. pyhyflex-0.1.13/hhrl/runner.py +112 -0
  163. pyhyflex-0.1.13/hhrl/stattests.py +194 -0
  164. pyhyflex-0.1.13/hhrl/tablemaker.py +35 -0
  165. pyhyflex-0.1.13/hhrl/temp.txt +30 -0
  166. pyhyflex-0.1.13/hhrl/temp_generate_graphs.py +282 -0
  167. pyhyflex-0.1.13/hhrl/test_loader.py +10 -0
  168. pyhyflex-0.1.13/hhrl/untitled.py +0 -0
  169. pyhyflex-0.1.13/pyhyflex/.ipynb_checkpoints/__init__-checkpoint.py +0 -0
  170. pyhyflex-0.1.13/pyhyflex/.ipynb_checkpoints/gym_env_wrapper-checkpoint.py +519 -0
  171. pyhyflex-0.1.13/pyhyflex/__init__.py +0 -0
  172. pyhyflex-0.1.13/pyhyflex/_init_ +1 -0
  173. pyhyflex-0.1.13/pyhyflex/dqn_hyflex.zip +0 -0
  174. pyhyflex-0.1.13/pyhyflex/gym_env_wrapper.py +519 -0
  175. pyhyflex-0.1.13/pyproject.toml +41 -0
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyhyflex
3
+ Version: 0.1.13
4
+ Summary:
5
+ Author: labATscifn.co
6
+ Author-email: you@example.com
7
+ Requires-Python: >=3.10
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Requires-Dist: gymnasium (==1.2.3)
15
+ Requires-Dist: matplotlib (==3.10.8)
16
+ Requires-Dist: numpy (==2.2.6)
17
+ Requires-Dist: pyjnius (==1.7.0)
18
+ Requires-Dist: stable-baselines3 (==2.7.1)
19
+ Description-Content-Type: text/markdown
20
+
21
+ https://sites.google.com/view/pyhyflex/home
@@ -0,0 +1 @@
1
+ https://sites.google.com/view/pyhyflex/home
@@ -0,0 +1,3 @@
1
+ */__pycache__/*
2
+ __pycache__/
3
+ .python-version
@@ -0,0 +1,131 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "45aa328d-836d-4c06-9182-5aea1922aa29",
7
+ "metadata": {
8
+ "tags": []
9
+ },
10
+ "outputs": [
11
+ {
12
+ "name": "stdout",
13
+ "output_type": "stream",
14
+ "text": [
15
+ "Summary generated and saved to hh_project_summary.txt\n"
16
+ ]
17
+ }
18
+ ],
19
+ "source": [
20
+ "import os\n",
21
+ "\n",
22
+ "def get_file_contents(file_path):\n",
23
+ " try:\n",
24
+ " with open(file_path, 'r', encoding='utf-8') as file:\n",
25
+ " return file.read()\n",
26
+ " except UnicodeDecodeError:\n",
27
+ " return \"<Unable to read file contents due to encoding issue>\"\n",
28
+ "\n",
29
+ "def generate_project_summary(root_dir):\n",
30
+ " project_summary = \"\"\n",
31
+ " for root, dirs, files in os.walk(root_dir):\n",
32
+ " for file_name in files:\n",
33
+ " file_path = os.path.join(root, file_name)\n",
34
+ " project_summary += f\"Title: {file_name}\\n\"\n",
35
+ " project_summary += f\"Location: {file_path}\\n\"\n",
36
+ " project_summary += \"Content:\\n\"\n",
37
+ " project_summary += get_file_contents(file_path)\n",
38
+ " project_summary += \"\\n\\n\"\n",
39
+ " return project_summary\n",
40
+ "\n",
41
+ "def save_summary_to_file(summary, output_file):\n",
42
+ " with open(output_file, 'w', encoding='utf-8') as file:\n",
43
+ " file.write(summary)\n",
44
+ "\n",
45
+ "if __name__ == \"__main__\":\n",
46
+ " root_directory = '.' # 当前文件夹\n",
47
+ " summary = generate_project_summary(root_directory)\n",
48
+ " output_file = 'hh_project_summary.txt' # 输出文件名\n",
49
+ " save_summary_to_file(summary, output_file)\n",
50
+ " print(\"Summary generated and saved to\", output_file)\n"
51
+ ]
52
+ },
53
+ {
54
+ "cell_type": "code",
55
+ "execution_count": 2,
56
+ "id": "6f243cfb-af4c-43aa-9411-26f98c8ae650",
57
+ "metadata": {},
58
+ "outputs": [
59
+ {
60
+ "name": "stdout",
61
+ "output_type": "stream",
62
+ "text": [
63
+ "Summary generated and saved to hh_project_summary_onlyfile.txt\n"
64
+ ]
65
+ }
66
+ ],
67
+ "source": [
68
+ "import os\n",
69
+ "\n",
70
+ "def get_file_contents(file_path):\n",
71
+ " try:\n",
72
+ " with open(file_path, 'r', encoding='utf-8') as file:\n",
73
+ " return file.read()\n",
74
+ " except UnicodeDecodeError:\n",
75
+ " return \"<Unable to read file contents due to encoding issue>\"\n",
76
+ "\n",
77
+ "def generate_project_summary(root_dir):\n",
78
+ " project_summary = \"\"\n",
79
+ " for root, dirs, files in os.walk(root_dir):\n",
80
+ " for file_name in files:\n",
81
+ " file_path = os.path.join(root, file_name)\n",
82
+ " project_summary += f\"Title: {file_name}\\n\"\n",
83
+ " project_summary += f\"Location: {file_path}\\n\"\n",
84
+ " project_summary += \"Content:\\n\"\n",
85
+ " #project_summary += get_file_contents(file_path)\n",
86
+ " project_summary += \"\\n\\n\"\n",
87
+ " return project_summary\n",
88
+ "\n",
89
+ "def save_summary_to_file(summary, output_file):\n",
90
+ " with open(output_file, 'w', encoding='utf-8') as file:\n",
91
+ " file.write(summary)\n",
92
+ "\n",
93
+ "if __name__ == \"__main__\":\n",
94
+ " root_directory = '.' # 当前文件夹\n",
95
+ " summary = generate_project_summary(root_directory)\n",
96
+ " output_file = 'hh_project_summary_onlyfile.txt' # 输出文件名\n",
97
+ " save_summary_to_file(summary, output_file)\n",
98
+ " print(\"Summary generated and saved to\", output_file)\n"
99
+ ]
100
+ },
101
+ {
102
+ "cell_type": "code",
103
+ "execution_count": null,
104
+ "id": "f1ef6fc4-a3a3-48fc-be04-b3aabf088259",
105
+ "metadata": {},
106
+ "outputs": [],
107
+ "source": []
108
+ }
109
+ ],
110
+ "metadata": {
111
+ "kernelspec": {
112
+ "display_name": "hyflex",
113
+ "language": "python",
114
+ "name": "hyflex"
115
+ },
116
+ "language_info": {
117
+ "codemirror_mode": {
118
+ "name": "ipython",
119
+ "version": 3
120
+ },
121
+ "file_extension": ".py",
122
+ "mimetype": "text/x-python",
123
+ "name": "python",
124
+ "nbconvert_exporter": "python",
125
+ "pygments_lexer": "ipython3",
126
+ "version": "3.9.18"
127
+ }
128
+ },
129
+ "nbformat": 4,
130
+ "nbformat_minor": 5
131
+ }
@@ -0,0 +1,201 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "e2a6b64f-02cb-48c6-89b7-864e7ffc06a7",
6
+ "metadata": {},
7
+ "source": [
8
+ "#### April09 单个命令"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "code",
13
+ "execution_count": 1,
14
+ "id": "5276750b-fede-4fb1-b4dc-51115e53c121",
15
+ "metadata": {},
16
+ "outputs": [],
17
+ "source": [
18
+ "\n",
19
+ "!/home/Chaofan_Tu/miniconda3/bin/conda run -n hyflex python runner.py -p TSP -i 0 -c /home/Chaofan_Tu/Documents/hyflex3/hhrl/configs/fir_discrete.ini -ag DQN -st S7 -rw RIP -ac ALL -r 1 -t 300 -o /home/Chaofan_Tu/Documents/hyflex3/hhrl/results\n"
20
+ ]
21
+ },
22
+ {
23
+ "cell_type": "code",
24
+ "execution_count": null,
25
+ "id": "f76529c3-96f4-4e3d-9ace-1f845f68e0b6",
26
+ "metadata": {},
27
+ "outputs": [],
28
+ "source": []
29
+ },
30
+ {
31
+ "cell_type": "markdown",
32
+ "id": "2f7efdca-06b3-4208-91e7-c805dd3170cd",
33
+ "metadata": {},
34
+ "source": [
35
+ "#### April10 并行线程同时运行多个实例 "
36
+ ]
37
+ },
38
+ {
39
+ "cell_type": "code",
40
+ "execution_count": 6,
41
+ "id": "ba8ad600-671e-4f67-a858-c2f8ca6e624e",
42
+ "metadata": {
43
+ "tags": []
44
+ },
45
+ "outputs": [
46
+ {
47
+ "name": "stdout",
48
+ "output_type": "stream",
49
+ "text": [
50
+ "Current time: 2024-04-15 02:09:27\n",
51
+ "Starting tasks...\n",
52
+ "Task 0 command: /home/Chaofan_Tu/miniconda3/bin/conda run -n hyflex python runner.py -p TSP -c /home/Chaofan_Tu/Documents/hyflex3/hhrl/configs/fir_discrete.ini -ag DQN -st S7 -rw RIP -ac ALL -r 22 -t 3000 -o /home/Chaofan_Tu/Documents/hyflex3/hhrl/results\n",
53
+ "Task 1 command: /home/Chaofan_Tu/miniconda3/bin/conda run -n hyflex python runner.py -p FS -c /home/Chaofan_Tu/Documents/hyflex3/hhrl/configs/fir_discrete.ini -ag DQN -st S7 -rw RIP -ac ALL -r 22 -t 3000 -o /home/Chaofan_Tu/Documents/hyflex3/hhrl/results\n",
54
+ "Task 2 command: /home/Chaofan_Tu/miniconda3/bin/conda run -n hyflex python runner.py -p SAT -c /home/Chaofan_Tu/Documents/hyflex3/hhrl/configs/fir_discrete.ini -ag DQN -st S7 -rw RIP -ac ALL -r 22 -t 3000 -o /home/Chaofan_Tu/Documents/hyflex3/hhrl/results\n",
55
+ "Tasks started.\n",
56
+ "Task 1 output: \n",
57
+ "Task 1 error: \n",
58
+ "Current time: 2024-04-15 02:54:38\n",
59
+ "Task 1 completed in 2711.53 seconds.\n",
60
+ "==================================================\n",
61
+ "Task 3 command: /home/Chaofan_Tu/miniconda3/bin/conda run -n hyflex python runner.py -p BP -c /home/Chaofan_Tu/Documents/hyflex3/hhrl/configs/fir_discrete.ini -ag DQN -st S7 -rw RIP -ac ALL -r 22 -t 3000 -o /home/Chaofan_Tu/Documents/hyflex3/hhrl/results\n",
62
+ "Task 2 output: \n",
63
+ "Task 2 error: \n",
64
+ "Current time: 2024-04-15 02:56:58\n",
65
+ "Task 2 completed in 2851.06 seconds.\n",
66
+ "==================================================\n",
67
+ "Task 4 command: /home/Chaofan_Tu/miniconda3/bin/conda run -n hyflex python runner.py -p VRP -c /home/Chaofan_Tu/Documents/hyflex3/hhrl/configs/fir_discrete.ini -ag DQN -st S7 -rw RIP -ac ALL -r 22 -t 3000 -o /home/Chaofan_Tu/Documents/hyflex3/hhrl/results\n",
68
+ "Task 0 output: \n",
69
+ "Task 0 error: \n",
70
+ "Current time: 2024-04-15 02:58:39\n",
71
+ "Task 0 completed in 2952.17 seconds.\n",
72
+ "==================================================\n",
73
+ "Task 5 command: /home/Chaofan_Tu/miniconda3/bin/conda run -n hyflex python runner.py -p PS -c /home/Chaofan_Tu/Documents/hyflex3/hhrl/configs/fir_discrete.ini -ag DQN -st S7 -rw RIP -ac ALL -r 22 -t 3000 -o /home/Chaofan_Tu/Documents/hyflex3/hhrl/results\n",
74
+ "Result 0 : None \n",
75
+ "Result 1 : None \n",
76
+ "Result 2 : None \n",
77
+ "Task 3 output: \n",
78
+ "Task 3 error: \n",
79
+ "Current time: 2024-04-15 03:39:25\n",
80
+ "Task 3 completed in 2686.84 seconds.\n",
81
+ "==================================================\n",
82
+ "Result 3 : None \n",
83
+ "Task 4 output: \n",
84
+ "Task 4 error: \n",
85
+ "Current time: 2024-04-15 03:42:10\n",
86
+ "Task 4 completed in 2711.87 seconds.\n",
87
+ "==================================================\n",
88
+ "Result 4 : None \n",
89
+ "Task 5 output: \n",
90
+ "Task 5 error: \n",
91
+ "Current time: 2024-04-15 03:46:16\n",
92
+ "Task 5 completed in 2856.98 seconds.\n",
93
+ "==================================================\n",
94
+ "Result 5 : None \n",
95
+ "Current time: 2024-04-15 03:46:16\n",
96
+ "All tasks completed. Total time: 5809.15 seconds.\n"
97
+ ]
98
+ }
99
+ ],
100
+ "source": [
101
+ "import subprocess\n",
102
+ "from concurrent.futures import ThreadPoolExecutor\n",
103
+ "import random\n",
104
+ "import time\n",
105
+ "from datetime import datetime\n",
106
+ "\n",
107
+ "\n",
108
+ "\n",
109
+ "# 定义问题列表\n",
110
+ "_problems = [\"TSP\", \"FS\", \"SAT\", \"BP\", \"VRP\", \"PS\"]\n",
111
+ "\n",
112
+ "# 定义固定的参数\n",
113
+ "_agent = \"DQN\" # 可选项: [\"DQN\", \"DQNUCB\", \"DMAB\", \"FRRMAB\", \"RAND\", \"QL\"]\n",
114
+ "_state = \"S7\" # 可选项: [\"S7\"]\n",
115
+ "_reward = \"RIP\" # 可选项: [\"RIP\", \"IR\", \"DIV\", \"IND\", \"IOD\", \"IOP\", \"DIP\"]\n",
116
+ "_acceptance = \"ALL\"\n",
117
+ "#instance 0-9\n",
118
+ "_round = random.randint(1, 31) # 可选项: {1..31}\n",
119
+ "_time = 3000\n",
120
+ "\n",
121
+ "\n",
122
+ "# 定义脚本执行路径和输出路径\n",
123
+ "_python = \"/home/Chaofan_Tu/miniconda3/bin/conda run -n hyflex python\"\n",
124
+ "_config = \"/home/Chaofan_Tu/Documents/hyflex3/hhrl/configs/fir_discrete.ini\"\n",
125
+ "_output_dir = \"/home/Chaofan_Tu/Documents/hyflex3/hhrl/results\"\n",
126
+ "_max_workers = 3\n",
127
+ "\n",
128
+ "# 定义运行命令的函数\n",
129
+ "def run_command(command, task_id):\n",
130
+ " start_time = time.time() # 记录开始时间\n",
131
+ " # 获取当前时间和将当前时间格式化为字符串\n",
132
+ " print(f\"Task {task_id} command: {command}\") # 打印子任务id和具体命令内容\n",
133
+ " process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)\n",
134
+ " out, err = process.communicate()\n",
135
+ " print(f\"Task {task_id} output: {out}\") # 打印子任务\n",
136
+ " print(f\"Task {task_id} error: {err}\") # 打印子任务\n",
137
+ " end_time = time.time() # 记录结束时间\n",
138
+ " print(\"Current time:\", datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\"))\n",
139
+ " print(f\"Task {task_id} completed in {end_time - start_time:.2f} seconds.\") # 打印子任务id和完成时间\n",
140
+ " print(\"=\" * 50)\n",
141
+ "\n",
142
+ "# 主程序入口\n",
143
+ "if __name__ == \"__main__\":\n",
144
+ " start_time = time.time()\n",
145
+ " print(\"Current time:\", datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\"))\n",
146
+ " print(\"Starting tasks...\")\n",
147
+ " # 定义要执行的命令列表\n",
148
+ " commands = []\n",
149
+ " for task_id, _problem in enumerate(_problems):\n",
150
+ " command = f'{_python} runner.py -p {_problem} -c {_config} -ag {_agent} -st {_state} -rw {_reward} -ac {_acceptance} -r {_round} -t {_time} -o {_output_dir}'\n",
151
+ " commands.append((command, task_id))\n",
152
+ "\n",
153
+ " # 使用 ThreadPoolExecutor 创建线程池,限定最大线程数为 max_workers\n",
154
+ " with ThreadPoolExecutor(max_workers=_max_workers) as executor:\n",
155
+ " # 提交任务给线程池并获取 Future 对象列表\n",
156
+ " futures = [executor.submit(run_command, command, task_id) for command, task_id in commands]\n",
157
+ " \n",
158
+ " # 打印子进程的启动信息\n",
159
+ " print(\"Tasks started.\")\n",
160
+ "\n",
161
+ " # 等待所有任务完成\n",
162
+ " results = []\n",
163
+ " for future_id, future in enumerate(futures):\n",
164
+ " print(f\"Result {future_id} : {future.result()} \")\n",
165
+ "\n",
166
+ " end_time = time.time()\n",
167
+ " print(\"Current time:\", datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\"))\n",
168
+ " print(f\"All tasks completed. Total time: {end_time - start_time:.2f} seconds.\")\n"
169
+ ]
170
+ },
171
+ {
172
+ "cell_type": "code",
173
+ "execution_count": null,
174
+ "id": "6feaf47b-33d1-4dd7-9267-0265aac98633",
175
+ "metadata": {},
176
+ "outputs": [],
177
+ "source": []
178
+ }
179
+ ],
180
+ "metadata": {
181
+ "kernelspec": {
182
+ "display_name": "ipykernel_hyflex",
183
+ "language": "python",
184
+ "name": "hyflex"
185
+ },
186
+ "language_info": {
187
+ "codemirror_mode": {
188
+ "name": "ipython",
189
+ "version": 3
190
+ },
191
+ "file_extension": ".py",
192
+ "mimetype": "text/x-python",
193
+ "name": "python",
194
+ "nbconvert_exporter": "python",
195
+ "pygments_lexer": "ipython3",
196
+ "version": "3.9.19"
197
+ }
198
+ },
199
+ "nbformat": 4,
200
+ "nbformat_minor": 5
201
+ }