agentdb 1.0.0

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 (361) hide show
  1. package/LICENSE +38 -0
  2. package/LICENSE-APACHE +190 -0
  3. package/LICENSE-MIT +21 -0
  4. package/README.md +953 -0
  5. package/bin/agentdb.js +485 -0
  6. package/bin/plugin-cli-wrapper.mjs +21 -0
  7. package/dist/cache/query-cache.d.ts +105 -0
  8. package/dist/cache/query-cache.d.ts.map +1 -0
  9. package/dist/cache/query-cache.js +224 -0
  10. package/dist/cache/query-cache.js.map +1 -0
  11. package/dist/cache/query-cache.mjs +219 -0
  12. package/dist/cli/cache/query-cache.d.ts +104 -0
  13. package/dist/cli/cache/query-cache.js +244 -0
  14. package/dist/cli/cli/db-commands.d.ts +48 -0
  15. package/dist/cli/cli/db-commands.js +613 -0
  16. package/dist/cli/commands.d.ts +7 -0
  17. package/dist/cli/commands.d.ts.map +1 -0
  18. package/dist/cli/commands.js +113 -0
  19. package/dist/cli/commands.js.map +1 -0
  20. package/dist/cli/commands.mjs +104 -0
  21. package/dist/cli/core/backend-interface.d.ts +70 -0
  22. package/dist/cli/core/backend-interface.js +15 -0
  23. package/dist/cli/core/native-backend.d.ts +140 -0
  24. package/dist/cli/core/native-backend.js +432 -0
  25. package/dist/cli/core/vector-db.d.ts +126 -0
  26. package/dist/cli/core/vector-db.js +338 -0
  27. package/dist/cli/core/wasm-backend.d.ts +95 -0
  28. package/dist/cli/core/wasm-backend.js +418 -0
  29. package/dist/cli/db-commands.d.ts +49 -0
  30. package/dist/cli/db-commands.d.ts.map +1 -0
  31. package/dist/cli/db-commands.js +533 -0
  32. package/dist/cli/db-commands.js.map +1 -0
  33. package/dist/cli/db-commands.mjs +522 -0
  34. package/dist/cli/generator.d.ts +11 -0
  35. package/dist/cli/generator.d.ts.map +1 -0
  36. package/dist/cli/generator.js +567 -0
  37. package/dist/cli/generator.js.map +1 -0
  38. package/dist/cli/generator.mjs +527 -0
  39. package/dist/cli/help.d.ts +18 -0
  40. package/dist/cli/help.d.ts.map +1 -0
  41. package/dist/cli/help.js +676 -0
  42. package/dist/cli/help.js.map +1 -0
  43. package/dist/cli/help.mjs +667 -0
  44. package/dist/cli/index/hnsw.d.ts +164 -0
  45. package/dist/cli/index/hnsw.js +558 -0
  46. package/dist/cli/plugin-cli.d.ts +7 -0
  47. package/dist/cli/plugin-cli.d.ts.map +1 -0
  48. package/dist/cli/plugin-cli.js +295 -0
  49. package/dist/cli/plugin-cli.js.map +1 -0
  50. package/dist/cli/plugin-cli.mjs +289 -0
  51. package/dist/cli/quantization/product-quantization.d.ts +108 -0
  52. package/dist/cli/quantization/product-quantization.js +350 -0
  53. package/dist/cli/query/query-builder.d.ts +322 -0
  54. package/dist/cli/query/query-builder.js +600 -0
  55. package/dist/cli/templates.d.ts +14 -0
  56. package/dist/cli/templates.d.ts.map +1 -0
  57. package/dist/cli/templates.js +182 -0
  58. package/dist/cli/templates.js.map +1 -0
  59. package/dist/cli/templates.mjs +176 -0
  60. package/dist/cli/types/index.d.ts +116 -0
  61. package/dist/cli/types/index.js +5 -0
  62. package/dist/cli/types.d.ts +91 -0
  63. package/dist/cli/types.d.ts.map +1 -0
  64. package/dist/cli/types.js +6 -0
  65. package/dist/cli/types.js.map +1 -0
  66. package/dist/cli/types.mjs +4 -0
  67. package/dist/cli/wizard/index.d.ts +6 -0
  68. package/dist/cli/wizard/index.d.ts.map +1 -0
  69. package/dist/cli/wizard/index.js +138 -0
  70. package/dist/cli/wizard/index.js.map +1 -0
  71. package/dist/cli/wizard/index.mjs +131 -0
  72. package/dist/cli/wizard/prompts.d.ts +11 -0
  73. package/dist/cli/wizard/prompts.d.ts.map +1 -0
  74. package/dist/cli/wizard/prompts.js +482 -0
  75. package/dist/cli/wizard/prompts.js.map +1 -0
  76. package/dist/cli/wizard/prompts.mjs +470 -0
  77. package/dist/cli/wizard/validator.d.ts +13 -0
  78. package/dist/cli/wizard/validator.d.ts.map +1 -0
  79. package/dist/cli/wizard/validator.js +234 -0
  80. package/dist/cli/wizard/validator.js.map +1 -0
  81. package/dist/cli/wizard/validator.mjs +224 -0
  82. package/dist/core/backend-interface.d.ts +71 -0
  83. package/dist/core/backend-interface.d.ts.map +1 -0
  84. package/dist/core/backend-interface.js +16 -0
  85. package/dist/core/backend-interface.js.map +1 -0
  86. package/dist/core/backend-interface.mjs +12 -0
  87. package/dist/core/native-backend.d.ts +141 -0
  88. package/dist/core/native-backend.d.ts.map +1 -0
  89. package/dist/core/native-backend.js +457 -0
  90. package/dist/core/native-backend.js.map +1 -0
  91. package/dist/core/native-backend.mjs +449 -0
  92. package/dist/core/vector-db.d.ts +127 -0
  93. package/dist/core/vector-db.d.ts.map +1 -0
  94. package/dist/core/vector-db.js +266 -0
  95. package/dist/core/vector-db.js.map +1 -0
  96. package/dist/core/vector-db.mjs +261 -0
  97. package/dist/core/wasm-backend.d.ts +96 -0
  98. package/dist/core/wasm-backend.d.ts.map +1 -0
  99. package/dist/core/wasm-backend.js +393 -0
  100. package/dist/core/wasm-backend.js.map +1 -0
  101. package/dist/core/wasm-backend.mjs +385 -0
  102. package/dist/index/hnsw-optimized.d.ts +75 -0
  103. package/dist/index/hnsw-optimized.d.ts.map +1 -0
  104. package/dist/index/hnsw-optimized.js +412 -0
  105. package/dist/index/hnsw-optimized.js.map +1 -0
  106. package/dist/index/hnsw-optimized.mjs +407 -0
  107. package/dist/index/hnsw.d.ts +165 -0
  108. package/dist/index/hnsw.d.ts.map +1 -0
  109. package/dist/index/hnsw.js +521 -0
  110. package/dist/index/hnsw.js.map +1 -0
  111. package/dist/index/hnsw.mjs +516 -0
  112. package/dist/index.d.ts +57 -0
  113. package/dist/index.d.ts.map +1 -0
  114. package/dist/index.js +82 -0
  115. package/dist/index.js.map +1 -0
  116. package/dist/index.mjs +63 -0
  117. package/dist/mcp-server.d.ts +27 -0
  118. package/dist/mcp-server.d.ts.map +1 -0
  119. package/dist/mcp-server.js +789 -0
  120. package/dist/mcp-server.js.map +1 -0
  121. package/dist/mcp-server.mjs +784 -0
  122. package/dist/plugins/base-plugin.d.ts +114 -0
  123. package/dist/plugins/base-plugin.d.ts.map +1 -0
  124. package/dist/plugins/base-plugin.js +313 -0
  125. package/dist/plugins/base-plugin.js.map +1 -0
  126. package/dist/plugins/base-plugin.mjs +275 -0
  127. package/dist/plugins/implementations/active-learning.d.ts +135 -0
  128. package/dist/plugins/implementations/active-learning.d.ts.map +1 -0
  129. package/dist/plugins/implementations/active-learning.js +372 -0
  130. package/dist/plugins/implementations/active-learning.js.map +1 -0
  131. package/dist/plugins/implementations/active-learning.mjs +367 -0
  132. package/dist/plugins/implementations/actor-critic.d.ts +64 -0
  133. package/dist/plugins/implementations/actor-critic.d.ts.map +1 -0
  134. package/dist/plugins/implementations/actor-critic.js +363 -0
  135. package/dist/plugins/implementations/actor-critic.js.map +1 -0
  136. package/dist/plugins/implementations/actor-critic.mjs +358 -0
  137. package/dist/plugins/implementations/adversarial-training.d.ts +133 -0
  138. package/dist/plugins/implementations/adversarial-training.d.ts.map +1 -0
  139. package/dist/plugins/implementations/adversarial-training.js +409 -0
  140. package/dist/plugins/implementations/adversarial-training.js.map +1 -0
  141. package/dist/plugins/implementations/adversarial-training.mjs +404 -0
  142. package/dist/plugins/implementations/curriculum-learning.d.ts +132 -0
  143. package/dist/plugins/implementations/curriculum-learning.d.ts.map +1 -0
  144. package/dist/plugins/implementations/curriculum-learning.js +354 -0
  145. package/dist/plugins/implementations/curriculum-learning.js.map +1 -0
  146. package/dist/plugins/implementations/curriculum-learning.mjs +349 -0
  147. package/dist/plugins/implementations/decision-transformer.d.ts +77 -0
  148. package/dist/plugins/implementations/decision-transformer.d.ts.map +1 -0
  149. package/dist/plugins/implementations/decision-transformer.js +422 -0
  150. package/dist/plugins/implementations/decision-transformer.js.map +1 -0
  151. package/dist/plugins/implementations/decision-transformer.mjs +417 -0
  152. package/dist/plugins/implementations/federated-learning.d.ts +126 -0
  153. package/dist/plugins/implementations/federated-learning.d.ts.map +1 -0
  154. package/dist/plugins/implementations/federated-learning.js +436 -0
  155. package/dist/plugins/implementations/federated-learning.js.map +1 -0
  156. package/dist/plugins/implementations/federated-learning.mjs +431 -0
  157. package/dist/plugins/implementations/index.d.ts +30 -0
  158. package/dist/plugins/implementations/index.d.ts.map +1 -0
  159. package/dist/plugins/implementations/index.js +45 -0
  160. package/dist/plugins/implementations/index.js.map +1 -0
  161. package/dist/plugins/implementations/index.mjs +31 -0
  162. package/dist/plugins/implementations/multi-task-learning.d.ts +115 -0
  163. package/dist/plugins/implementations/multi-task-learning.d.ts.map +1 -0
  164. package/dist/plugins/implementations/multi-task-learning.js +369 -0
  165. package/dist/plugins/implementations/multi-task-learning.js.map +1 -0
  166. package/dist/plugins/implementations/multi-task-learning.mjs +364 -0
  167. package/dist/plugins/implementations/neural-architecture-search.d.ts +148 -0
  168. package/dist/plugins/implementations/neural-architecture-search.d.ts.map +1 -0
  169. package/dist/plugins/implementations/neural-architecture-search.js +379 -0
  170. package/dist/plugins/implementations/neural-architecture-search.js.map +1 -0
  171. package/dist/plugins/implementations/neural-architecture-search.mjs +374 -0
  172. package/dist/plugins/implementations/q-learning.d.ts +98 -0
  173. package/dist/plugins/implementations/q-learning.d.ts.map +1 -0
  174. package/dist/plugins/implementations/q-learning.js +435 -0
  175. package/dist/plugins/implementations/q-learning.js.map +1 -0
  176. package/dist/plugins/implementations/q-learning.mjs +430 -0
  177. package/dist/plugins/implementations/sarsa.d.ts +103 -0
  178. package/dist/plugins/implementations/sarsa.d.ts.map +1 -0
  179. package/dist/plugins/implementations/sarsa.js +347 -0
  180. package/dist/plugins/implementations/sarsa.js.map +1 -0
  181. package/dist/plugins/implementations/sarsa.mjs +342 -0
  182. package/dist/plugins/index.d.ts +107 -0
  183. package/dist/plugins/index.d.ts.map +1 -0
  184. package/dist/plugins/index.js +179 -0
  185. package/dist/plugins/index.js.map +1 -0
  186. package/dist/plugins/index.mjs +168 -0
  187. package/dist/plugins/interface.d.ts +439 -0
  188. package/dist/plugins/interface.d.ts.map +1 -0
  189. package/dist/plugins/interface.js +12 -0
  190. package/dist/plugins/interface.js.map +1 -0
  191. package/dist/plugins/interface.mjs +10 -0
  192. package/dist/plugins/learning-plugin.interface.d.ts +257 -0
  193. package/dist/plugins/learning-plugin.interface.d.ts.map +1 -0
  194. package/dist/plugins/learning-plugin.interface.js +7 -0
  195. package/dist/plugins/learning-plugin.interface.js.map +1 -0
  196. package/dist/plugins/learning-plugin.interface.mjs +5 -0
  197. package/dist/plugins/plugin-exports.d.ts +71 -0
  198. package/dist/plugins/plugin-exports.d.ts.map +1 -0
  199. package/dist/plugins/plugin-exports.js +78 -0
  200. package/dist/plugins/plugin-exports.js.map +1 -0
  201. package/dist/plugins/plugin-exports.mjs +69 -0
  202. package/dist/plugins/registry.d.ts +206 -0
  203. package/dist/plugins/registry.d.ts.map +1 -0
  204. package/dist/plugins/registry.js +365 -0
  205. package/dist/plugins/registry.js.map +1 -0
  206. package/dist/plugins/registry.mjs +356 -0
  207. package/dist/plugins/validator.d.ts +63 -0
  208. package/dist/plugins/validator.d.ts.map +1 -0
  209. package/dist/plugins/validator.js +464 -0
  210. package/dist/plugins/validator.js.map +1 -0
  211. package/dist/plugins/validator.mjs +458 -0
  212. package/dist/quantization/binary-quantization.d.ts +104 -0
  213. package/dist/quantization/binary-quantization.d.ts.map +1 -0
  214. package/dist/quantization/binary-quantization.js +246 -0
  215. package/dist/quantization/binary-quantization.js.map +1 -0
  216. package/dist/quantization/binary-quantization.mjs +240 -0
  217. package/dist/quantization/optimized-pq.d.ts +138 -0
  218. package/dist/quantization/optimized-pq.d.ts.map +1 -0
  219. package/dist/quantization/optimized-pq.js +320 -0
  220. package/dist/quantization/optimized-pq.js.map +1 -0
  221. package/dist/quantization/optimized-pq.mjs +313 -0
  222. package/dist/quantization/product-quantization.d.ts +109 -0
  223. package/dist/quantization/product-quantization.d.ts.map +1 -0
  224. package/dist/quantization/product-quantization.js +287 -0
  225. package/dist/quantization/product-quantization.js.map +1 -0
  226. package/dist/quantization/product-quantization.mjs +282 -0
  227. package/dist/quantization/scalar-quantization.d.ts +100 -0
  228. package/dist/quantization/scalar-quantization.d.ts.map +1 -0
  229. package/dist/quantization/scalar-quantization.js +324 -0
  230. package/dist/quantization/scalar-quantization.js.map +1 -0
  231. package/dist/quantization/scalar-quantization.mjs +319 -0
  232. package/dist/query/index.d.ts +6 -0
  233. package/dist/query/index.d.ts.map +1 -0
  234. package/dist/query/index.js +9 -0
  235. package/dist/query/index.js.map +1 -0
  236. package/dist/query/index.mjs +4 -0
  237. package/dist/query/query-builder.d.ts +323 -0
  238. package/dist/query/query-builder.d.ts.map +1 -0
  239. package/dist/query/query-builder.js +524 -0
  240. package/dist/query/query-builder.js.map +1 -0
  241. package/dist/query/query-builder.mjs +519 -0
  242. package/dist/reasoning/context-synthesizer.d.ts +57 -0
  243. package/dist/reasoning/context-synthesizer.d.ts.map +1 -0
  244. package/dist/reasoning/context-synthesizer.js +224 -0
  245. package/dist/reasoning/context-synthesizer.js.map +1 -0
  246. package/dist/reasoning/context-synthesizer.mjs +219 -0
  247. package/dist/reasoning/experience-curator.d.ts +66 -0
  248. package/dist/reasoning/experience-curator.d.ts.map +1 -0
  249. package/dist/reasoning/experience-curator.js +288 -0
  250. package/dist/reasoning/experience-curator.js.map +1 -0
  251. package/dist/reasoning/experience-curator.mjs +283 -0
  252. package/dist/reasoning/memory-optimizer.d.ts +69 -0
  253. package/dist/reasoning/memory-optimizer.d.ts.map +1 -0
  254. package/dist/reasoning/memory-optimizer.js +331 -0
  255. package/dist/reasoning/memory-optimizer.js.map +1 -0
  256. package/dist/reasoning/memory-optimizer.mjs +326 -0
  257. package/dist/reasoning/pattern-matcher.d.ts +59 -0
  258. package/dist/reasoning/pattern-matcher.d.ts.map +1 -0
  259. package/dist/reasoning/pattern-matcher.js +229 -0
  260. package/dist/reasoning/pattern-matcher.js.map +1 -0
  261. package/dist/reasoning/pattern-matcher.mjs +224 -0
  262. package/dist/reasoningbank/adapter/agentdb-adapter.d.ts +118 -0
  263. package/dist/reasoningbank/adapter/agentdb-adapter.d.ts.map +1 -0
  264. package/dist/reasoningbank/adapter/agentdb-adapter.js +477 -0
  265. package/dist/reasoningbank/adapter/agentdb-adapter.js.map +1 -0
  266. package/dist/reasoningbank/adapter/types.d.ts +113 -0
  267. package/dist/reasoningbank/adapter/types.d.ts.map +1 -0
  268. package/dist/reasoningbank/adapter/types.js +9 -0
  269. package/dist/reasoningbank/adapter/types.js.map +1 -0
  270. package/dist/reasoningbank/cli/commands.d.ts +16 -0
  271. package/dist/reasoningbank/cli/commands.d.ts.map +1 -0
  272. package/dist/reasoningbank/cli/commands.js +272 -0
  273. package/dist/reasoningbank/cli/commands.js.map +1 -0
  274. package/dist/reasoningbank/mcp/agentdb-tools.d.ts +319 -0
  275. package/dist/reasoningbank/mcp/agentdb-tools.d.ts.map +1 -0
  276. package/dist/reasoningbank/mcp/agentdb-tools.js +301 -0
  277. package/dist/reasoningbank/mcp/agentdb-tools.js.map +1 -0
  278. package/dist/reasoningbank/migration/migrate.d.ts +25 -0
  279. package/dist/reasoningbank/migration/migrate.d.ts.map +1 -0
  280. package/dist/reasoningbank/migration/migrate.js +178 -0
  281. package/dist/reasoningbank/migration/migrate.js.map +1 -0
  282. package/dist/reasoningbank/reasoning/context-synthesizer.d.ts +37 -0
  283. package/dist/reasoningbank/reasoning/context-synthesizer.d.ts.map +1 -0
  284. package/dist/reasoningbank/reasoning/context-synthesizer.js +114 -0
  285. package/dist/reasoningbank/reasoning/context-synthesizer.js.map +1 -0
  286. package/dist/reasoningbank/reasoning/experience-curator.d.ts +39 -0
  287. package/dist/reasoningbank/reasoning/experience-curator.d.ts.map +1 -0
  288. package/dist/reasoningbank/reasoning/experience-curator.js +98 -0
  289. package/dist/reasoningbank/reasoning/experience-curator.js.map +1 -0
  290. package/dist/reasoningbank/reasoning/memory-optimizer.d.ts +44 -0
  291. package/dist/reasoningbank/reasoning/memory-optimizer.d.ts.map +1 -0
  292. package/dist/reasoningbank/reasoning/memory-optimizer.js +184 -0
  293. package/dist/reasoningbank/reasoning/memory-optimizer.js.map +1 -0
  294. package/dist/reasoningbank/reasoning/pattern-matcher.d.ts +40 -0
  295. package/dist/reasoningbank/reasoning/pattern-matcher.d.ts.map +1 -0
  296. package/dist/reasoningbank/reasoning/pattern-matcher.js +87 -0
  297. package/dist/reasoningbank/reasoning/pattern-matcher.js.map +1 -0
  298. package/dist/reasoningbank/sync/quic-sync.d.ts +77 -0
  299. package/dist/reasoningbank/sync/quic-sync.d.ts.map +1 -0
  300. package/dist/reasoningbank/sync/quic-sync.js +165 -0
  301. package/dist/reasoningbank/sync/quic-sync.js.map +1 -0
  302. package/dist/sync/conflict.d.ts +78 -0
  303. package/dist/sync/conflict.d.ts.map +1 -0
  304. package/dist/sync/conflict.js +202 -0
  305. package/dist/sync/conflict.js.map +1 -0
  306. package/dist/sync/conflict.mjs +196 -0
  307. package/dist/sync/coordinator.d.ts +111 -0
  308. package/dist/sync/coordinator.d.ts.map +1 -0
  309. package/dist/sync/coordinator.js +256 -0
  310. package/dist/sync/coordinator.js.map +1 -0
  311. package/dist/sync/coordinator.mjs +250 -0
  312. package/dist/sync/delta.d.ts +81 -0
  313. package/dist/sync/delta.d.ts.map +1 -0
  314. package/dist/sync/delta.js +245 -0
  315. package/dist/sync/delta.js.map +1 -0
  316. package/dist/sync/delta.mjs +238 -0
  317. package/dist/sync/index.d.ts +11 -0
  318. package/dist/sync/index.d.ts.map +1 -0
  319. package/dist/sync/index.js +22 -0
  320. package/dist/sync/index.js.map +1 -0
  321. package/dist/sync/index.mjs +9 -0
  322. package/dist/sync/quic-sync.d.ts +81 -0
  323. package/dist/sync/quic-sync.d.ts.map +1 -0
  324. package/dist/sync/quic-sync.js +329 -0
  325. package/dist/sync/quic-sync.js.map +1 -0
  326. package/dist/sync/quic-sync.mjs +323 -0
  327. package/dist/sync/types.d.ts +168 -0
  328. package/dist/sync/types.d.ts.map +1 -0
  329. package/dist/sync/types.js +8 -0
  330. package/dist/sync/types.js.map +1 -0
  331. package/dist/sync/types.mjs +6 -0
  332. package/dist/types/index.d.ts +117 -0
  333. package/dist/types/index.d.ts.map +1 -0
  334. package/dist/types/index.js +6 -0
  335. package/dist/types/index.js.map +1 -0
  336. package/dist/types/index.mjs +4 -0
  337. package/dist/wasm-loader.d.ts +32 -0
  338. package/dist/wasm-loader.d.ts.map +1 -0
  339. package/dist/wasm-loader.js +75 -0
  340. package/dist/wasm-loader.js.map +1 -0
  341. package/dist/wasm-loader.mjs +64 -0
  342. package/examples/adaptive-learning.ts +284 -0
  343. package/examples/browser/README.md +732 -0
  344. package/examples/browser/adaptive-recommendations/index.html +427 -0
  345. package/examples/browser/collaborative-filtering/index.html +310 -0
  346. package/examples/browser/continual-learning/index.html +736 -0
  347. package/examples/browser/experience-replay/index.html +616 -0
  348. package/examples/browser/index.html +369 -0
  349. package/examples/browser/meta-learning/index.html +789 -0
  350. package/examples/browser/neuro-symbolic/index.html +692 -0
  351. package/examples/browser/pattern-learning/index.html +620 -0
  352. package/examples/browser/quantum-inspired/index.html +728 -0
  353. package/examples/browser/rag/index.html +624 -0
  354. package/examples/browser/swarm-intelligence/index.html +811 -0
  355. package/examples/browser-basic.html +170 -0
  356. package/examples/hnsw-example.ts +148 -0
  357. package/examples/node-basic.js +70 -0
  358. package/examples/quic-sync-example.ts +310 -0
  359. package/examples/quick-start.js +68 -0
  360. package/examples/wasm-example.ts +222 -0
  361. package/package.json +118 -0
