Skip to main content

Soft Algebra Optimizer for Quantum & Complex Optimization

Project description

Mobiu-Q v2.9.1

PyPI version License

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: MobiuOptimizer auto-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?

  1. Try maximize=True: For RL rewards, set maximize=True
  2. Switch optimizer: Try NAdam or Momentum (Quantum mode)
  3. Switch method: standard โ†” adaptive โ†” deep
  4. Adjust LR: Diverging โ†’ lower by 2-5x, stuck โ†’ raise by 2x
  5. Reduce sync_interval: Try sync_interval=1 for more frequent updates

Frustration Engine Not Triggering?

  • Check if use_soft_algebra=True (default)
  • Engine needs 20+ steps to detect stagnation
  • Verify maximize parameter 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


ยฉ 2025-2026 Mobiu Technologies. All rights reserved.

Project details


Release history Release notifications | RSS feed

This version

2.9.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mobiu_q-2.9.1.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mobiu_q-2.9.1-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

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

Hashes for mobiu_q-2.9.1.tar.gz
Algorithm Hash digest
SHA256 18bab673e26416cf602465ccbb2cd63687b0fefa9c2fd26c83978ec4dbb85829
MD5 167a78a50d7455677e6e3e43564f77cb
BLAKE2b-256 f25574341ea434f076f45a3cc9c343df63e56de21f501fdeb14e3207fdb4acda

See more details on using hashes here.

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

Hashes for mobiu_q-2.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 21525c6a940c728329cfdba7ad942fc01547a1ec2188b62f9f3242b023c48a3b
MD5 11be25b29f49082d6fd4abb5d870efb6
BLAKE2b-256 6ba3ca5c044f0e5c4d91b2893f13ef77168049d970e30961d7d7bfb6518c3841

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page