mobiu-q 2.4.1__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.
mobiu_q-2.4.1/PKG-INFO ADDED
@@ -0,0 +1,383 @@
1
+ Metadata-Version: 2.4
2
+ Name: mobiu-q
3
+ Version: 2.4.1
4
+ Summary: Soft Algebra Optimizer for Quantum & Complex Optimization
5
+ Author-email: Mobiu Technologies <ai@mobiu.ai>
6
+ License: Proprietary
7
+ Project-URL: Homepage, https://app.mobiu.ai
8
+ Project-URL: Documentation, https://pypi.org/project/mobiu-q/
9
+ Keywords: quantum,optimization,VQE,QAOA,machine-learning
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Topic :: Scientific/Engineering :: Physics
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: numpy>=1.21.0
23
+ Requires-Dist: requests>=2.25.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7.0; extra == "dev"
26
+ Requires-Dist: pytest-cov; extra == "dev"
27
+ Provides-Extra: full
28
+ Requires-Dist: scipy>=1.7.0; extra == "full"
29
+ Requires-Dist: qiskit>=0.40.0; extra == "full"
30
+
31
+ # Mobiu-Q (v2.4.1)
32
+
33
+ **Universal Physics-Aware Optimizer for Stochastic Systems**
34
+
35
+ [![PyPI version](https://badge.fury.io/py/mobiu-q.svg)](https://badge.fury.io/py/mobiu-q)
36
+ [![Win Rate](https://img.shields.io/badge/Win%20Rate-100%25-brightgreen)](https://mobiu.ai)
37
+ [![License](https://img.shields.io/badge/License-Proprietary-blue)](https://mobiu.ai)
38
+
39
+ **Mobiu-Q** is the first optimizer based on **Soft Algebra**. By mathematically decomposing gradients into *Potential* ($a_t$) and *Realization* ($b_t$), it filters out noise in real-time.
40
+
41
+ Works across **Quantum Computing**, **Reinforcement Learning**, **FinTech**, and **Complex Engineering**.
42
+
43
+ ---
44
+
45
+ ## ๐Ÿš€ What's New in v2.4
46
+
47
+ - **Reinforcement Learning Support**: New `method="rl"` with +129% improvement on LunarLander
48
+ - **Multi-Optimizer**: Choose from Adam, NAdam, AMSGrad, SGD, Momentum, LAMB
49
+ - **MuJoCo Robotics**: +118% improvement on continuous control tasks
50
+ - **Crypto Trading**: +10.9% profit improvement in high-volatility environments
51
+
52
+ ---
53
+
54
+ ## ๐Ÿ† Benchmark Results (v2.4)
55
+
56
+ ### Reinforcement Learning
57
+ | Environment | Improvement | p-value | Win Rate |
58
+ |-------------|-------------|---------|----------|
59
+ | **LunarLander-v3** | **+129.7%** | 0.000000 | 96.7% |
60
+ | **MuJoCo InvertedPendulum** | **+118.6%** | 0.001 | 100% |
61
+ | **Crypto Trading** | **+10.9% profit** | 0.005 | 90% |
62
+
63
+ ### Quantum Computing
64
+ | Problem | Improvement | p-value | Win Rate |
65
+ |---------|-------------|---------|----------|
66
+ | **VQE H2 (IBM FakeFez)** | **+53.1%** | 0.001 | 100% |
67
+ | **QAOA MaxCut** | **+21.5%** | <0.05 | 85% |
68
+
69
+ ### Classical Optimization
70
+ | Problem | Improvement |
71
+ |---------|-------------|
72
+ | Rosenbrock Valley | +75.8% |
73
+ | Credit Risk (VaR) | +52.3% |
74
+ | Portfolio Optimization | +51.7% |
75
+
76
+ ---
77
+
78
+ ## ๐Ÿ“ฆ Installation
79
+
80
+ ```bash
81
+ pip install mobiu-q
82
+ ```
83
+
84
+ ### Verify Installation
85
+
86
+ Download our test suite to verify everything works:
87
+
88
+ ```bash
89
+ # Quick verification (7 tests, ~2 min)
90
+ python test_quickstart.py
91
+
92
+ # Full test suite (21 tests, ~15 min)
93
+ pytest test_mobiu_q_customer.py -v
94
+
95
+ # Benchmark with statistics
96
+ python benchmark_mobiu_q.py --seeds 10
97
+ ```
98
+
99
+ Test files available at: [github.com/mobiuai/mobiu-q/examples](https://github.com/mobiuai/mobiu-q/tree/main/examples)
100
+
101
+ ---
102
+
103
+ ## โšก Quick Start
104
+
105
+ ### 1. VQE (Quantum Chemistry)
106
+
107
+ ```python
108
+ from mobiu_q import MobiuQCore, Demeasurement
109
+
110
+ opt = MobiuQCore(license_key="YOUR-KEY", method="vqe")
111
+
112
+ for step in range(100):
113
+ grad = Demeasurement.finite_difference(energy_fn, params)
114
+ params = opt.step(params, grad, energy_fn(params))
115
+
116
+ opt.end()
117
+ ```
118
+
119
+ For real quantum hardware, use `mode="hardware"` and SPSA:
120
+ ```python
121
+ opt = MobiuQCore(license_key="YOUR-KEY", method="vqe", mode="hardware")
122
+
123
+ for step in range(100):
124
+ grad, energy = Demeasurement.spsa(run_circuit, params)
125
+ params = opt.step(params, grad, energy)
126
+
127
+ opt.end()
128
+ ```
129
+
130
+ ### 2. QAOA (Combinatorial Optimization)
131
+
132
+ ```python
133
+ opt = MobiuQCore(license_key="YOUR-KEY", method="qaoa")
134
+
135
+ for step in range(150):
136
+ grad, energy = Demeasurement.spsa(qaoa_cost_fn, params)
137
+ params = opt.step(params, grad, energy)
138
+
139
+ opt.end()
140
+ ```
141
+
142
+ For hardware: `mode="hardware"`
143
+
144
+ ### 3. Reinforcement Learning (NEW in v2.4)
145
+
146
+ ```python
147
+ opt = MobiuQCore(license_key="YOUR-KEY", method="rl")
148
+
149
+ for episode in range(1000):
150
+ # Run episode, compute policy gradient
151
+ episode_return = run_episode(policy)
152
+ gradient = compute_policy_gradient()
153
+
154
+ policy_params = opt.step(policy_params, gradient, episode_return)
155
+
156
+ opt.end()
157
+ ```
158
+
159
+ ### 4. Multi-Seed Experiments (1 billing session)
160
+
161
+ ```python
162
+ opt = MobiuQCore(license_key="YOUR-KEY")
163
+
164
+ for seed in range(10):
165
+ opt.new_run() # Resets state, keeps session open
166
+ params = init_params(seed)
167
+ # ... optimization loop ...
168
+
169
+ opt.end() # All 10 seeds count as 1 run
170
+ ```
171
+
172
+ ---
173
+
174
+ ## ๐ŸŽ›๏ธ Configuration
175
+
176
+ ### Methods and Modes
177
+
178
+ | Method | Mode | Use Case | Default LR |
179
+ |--------|------|----------|------------|
180
+ | `vqe` | `simulation` | Simulated VQE (you control noise) | 0.01 |
181
+ | `vqe` | `hardware` | Real quantum hardware / FakeBackend | 0.02 |
182
+ | `qaoa` | `simulation` | Simulated QAOA (you control noise) | 0.1 |
183
+ | `qaoa` | `hardware` | Real quantum hardware / FakeBackend | 0.1 |
184
+ | `rl` | (ignored) | Reinforcement learning | 0.0003 |
185
+
186
+ > **When to use `hardware` mode:** Use when running on real quantum devices (IBM, IonQ, etc.)
187
+ > or Qiskit FakeBackends. The optimizer uses higher learning rate to compensate for hardware noise.
188
+
189
+ ### Optimizers (NEW in v2.4)
190
+
191
+ Default: **Adam** (recommended - works best across all methods)
192
+
193
+ ```python
194
+ # Use default (Adam)
195
+ opt = MobiuQCore(method="vqe")
196
+
197
+ # Try alternative optimizer
198
+ opt = MobiuQCore(method="qaoa", base_optimizer="NAdam")
199
+ ```
200
+
201
+ Available optimizers:
202
+ - **Adam** (default) - Best overall performance
203
+ - **NAdam** - Strong on QAOA problems
204
+ - **AMSGrad** - May outperform on VQE simulation
205
+ - **LAMB** - High improvement potential, less stable
206
+ - **SGD** / **Momentum** - Simple baselines
207
+
208
+ ### Disable Soft Algebra
209
+
210
+ For A/B testing against plain optimizers:
211
+
212
+ ```python
213
+ # Plain Adam (no Soft Algebra)
214
+ opt = MobiuQCore(method="vqe", use_soft_algebra=False)
215
+ ```
216
+
217
+ ---
218
+
219
+ ## ๐Ÿง  How It Works
220
+
221
+ ### The Core Innovation: "Noise Hallucination" Prevention
222
+
223
+ Standard optimizers (Adam, SGD) assume lower objective values always indicate better solutions. In noisy environmentsโ€”like NISQ processors or stochastic RLโ€”this fails. Optimizers "tunnel" into noise, creating **Noise Hallucinations**.
224
+
225
+ **The Solution:** Soft Algebra cross-coupled state evolution:
226
+
227
+ ```
228
+ S_{t+1} = (ฮณ ยท S_t) ยท ฮ”_t + ฮ”_t
229
+ ```
230
+
231
+ Where:
232
+ - `a_t` (Potential): Curvature signal from energy history
233
+ - `b_t` (Realized): Actual improvement achieved
234
+ - `ฮ”โ€ ` (Super-Equation): Emergence detection for QAOA/RL
235
+
236
+ A parameter update is only committed if the *Potential Field* is validated by *Realized Improvement*.
237
+
238
+ ### Method-Specific Logic
239
+
240
+ | Method | Primary Mechanism | Best For |
241
+ |--------|-------------------|----------|
242
+ | VQE | Trust Ratio + Gradient Warping | Smooth energy landscapes |
243
+ | QAOA | Super-Equation ฮ”โ€  | Rugged, multimodal landscapes |
244
+ | RL | Trust + Emergence + Warping | High-variance, sparse rewards |
245
+
246
+ ---
247
+
248
+ ## ๐Ÿ“Š When to Use Mobiu-Q
249
+
250
+ โœ… **Use Mobiu-Q when:**
251
+ - High noise/variance (quantum hardware, RL, stochastic finance)
252
+ - Rugged landscapes with many local minima
253
+ - Expensive function evaluations
254
+ - Standard optimizers diverge or get stuck
255
+
256
+ โŒ **Skip Mobiu-Q when:**
257
+ - Clean, convex problems (vanilla SGD is fine)
258
+ - Deterministic, low-noise environments
259
+ - Very low variance settings
260
+
261
+ ---
262
+
263
+ ## ๐Ÿ”‘ Pricing
264
+
265
+ | Tier | Runs/Month | Features |
266
+ |------|------------|----------|
267
+ | **Free** | 20 | Testing & students |
268
+ | **Pro** | Unlimited | Priority processing, all features |
269
+
270
+ **[Get your License Key](https://app.mobiu.ai)**
271
+
272
+ ---
273
+
274
+ ## ๐Ÿ“š API Reference
275
+
276
+ ### MobiuQCore
277
+
278
+ ```python
279
+ MobiuQCore(
280
+ license_key: str, # Your license key
281
+ method: str = "vqe", # "vqe", "qaoa", or "rl"
282
+ mode: str = "simulation", # "simulation" or "hardware"
283
+ base_lr: float = None, # Learning rate (auto if None)
284
+ base_optimizer: str = "Adam", # Optimizer choice
285
+ use_soft_algebra: bool = True, # Enable/disable SA
286
+ offline_fallback: bool = True # Fallback to local Adam
287
+ )
288
+ ```
289
+
290
+ **Methods:**
291
+ - `step(params, gradient, energy)` โ†’ Updated params
292
+ - `new_run()` โ†’ Reset for new seed (same session)
293
+ - `end()` โ†’ End session (counts usage)
294
+ - `check_usage()` โ†’ Get remaining runs
295
+
296
+ ### Demeasurement
297
+
298
+ ```python
299
+ # For VQE (smooth landscapes)
300
+ grad = Demeasurement.finite_difference(energy_fn, params)
301
+ grad = Demeasurement.parameter_shift(circuit_fn, params)
302
+
303
+ # For QAOA/hardware (noisy)
304
+ grad, energy = Demeasurement.spsa(energy_fn, params)
305
+ ```
306
+
307
+ ---
308
+
309
+ ## ๐Ÿ’ก Best Practices
310
+
311
+ ### Simulation vs Hardware
312
+
313
+ **Simulation (clean analytical functions):**
314
+ ```python
315
+ opt = MobiuQCore(method="vqe", mode="simulation")
316
+
317
+ for step in range(100):
318
+ grad = Demeasurement.finite_difference(energy_fn, params)
319
+ energy = energy_fn(params)
320
+ params = opt.step(params, grad, energy)
321
+ ```
322
+
323
+ **Hardware (Qiskit FakeBackend / real quantum device):**
324
+ ```python
325
+ opt = MobiuQCore(method="vqe", mode="hardware")
326
+
327
+ for step in range(100):
328
+ grad, energy = Demeasurement.spsa(run_circuit, params)
329
+ params = opt.step(params, grad, energy)
330
+ ```
331
+
332
+ The noise comes from the device - you don't add it yourself.
333
+
334
+ ### Recommended Steps
335
+
336
+ | Problem Type | Recommended Steps |
337
+ |--------------|-------------------|
338
+ | VQE (2-4 params) | 60-100 |
339
+ | VQE (8+ params) | 150-200 |
340
+ | QAOA (p=2-5) | 150-200 |
341
+ | RL (LunarLander) | 500-1000 episodes |
342
+
343
+ ### When Optimization Fails
344
+
345
+ 1. **Check mode matches your environment:**
346
+ - `mode="simulation"` โ†’ Clean simulation only (no added noise)
347
+ - `mode="hardware"` โ†’ Real quantum hardware or noisy simulation (FakeBackend)
348
+ - Using the wrong mode will give poor results!
349
+
350
+ 2. **Try a different base optimizer:**
351
+ - Before adjusting learning rate, try: `base_optimizer="NAdam"` or `"AMSGrad"`
352
+ - Different optimizers work better for different problems
353
+ - Mobiu-Q wraps these optimizers with Soft Algebra
354
+
355
+ 3. **Don't mix methods with wrong problem types:**
356
+ - Use `method="vqe"` for VQE/chemistry problems
357
+ - Use `method="qaoa"` for QAOA/combinatorial problems
358
+ - Mixing them (e.g., QAOA method for VQE problem) may not work well
359
+
360
+ 4. **Verify your problem setup:**
361
+ - Check Hamiltonian coefficients are correct
362
+ - Verify ground state energy is computed correctly
363
+ - Ensure ansatz can actually reach the ground state
364
+ - Test with a simple grid search first
365
+
366
+ ---
367
+
368
+ ## ๐Ÿ”ฌ Citation
369
+
370
+ If you use Mobiu-Q in research:
371
+
372
+ ```bibtex
373
+ @software{mobiu_q,
374
+ title = {Mobiu-Q: Soft Algebra Optimizer for Stochastic Systems},
375
+ author = {Mobiu Technologies},
376
+ year = {2024},
377
+ url = {https://mobiu.ai}
378
+ }
379
+ ```
380
+
381
+ ---
382
+
383
+ *Proprietary technology. All rights reserved by Mobiu Technologies.*