@@ -0,0 +1,728 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Quantum-Inspired Optimization - AgentDB WASM</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ body {
15
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
16
+ background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
17
+ min-height: 100vh;
18
+ padding: 2rem;
19
+ }
20
+
21
+ .container {
22
+ max-width: 1400px;
23
+ margin: 0 auto;
24
+ }
25
+
26
+ header {
27
+ text-align: center;
28
+ color: white;
29
+ margin-bottom: 2rem;
30
+ }
31
+
32
+ h1 {
33
+ font-size: 2rem;
34
+ margin-bottom: 0.5rem;
35
+ text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
36
+ }
37
+
38
+ .subtitle {
39
+ opacity: 0.9;
40
+ font-size: 1rem;
41
+ }
42
+
43
+ .main-grid {
44
+ display: grid;
45
+ grid-template-columns: 1.5fr 1fr;
46
+ gap: 1.5rem;
47
+ margin-bottom: 1.5rem;
48
+ }
49
+
50
+ .card {
51
+ background: white;
52
+ border-radius: 12px;
53
+ padding: 1.5rem;
54
+ box-shadow: 0 8px 24px rgba(0,0,0,0.2);
55
+ }
56
+
57
+ .card h2 {
58
+ color: #333;
59
+ margin-bottom: 1rem;
60
+ font-size: 1.3rem;
61
+ }
62
+
63
+ #canvas {
64
+ width: 100%;
65
+ height: 500px;
66
+ border: 2px solid #e0e0e0;
67
+ border-radius: 8px;
68
+ background: #000;
69
+ }
70
+
71
+ .description {
72
+ background: #e8eaf6;
73
+ padding: 1rem;
74
+ border-radius: 8px;
75
+ margin-bottom: 1rem;
76
+ line-height: 1.6;
77
+ color: #555;
78
+ }
79
+
80
+ .quantum-params {
81
+ display: grid;
82
+ grid-template-columns: 1fr 1fr;
83
+ gap: 1rem;
84
+ margin-bottom: 1rem;
85
+ }
86
+
87
+ .param-group {
88
+ background: #f5f5f5;
89
+ padding: 1rem;
90
+ border-radius: 8px;
91
+ }
92
+
93
+ .param-label {
94
+ font-size: 0.85rem;
95
+ color: #666;
96
+ margin-bottom: 0.5rem;
97
+ font-weight: 600;
98
+ }
99
+
100
+ .param-value {
101
+ font-size: 1.2rem;
102
+ color: #1a237e;
103
+ font-weight: bold;
104
+ }
105
+
106
+ input[type="range"] {
107
+ width: 100%;
108
+ margin-top: 0.5rem;
109
+ }
110
+
111
+ .btn {
112
+ padding: 0.75rem 1.5rem;
113
+ background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
114
+ color: white;
115
+ border: none;
116
+ border-radius: 6px;
117
+ font-weight: 600;
118
+ cursor: pointer;
119
+ transition: opacity 0.3s;
120
+ width: 100%;
121
+ margin-bottom: 0.5rem;
122
+ }
123
+
124
+ .btn:hover {
125
+ opacity: 0.9;
126
+ }
127
+
128
+ .stat-grid {
129
+ display: grid;
130
+ grid-template-columns: repeat(2, 1fr);
131
+ gap: 1rem;
132
+ margin-bottom: 1rem;
133
+ }
134
+
135
+ .stat-item {
136
+ background: #f5f5f5;
137
+ padding: 1rem;
138
+ border-radius: 8px;
139
+ text-align: center;
140
+ }
141
+
142
+ .stat-label {
143
+ font-size: 0.85rem;
144
+ color: #666;
145
+ margin-bottom: 0.5rem;
146
+ }
147
+
148
+ .stat-value {
149
+ font-size: 1.5rem;
150
+ font-weight: bold;
151
+ color: #1a237e;
152
+ }
153
+
154
+ .superposition-visual {
155
+ background: #f5f5f5;
156
+ padding: 1rem;
157
+ border-radius: 8px;
158
+ margin-bottom: 1rem;
159
+ height: 150px;
160
+ display: flex;
161
+ align-items: center;
162
+ justify-content: center;
163
+ position: relative;
164
+ overflow: hidden;
165
+ }
166
+
167
+ .quantum-state {
168
+ position: absolute;
169
+ width: 20px;
170
+ height: 20px;
171
+ border-radius: 50%;
172
+ background: radial-gradient(circle, #00ffff 0%, #1a237e 100%);
173
+ animation: quantumFluctuation 2s infinite;
174
+ box-shadow: 0 0 20px #00ffff;
175
+ }
176
+
177
+ @keyframes quantumFluctuation {
178
+ 0%, 100% { transform: scale(1); opacity: 1; }
179
+ 50% { transform: scale(1.5); opacity: 0.5; }
180
+ }
181
+
182
+ .energy-landscape {
183
+ width: 100%;
184
+ height: 100px;
185
+ background: linear-gradient(to right, #1a237e 0%, #00ffff 50%, #1a237e 100%);
186
+ border-radius: 8px;
187
+ margin-bottom: 1rem;
188
+ position: relative;
189
+ }
190
+
191
+ .energy-marker {
192
+ position: absolute;
193
+ width: 4px;
194
+ height: 100%;
195
+ background: #ff0000;
196
+ transition: left 0.3s;
197
+ }
198
+
199
+ #log {
200
+ max-height: 200px;
201
+ overflow-y: auto;
202
+ background: #f9f9f9;
203
+ padding: 1rem;
204
+ border-radius: 8px;
205
+ font-family: 'Courier New', monospace;
206
+ font-size: 0.85rem;
207
+ line-height: 1.6;
208
+ }
209
+
210
+ .log-entry {
211
+ margin-bottom: 0.5rem;
212
+ color: #555;
213
+ }
214
+
215
+ .log-entry.success {
216
+ color: #2e7d32;
217
+ }
218
+
219
+ .log-entry.info {
220
+ color: #1976d2;
221
+ }
222
+
223
+ .algorithm-select {
224
+ display: grid;
225
+ grid-template-columns: 1fr 1fr;
226
+ gap: 0.5rem;
227
+ margin-bottom: 1rem;
228
+ }
229
+
230
+ .algo-btn {
231
+ padding: 0.75rem;
232
+ background: white;
233
+ border: 2px solid #ddd;
234
+ border-radius: 6px;
235
+ cursor: pointer;
236
+ transition: all 0.3s;
237
+ text-align: center;
238
+ font-weight: 600;
239
+ }
240
+
241
+ .algo-btn.active {
242
+ background: #1a237e;
243
+ color: white;
244
+ border-color: #1a237e;
245
+ }
246
+ </style>
247
+ </head>
248
+ <body>
249
+ <div class="container">
250
+ <header>
251
+ <h1>⚛️ Quantum-Inspired Optimization</h1>
252
+ <p class="subtitle">Superposition, Entanglement & Quantum Tunneling for Global Optimization</p>
253
+ </header>
254
+
255
+ <div class="main-grid">
256
+ <div class="card">
257
+ <h2>Quantum Search Space</h2>
258
+ <canvas id="canvas"></canvas>
259
+
260
+ <div class="algorithm-select">
261
+ <button class="algo-btn active" onclick="setAlgorithm('qpso')">🌊 QPSO</button>
262
+ <button class="algo-btn" onclick="setAlgorithm('qga')">🧬 Quantum GA</button>
263
+ <button class="algo-btn" onclick="setAlgorithm('tunnel')">🚇 Tunneling</button>
264
+ <button class="algo-btn" onclick="setAlgorithm('anneal')">❄️ Annealing</button>
265
+ </div>
266
+
267
+ <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;">
268
+ <button class="btn" onclick="startOptimization()">⚛️ Start Quantum Search</button>
269
+ <button class="btn" onclick="reset()">⟲ Reset</button>
270
+ </div>
271
+ </div>
272
+
273
+ <div class="card">
274
+ <h2>Quantum Parameters</h2>
275
+
276
+ <div class="description">
277
+ Quantum-inspired algorithms use principles from quantum mechanics (superposition, entanglement, tunneling) to escape local optima and find global solutions faster than classical methods.
278
+ </div>
279
+
280
+ <h3 style="margin-bottom: 0.5rem; color: #333;">Superposition States</h3>
281
+ <div class="superposition-visual" id="superposition">
282
+ <!-- Quantum states rendered dynamically -->
283
+ </div>
284
+
285
+ <div class="quantum-params">
286
+ <div class="param-group">
287
+ <div class="param-label">Particles</div>
288
+ <div class="param-value" id="particleCount">30</div>
289
+ <input type="range" id="particleSlider" min="10" max="100" value="30" oninput="updateParam('particles')">
290
+ </div>
291
+ <div class="param-group">
292
+ <div class="param-label">Quantum Potential</div>
293
+ <div class="param-value" id="quantumPotential">0.7</div>
294
+ <input type="range" id="potentialSlider" min="0" max="1" step="0.1" value="0.7" oninput="updateParam('potential')">
295
+ </div>
296
+ <div class="param-group">
297
+ <div class="param-label">Tunneling Prob</div>
298
+ <div class="param-value" id="tunnelingProb">0.2</div>
299
+ <input type="range" id="tunnelingSlider" min="0" max="1" step="0.05" value="0.2" oninput="updateParam('tunneling')">
300
+ </div>
301
+ <div class="param-group">
302
+ <div class="param-label">Entanglement</div>
303
+ <div class="param-value" id="entanglement">0.5</div>
304
+ <input type="range" id="entanglementSlider" min="0" max="1" step="0.1" value="0.5" oninput="updateParam('entanglement')">
305
+ </div>
306
+ </div>
307
+
308
+ <h3 style="margin-bottom: 0.5rem; color: #333;">Energy Landscape</h3>
309
+ <div class="energy-landscape">
310
+ <div class="energy-marker" id="energyMarker" style="left: 50%"></div>
311
+ </div>
312
+
313
+ <div class="stat-grid">
314
+ <div class="stat-item">
315
+ <div class="stat-label">Best Energy</div>
316
+ <div class="stat-value" id="bestEnergy">∞</div>
317
+ </div>
318
+ <div class="stat-item">
319
+ <div class="stat-label">Iterations</div>
320
+ <div class="stat-value" id="iterations">0</div>
321
+ </div>
322
+ <div class="stat-item">
323
+ <div class="stat-label">Tunneling Events</div>
324
+ <div class="stat-value" id="tunnelingEvents">0</div>
325
+ </div>
326
+ <div class="stat-item">
327
+ <div class="stat-label">Convergence</div>
328
+ <div class="stat-value" id="convergence">0%</div>
329
+ </div>
330
+ </div>
331
+ </div>
332
+ </div>
333
+
334
+ <div class="card">
335
+ <h2>📊 Quantum Optimization Log</h2>
336
+ <div id="log"></div>
337
+ </div>
338
+ </div>
339
+
340
+ <script>
341
+ // Quantum-Inspired Optimization with AgentDB
342
+ class QuantumOptimizationDB {
343
+ constructor() {
344
+ this.states = [];
345
+ this.bestState = null;
346
+ this.history = [];
347
+ this.entangledPairs = new Map();
348
+ }
349
+
350
+ initializeQuantumStates(count, bounds) {
351
+ this.states = [];
352
+ for (let i = 0; i < count; i++) {
353
+ this.states.push({
354
+ position: [
355
+ Math.random() * (bounds.xMax - bounds.xMin) + bounds.xMin,
356
+ Math.random() * (bounds.yMax - bounds.yMin) + bounds.yMin
357
+ ],
358
+ superposition: this.createSuperposition(),
359
+ phase: Math.random() * Math.PI * 2,
360
+ energy: Infinity,
361
+ pBest: null
362
+ });
363
+ }
364
+ }
365
+
366
+ createSuperposition() {
367
+ // Quantum state in superposition (complex amplitudes)
368
+ const states = [];
369
+ const numBasis = 4;
370
+
371
+ for (let i = 0; i < numBasis; i++) {
372
+ states.push({
373
+ amplitude: Math.random(),
374
+ phase: Math.random() * Math.PI * 2
375
+ });
376
+ }
377
+
378
+ // Normalize
379
+ const norm = Math.sqrt(states.reduce((sum, s) => sum + s.amplitude * s.amplitude, 0));
380
+ states.forEach(s => s.amplitude /= norm);
381
+
382
+ return states;
383
+ }
384
+
385
+ measureQuantumState(state) {
386
+ // Collapse superposition to classical state
387
+ const rand = Math.random();
388
+ let cumulative = 0;
389
+
390
+ for (let i = 0; i < state.superposition.length; i++) {
391
+ cumulative += state.superposition[i].amplitude * state.superposition[i].amplitude;
392
+ if (rand < cumulative) {
393
+ return i;
394
+ }
395
+ }
396
+
397
+ return state.superposition.length - 1;
398
+ }
399
+
400
+ quantumTunneling(state, targetEnergy, probability) {
401
+ // Quantum tunneling through energy barriers
402
+ if (Math.random() < probability) {
403
+ const tunnelingVector = [
404
+ (Math.random() - 0.5) * 2,
405
+ (Math.random() - 0.5) * 2
406
+ ];
407
+
408
+ state.position[0] += tunnelingVector[0];
409
+ state.position[1] += tunnelingVector[1];
410
+
411
+ return true;
412
+ }
413
+ return false;
414
+ }
415
+
416
+ createEntanglement(state1, state2) {
417
+ // Create quantum entanglement between states
418
+ this.entangledPairs.set(state1, state2);
419
+ this.entangledPairs.set(state2, state1);
420
+
421
+ // Synchronize phases
422
+ const avgPhase = (state1.phase + state2.phase) / 2;
423
+ state1.phase = avgPhase;
424
+ state2.phase = avgPhase;
425
+ }
426
+
427
+ async QPSO(fitnessFunc, params, iterations) {
428
+ logMessage('🌊 Starting Quantum Particle Swarm Optimization...', 'info');
429
+
430
+ const { quantumPotential, entanglement } = params;
431
+ let gBest = { position: null, energy: Infinity };
432
+
433
+ for (let iter = 0; iter < iterations; iter++) {
434
+ // Evaluate fitness
435
+ this.states.forEach(state => {
436
+ state.energy = fitnessFunc(state.position[0], state.position[1]);
437
+
438
+ if (!state.pBest || state.energy < state.pBest.energy) {
439
+ state.pBest = { position: [...state.position], energy: state.energy };
440
+ }
441
+
442
+ if (state.energy < gBest.energy) {
443
+ gBest = { position: [...state.position], energy: state.energy };
444
+ }
445
+ });
446
+
447
+ // Quantum PSO update
448
+ this.states.forEach((state, idx) => {
449
+ // Measure quantum state
450
+ const measurement = this.measureQuantumState(state);
451
+
452
+ // Calculate mean best position (mbest)
453
+ const phi = Math.random();
454
+ const mbest = [
455
+ phi * state.pBest.position[0] + (1 - phi) * gBest.position[0],
456
+ phi * state.pBest.position[1] + (1 - phi) * gBest.position[1]
457
+ ];
458
+
459
+ // Quantum update with potential well
460
+ const u = Math.random();
461
+ const sign = Math.random() < 0.5 ? 1 : -1;
462
+
463
+ state.position[0] = mbest[0] + sign * quantumPotential *
464
+ Math.abs(mbest[0] - state.position[0]) * Math.log(1 / u);
465
+ state.position[1] = mbest[1] + sign * quantumPotential *
466
+ Math.abs(mbest[1] - state.position[1]) * Math.log(1 / u);
467
+
468
+ // Quantum tunneling
469
+ if (this.quantumTunneling(state, gBest.energy, params.tunneling)) {
470
+ stats.tunnelingEvents++;
471
+ }
472
+
473
+ // Create entanglement
474
+ if (Math.random() < entanglement && idx < this.states.length - 1) {
475
+ this.createEntanglement(state, this.states[idx + 1]);
476
+ }
477
+
478
+ // Update phase
479
+ state.phase += Math.random() * 0.1;
480
+ });
481
+
482
+ // Update visualization
483
+ if (iter % 5 === 0) {
484
+ stats.iterations = iter;
485
+ stats.bestEnergy = gBest.energy.toFixed(4);
486
+ stats.convergence = Math.min(100, (iter / iterations) * 100).toFixed(0);
487
+ updateStats();
488
+ }
489
+
490
+ // Async yield
491
+ if (iter % 10 === 0) {
492
+ await new Promise(resolve => setTimeout(resolve, 10));
493
+ }
494
+ }
495
+
496
+ this.bestState = gBest;
497
+ logMessage(`✅ Optimization complete! Best energy: ${gBest.energy.toFixed(4)}`, 'success');
498
+ return gBest;
499
+ }
500
+
501
+ storeOptimizationRun(algorithm, result) {
502
+ const embedding = this.generateRunEmbedding(result);
503
+ this.history.push({
504
+ algorithm,
505
+ result,
506
+ embedding,
507
+ timestamp: Date.now()
508
+ });
509
+ }
510
+
511
+ generateRunEmbedding(result) {
512
+ const embedding = new Array(128).fill(0);
513
+ embedding[0] = result.energy;
514
+ embedding[1] = result.position[0];
515
+ embedding[2] = result.position[1];
516
+ embedding[3] = stats.tunnelingEvents;
517
+
518
+ for (let i = 4; i < embedding.length; i++) {
519
+ embedding[i] = Math.sin(result.energy * i) * Math.cos(result.position[0] * i);
520
+ }
521
+
522
+ return embedding;
523
+ }
524
+ }
525
+
526
+ // Fitness function (Rastrigin function - multi-modal optimization)
527
+ function rastriginFunction(x, y) {
528
+ const A = 10;
529
+ return A * 2 + (x*x - A * Math.cos(2 * Math.PI * x)) +
530
+ (y*y - A * Math.cos(2 * Math.PI * y));
531
+ }
532
+
533
+ // Global state
534
+ const db = new QuantumOptimizationDB();
535
+ const canvas = document.getElementById('canvas');
536
+ const ctx = canvas.getContext('2d');
537
+ canvas.width = canvas.offsetWidth;
538
+ canvas.height = canvas.offsetHeight;
539
+
540
+ let running = false;
541
+ let animationId = null;
542
+ let algorithm = 'qpso';
543
+ let params = {
544
+ particles: 30,
545
+ quantumPotential: 0.7,
546
+ tunneling: 0.2,
547
+ entanglement: 0.5
548
+ };
549
+
550
+ let stats = {
551
+ bestEnergy: '∞',
552
+ iterations: 0,
553
+ tunnelingEvents: 0,
554
+ convergence: 0
555
+ };
556
+
557
+ const bounds = { xMin: -5.12, xMax: 5.12, yMin: -5.12, yMax: 5.12 };
558
+
559
+ function drawLandscape() {
560
+ const width = canvas.width;
561
+ const height = canvas.height;
562
+
563
+ // Draw energy landscape
564
+ for (let x = 0; x < width; x += 5) {
565
+ for (let y = 0; y < height; y += 5) {
566
+ const realX = (x / width) * (bounds.xMax - bounds.xMin) + bounds.xMin;
567
+ const realY = (y / height) * (bounds.yMax - bounds.yMin) + bounds.yMin;
568
+ const energy = rastriginFunction(realX, realY);
569
+
570
+ const normalized = 1 - Math.min(energy / 100, 1);
571
+ const hue = normalized * 240; // Blue to red
572
+ ctx.fillStyle = `hsl(${hue}, 70%, 40%)`;
573
+ ctx.fillRect(x, y, 5, 5);
574
+ }
575
+ }
576
+ }
577
+
578
+ function drawQuantumStates() {
579
+ db.states.forEach(state => {
580
+ const x = ((state.position[0] - bounds.xMin) / (bounds.xMax - bounds.xMin)) * canvas.width;
581
+ const y = ((state.position[1] - bounds.yMin) / (bounds.yMax - bounds.yMin)) * canvas.height;
582
+
583
+ // Draw quantum wave function
584
+ ctx.beginPath();
585
+ for (let angle = 0; angle < Math.PI * 2; angle += 0.1) {
586
+ const radius = 10 + Math.sin(state.phase + angle * 4) * 3;
587
+ const px = x + Math.cos(angle) * radius;
588
+ const py = y + Math.sin(angle) * radius;
589
+
590
+ if (angle === 0) ctx.moveTo(px, py);
591
+ else ctx.lineTo(px, py);
592
+ }
593
+ ctx.closePath();
594
+ ctx.strokeStyle = 'rgba(0, 255, 255, 0.5)';
595
+ ctx.lineWidth = 2;
596
+ ctx.stroke();
597
+
598
+ ctx.fillStyle = 'rgba(0, 255, 255, 0.8)';
599
+ ctx.beginPath();
600
+ ctx.arc(x, y, 4, 0, Math.PI * 2);
601
+ ctx.fill();
602
+ });
603
+
604
+ // Draw best position
605
+ if (db.bestState) {
606
+ const x = ((db.bestState.position[0] - bounds.xMin) / (bounds.xMax - bounds.xMin)) * canvas.width;
607
+ const y = ((db.bestState.position[1] - bounds.yMin) / (bounds.yMax - bounds.yMin)) * canvas.height;
608
+
609
+ ctx.strokeStyle = '#00ff00';
610
+ ctx.lineWidth = 3;
611
+ ctx.beginPath();
612
+ ctx.arc(x, y, 15, 0, Math.PI * 2);
613
+ ctx.stroke();
614
+ }
615
+ }
616
+
617
+ async function startOptimization() {
618
+ if (running) return;
619
+
620
+ running = true;
621
+ stats.tunnelingEvents = 0;
622
+
623
+ db.initializeQuantumStates(params.particles, bounds);
624
+
625
+ drawLandscape();
626
+
627
+ const result = await db.QPSO(rastriginFunction, params, 100);
628
+
629
+ db.storeOptimizationRun(algorithm, result);
630
+
631
+ running = false;
632
+ animate();
633
+ }
634
+
635
+ function animate() {
636
+ drawLandscape();
637
+ drawQuantumStates();
638
+ updateSuperpositionVisual();
639
+
640
+ if (running) {
641
+ animationId = requestAnimationFrame(animate);
642
+ }
643
+ }
644
+
645
+ function updateSuperpositionVisual() {
646
+ const container = document.getElementById('superposition');
647
+ container.innerHTML = '';
648
+
649
+ for (let i = 0; i < 5; i++) {
650
+ const state = document.createElement('div');
651
+ state.className = 'quantum-state';
652
+ state.style.left = `${20 + i * 15}%`;
653
+ state.style.animationDelay = `${i * 0.2}s`;
654
+ container.appendChild(state);
655
+ }
656
+ }
657
+
658
+ function reset() {
659
+ running = false;
660
+ if (animationId) cancelAnimationFrame(animationId);
661
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
662
+ drawLandscape();
663
+ stats = { bestEnergy: '∞', iterations: 0, tunnelingEvents: 0, convergence: 0 };
664
+ updateStats();
665
+ }
666
+
667
+ function setAlgorithm(algo) {
668
+ algorithm = algo;
669
+ document.querySelectorAll('.algo-btn').forEach(btn => btn.classList.remove('active'));
670
+ event.target.classList.add('active');
671
+ logMessage(`Algorithm changed to: ${algo.toUpperCase()}`, 'info');
672
+ }
673
+
674
+ function updateParam(type) {
675
+ switch(type) {
676
+ case 'particles':
677
+ params.particles = parseInt(document.getElementById('particleSlider').value);
678
+ document.getElementById('particleCount').textContent = params.particles;
679
+ break;
680
+ case 'potential':
681
+ params.quantumPotential = parseFloat(document.getElementById('potentialSlider').value);
682
+ document.getElementById('quantumPotential').textContent = params.quantumPotential.toFixed(1);
683
+ break;
684
+ case 'tunneling':
685
+ params.tunneling = parseFloat(document.getElementById('tunnelingSlider').value);
686
+ document.getElementById('tunnelingProb').textContent = params.tunneling.toFixed(2);
687
+ break;
688
+ case 'entanglement':
689
+ params.entanglement = parseFloat(document.getElementById('entanglementSlider').value);
690
+ document.getElementById('entanglement').textContent = params.entanglement.toFixed(1);
691
+ break;
692
+ }
693
+ }
694
+
695
+ function updateStats() {
696
+ document.getElementById('bestEnergy').textContent = stats.bestEnergy;
697
+ document.getElementById('iterations').textContent = stats.iterations;
698
+ document.getElementById('tunnelingEvents').textContent = stats.tunnelingEvents;
699
+ document.getElementById('convergence').textContent = stats.convergence + '%';
700
+
701
+ // Update energy marker
702
+ if (stats.bestEnergy !== '∞') {
703
+ const normalized = 1 - Math.min(parseFloat(stats.bestEnergy) / 100, 1);
704
+ document.getElementById('energyMarker').style.left = (normalized * 100) + '%';
705
+ }
706
+ }
707
+
708
+ function logMessage(message, type = '') {
709
+ const log = document.getElementById('log');
710
+ const entry = document.createElement('div');
711
+ entry.className = `log-entry ${type}`;
712
+ const timestamp = new Date().toLocaleTimeString();
713
+ entry.textContent = `[${timestamp}] ${message}`;
714
+ log.insertBefore(entry, log.firstChild);
715
+
716
+ while (log.children.length > 20) {
717
+ log.removeChild(log.lastChild);
718
+ }
719
+ }
720
+
721
+ // Initialize
722
+ drawLandscape();
723
+ updateSuperpositionVisual();
724
+ logMessage('⚛️ Quantum optimization system initialized', 'success');
725
+ logMessage('Using Rastrigin function (highly multi-modal) for testing', 'info');
726
+ </script>
727
+ </body>
728
+ </html>