Soft Algebra Optimizer for Quantum & Complex Optimization
Project description
Mobiu-Q v2.9.1
Mobiu-Q wraps your existing optimizer with Soft Algebra and the new Frustration Engine to filter noise, detect stagnation, and improve convergence. Same API, better results.
๐ What's New in v2.9.1
Frustration Engine - Client-side adaptive mechanism that:
- Detects when optimization is stuck
- Automatically boosts learning rate 3x
- Achieves +60% improvement over base Soft Algebra on LunarLander
# Frustration Engine activates automatically!
opt = MobiuOptimizer(base_opt, method="adaptive", maximize=True)
โก Quick Start
from mobiu_q import MobiuOptimizer
# PyTorch (RL, LLM, Deep Learning)
base_opt = torch.optim.Adam(model.parameters(), lr=0.0003)
opt = MobiuOptimizer(base_opt, license_key="YOUR_KEY", method="adaptive")
# RL with Frustration Engine (maximize=True for rewards)
opt = MobiuOptimizer(base_opt, license_key="YOUR_KEY", method="adaptive", maximize=True)
# Quantum (VQE, QAOA) - pass params instead of optimizer
params = np.random.randn(10)
opt = MobiuOptimizer(params, license_key="YOUR_KEY", method="standard", mode="simulation")
Note:
MobiuOptimizerauto-detects PyTorch optimizers vs numpy arrays and uses the appropriate backend.
๐ง Configuration
Methods
| Method | Best For | Default LR |
|---|---|---|
standard |
VQE, Chemistry, smooth landscapes | 0.01 (sim) / 0.02 (hw) |
deep |
QAOA, combinatorial, rugged landscapes | 0.1 |
adaptive |
RL, LLM, high-variance problems | 0.0003 |
Modes (Quantum only)
| Mode | When to Use | Gradient Method |
|---|---|---|
simulation |
Clean simulator (Qiskit Aer, PennyLane default) | Finite Difference (2N evals) |
hardware |
Real quantum hardware, FakeFez, noisy backends | SPSA (2 evals, noise-resilient) |
Rule of thumb: If your backend has noise โ use hardware. If it's a perfect simulator โ use simulation.
New: maximize Parameter (v2.9.0)
# For Loss minimization (default)
opt = MobiuOptimizer(base_opt, maximize=False)
# For Reward maximization (RL)
opt = MobiuOptimizer(base_opt, maximize=True)
A/B Testing Parameter
# For fair comparisons, toggle Soft Algebra:
opt = MobiuOptimizer(base_opt, use_soft_algebra=True) # Default - SA + Frustration Engine
opt = MobiuOptimizer(base_opt, use_soft_algebra=False) # Baseline - SA disabled
๐ฆ Installation
pip install mobiu-q
๐ฏ Usage Examples
PyTorch (RL with Frustration Engine)
import torch
from mobiu_q import MobiuOptimizer
LICENSE_KEY = "your-license-key"
policy = PolicyNetwork()
base_opt = torch.optim.Adam(policy.parameters(), lr=0.0003)
opt = MobiuOptimizer(
base_opt,
license_key=LICENSE_KEY,
method="adaptive",
maximize=True, # NEW: For RL rewards
use_soft_algebra=True, # Enables Frustration Engine
verbose=True
)
for episode in range(1000):
reward = run_episode(policy)
loss = compute_policy_loss(...)
loss.backward()
opt.step(reward) # Frustration Engine auto-detects stagnation
opt.zero_grad()
opt.end()
PyTorch (Loss Minimization)
opt = MobiuOptimizer(
base_opt,
license_key=LICENSE_KEY,
method="adaptive",
maximize=False, # Default: minimize loss
sync_interval=50,
)
for epoch in range(100):
loss = criterion(model(x), y)
loss.backward()
opt.step(loss.item())
opt.zero_grad()
opt.end()
Quantum VQE (Simulation)
from mobiu_q import MobiuOptimizer
import numpy as np
params = np.random.randn(10)
opt = MobiuOptimizer(
params,
license_key=LICENSE_KEY,
method="standard",
mode="simulation",
)
for step in range(100):
params = opt.step(params, energy_fn)
opt.end()
Standalone Frustration Engine
from mobiu_q import UniversalFrustrationEngine
engine = UniversalFrustrationEngine(base_lr=0.001)
for step in range(1000):
metric = evaluate()
factor = engine.get_lr_factor(metric)
current_lr = base_lr * factor # 1.0x, 2.0x, or 3.0x
# Use current_lr in your optimizer
๐ License Key
Get your key at app.mobiu.ai
# Option 1: Pass directly
opt = MobiuOptimizer(base_opt, license_key="your-key")
# Option 2: Environment variable
export MOBIU_Q_LICENSE_KEY="your-key"
# Option 3: Save to file (one time)
from mobiu_q import save_license_key
save_license_key("your-key")
๐ Verified Benchmark Results
All benchmarks use fair A/B testing: Soft Algebra ON vs OFF, same seeds, same conditions.
๐ Frustration Engine Results (v2.9.0)
| Configuration | LunarLander Score | vs Vanilla |
|---|---|---|
| Vanilla Adam | -98.3 | - |
| Soft Algebra Only | -70.9 | +27.9% |
| SA + Frustration Engine | -27.6 | +71.9% |
Frustration Engine adds +60% improvement on top of Soft Algebra!
- Win rate: 5/5 seeds (100%)
- p-value: 0.03125
๐ฎ Reinforcement Learning
| Environment | Improvement | Win Rate | p-value | Cohen's d |
|---|---|---|---|---|
| LunarLander-v3 | +146.9% | 93.3% | < 0.000001 | +1.50 |
| Atari Breakout | +54.2% | 100% | - | - |
LunarLander: 30 seeds, 1000 episodes each. Atari: 3 seeds, 200 episodes each.
๐ฐ Portfolio Optimization
| Noise Level | Improvement | Win Rate | p-value | Cohen's d |
|---|---|---|---|---|
| 1% | +16.8% | 100% | < 0.000001 | +0.94 |
| 10% | +13.7% | 100% | < 0.000001 | +0.99 |
| 50% | +12.8% | 100% | < 0.000001 | +0.98 |
100 seeds per noise level. Sharpe ratio optimization on AAPL, GOOGL, MSFT, AMZN, TSLA.
Overall: 300/300 wins (100%), average improvement +14.5%
โ๏ธ Quantum VQE on IBM FakeFez
| Molecule | Qubits | Improvement | Win Rate |
|---|---|---|---|
| Hโ | 2 | +52.5% | 100% |
| BeHโ | 6 | +55.1% | 100% |
| LiH | 4 | +34.5% | 100% |
๐ฏ QAOA on IBM FakeFez
| Problem | Improvement | p-value |
|---|---|---|
| MaxCut | +45.1% | 0.0003 |
๐ ๏ธ Troubleshooting
Not Improving?
- Try maximize=True: For RL rewards, set
maximize=True - Switch optimizer: Try
NAdamorMomentum(Quantum mode) - Switch method:
standardโadaptiveโdeep - Adjust LR: Diverging โ lower by 2-5x, stuck โ raise by 2x
- Reduce sync_interval: Try
sync_interval=1for more frequent updates
Frustration Engine Not Triggering?
- Check if
use_soft_algebra=True(default) - Engine needs 20+ steps to detect stagnation
- Verify
maximizeparameter matches your metric
๐ API Reference
MobiuOptimizer (Universal)
MobiuOptimizer(
optimizer_or_params, # torch.optim.Optimizer OR np.ndarray
license_key: str,
method: str = "adaptive", # "standard", "deep", "adaptive"
mode: str = "simulation", # "simulation", "hardware"
use_soft_algebra: bool = True,
sync_interval: int = 50, # Cloud sync frequency (PyTorch only)
maximize: bool = False, # NEW: True for RL rewards
verbose: bool = True
)
UniversalFrustrationEngine (NEW in v2.9.0)
UniversalFrustrationEngine(
base_lr: float, # Base learning rate
sensitivity: float = 0.05 # Stagnation sensitivity
)
# Methods:
engine.get_lr_factor(metric) # Returns 1.0, 2.0, or 3.0
engine.reset() # Reset for new run
๐ฌ How It Works
Soft Algebra (Klein/Maimon Theory)
SoftNumber multiplication (ฮตยฒ=0):
(a, b) ร (c, d) = (ad + bc, bd)
The Super-Equation ฮโ detects emergence moments for adaptive scaling.
Frustration Engine (v2.9.0)
โโโโโโโโโโโโโโโโโโโโโโโ
โ Performance โ
โ History (50 steps)โ
โโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ Stagnation โโโโโโโโโโโโโโโโโโโโโโโ
โ Stagnation โ โโโโ Detected โโโโโถโ LR Boost (3x) โ
โ Detection โ โ for 30 steps โ
โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ Normal
โโโโโโโโโโโโโโโโโโโโโโโ
โ LR Factor = 1.0 โ
โโโโโโโโโโโโโโโโโโโโโโโ
๐ฐ Pricing
| Tier | Price | Runs |
|---|---|---|
| Free | $0 | 20 runs/month |
| Pro | $19/month | Unlimited |
Get your key at app.mobiu.ai
๐งโ๐ฌ Scientific Foundation
Based on Soft Numbers theory developed by Dr. Moshe Klein and Prof. Oded Maimon (Tel Aviv University), as presented in their book on Soft Logic and Soft Numbers.
๐ Links
- Website: mobiu.ai
- App: app.mobiu.ai
- PyPI: pypi.org/project/mobiu-q
ยฉ 2025-2026 Mobiu Technologies. All rights reserved.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mobiu_q-2.9.1.tar.gz.
File metadata
- Download URL: mobiu_q-2.9.1.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18bab673e26416cf602465ccbb2cd63687b0fefa9c2fd26c83978ec4dbb85829
|
|
| MD5 |
167a78a50d7455677e6e3e43564f77cb
|
|
| BLAKE2b-256 |
f25574341ea434f076f45a3cc9c343df63e56de21f501fdeb14e3207fdb4acda
|
File details
Details for the file mobiu_q-2.9.1-py3-none-any.whl.
File metadata
- Download URL: mobiu_q-2.9.1-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21525c6a940c728329cfdba7ad942fc01547a1ec2188b62f9f3242b023c48a3b
|
|
| MD5 |
11be25b29f49082d6fd4abb5d870efb6
|
|
| BLAKE2b-256 |
6ba3ca5c044f0e5c4d91b2893f13ef77168049d970e30961d7d7bfb6518c3841
|