FlexQAOA: Quantum Optimization Meets Constraints
FlexQAOA:
A Practical Quantum Approach to Solving Real-World Problems
In real-world scenarios, optimization isn’t just about finding a theoretically optimal solution – it’s about finding one that respects real constraints and actually works in practice. Yet many quantum algorithms struggle with these constraints. Instead of incorporating them natively, they often rely on workarounds that introduce inefficiencies and reduce performance.
That’s why we developed FlexQAOA, a constraint-aware quantum optimization algorithm that embraces real-world limitations instead of fighting them. FlexQAOA is built to tackle the complexity of industrial challenges head-on, delivering better solutions by making constraints part of the algorithm’s core.
Why Constraints Matter
Optimization problems in industries like energy, logistics, or manufacturing are rarely unconstrained. They involve physical limits, operational rules, and business requirements. Violating these constraints can mean the entire solution fails.
A classic example is production scheduling, a critical task in industries like manufacturing, automotive, and pharmaceuticals. It involves assigning production tasks to available machines over a defined time horizon while optimizing for cost, throughput, or efficiency. But real-world production planning is never unconstrained.
Companies must ensure that each machine operates within its technical capabilities, that tasks are completed before their delivery deadlines, that raw materials are available when needed, and that labor shifts are balanced. Downtime, maintenance windows, and interdependencies between production steps add further complexity.
However, most standard quantum optimization algorithms are designed to work with unconstrained problems. To apply them to real-world scenarios, constraints must first be transformed into a format the algorithm can handle. The most common method is to reformulate the problem into a QUBO, a Quadratic Unconstrained Binary Optimization model.
In this format, constraints aren’t directly supported. Instead, they are encoded as penalty terms – mathematical expressions that punish constraint violations by artificially increasing the cost of invalid solutions. This turns a constrained optimization problem into an unconstrained one that embeds constraint logic indirectly.
While this approach enables compatibility with many quantum algorithms, it comes at a cost:
- Wasted computational effort on exploring infeasible solutions,
- Distorted solution landscapes, where penalties outweigh the true optimization goal,
- High sensitivity to parameter tuning, where the success of the algorithm depends on selecting the right penalty weights.
As a result, solutions found using this method are often far from optimal, and sometimes even unusable in practice.
FlexQAOA: Embracing Constraints by Design
FlexQAOA represents a fundamental shift in how quantum optimization handles real-world complexity. Rather than converting constraints into penalty terms, it integrates them natively into the structure of the algorithm. Built upon the Quantum Approximate Optimization Algorithm (QAOA), FlexQAOA introduces a modular architecture that allows constraint types to directly influence the quantum circuit design.
This eliminates many of the drawbacks associated with QUBO-based reformulations, such as unnecessary slack variables or misleading optimization landscapes, and leads to more efficient, higher-quality solutions.
XY-Mixers: Enforcing One-Hot Constraints Naturally
Many practical problems involve mutually exclusive choices, where exactly one option from a group must be selected. This arises in use cases like:
- Manufacturing: A machine can typically produce only one product type at a time – deciding which product to assign to which machine is a one-hot decision.
- Energy systems: A power unit can only operate in one configuration or state at a given time, such as standby, active, or maintenance, each with different cost and capacity implications.
- Transport and logistics: A vehicle must be assigned to exactly one route or delivery task from a set of options, each with specific timing and load constraints.
Standard QAOA uses so-called X-mixers that indiscriminately explore all possible bitstrings, including invalid combinations. In contrast, FlexQAOA leverages XY-mixers, a family of quantum operators that restrict the evolution of the quantum state to only the one-hot subspace – states where exactly one bit is 1, and the rest are 0. These mixers preserve feasibility throughout the optimization process and eliminate the need for penalties or post-selection.
For practical implementation, FlexQAOA uses ring mixers, a circuit-efficient instantiation of XY-mixers, which can be compiled with lower depth and fewer two-qubit gates, making them more suitable for near-term quantum devices.
Indicator Functions: Handling Inequality Constraints Without Slack Variables
Inequality constraints, such as budget ceilings, capacity limits, or time windows, restrict the solution space by setting upper or lower bounds on what is allowed. For example, a company may not exceed a certain cost budget, a warehouse has limited storage space, or a delivery must be completed within a specific timeframe. These constraints are pervasive in real-world optimization problems across industries.
Traditional methods handle these constraints by adding slack variables to the problem and augmenting the objective with penalty terms. While this enables compatibility with unconstrained optimization frameworks, it expands the search space and distorts the problem structure, often making convergence harder and reducing solution quality.
FlexQAOA takes a different approach. It incorporates indicator functions that act as constraint-aware phase operators. If a quantum state violates a given constraint, the circuit applies a fixed phase shift, leaving the objective function untouched. This method preserves the problem structure while ensuring constraint violation is discouraged through this constant penalty.
Our implementation draws on principles from Quantum Phase Estimation (QPE) to embed constraint satisfaction into the phase space of the quantum state. By avoiding auxiliary variables and quadratic penalty terms, we maintain a smaller, cleaner search space that directly reflects the valid solutions.
Modular and Extensible Architecture
FlexQAOA is designed with flexibility in mind. Our compiler automatically analyzes a given constrained optimization problem and selects the most appropriate encoding method for each constraint type. For one-hot constraints, it activates XY-based mixers. For inequalities, it uses indicator-phase logic. For both, it combines the two approaches. This modularity allows additional constraint types and encodings to be incorporated easily, ensuring future extensibility as new problem structures will be included.
Moreover, the constraint-aware design significantly improves the efficiency of simulation backends. By operating only within the feasible subspace, FlexQAOA avoids the exponential blow-up of infeasible states common in QUBO formulations. This makes it possible to simulate larger problems that would otherwise be intractable under traditional QAOA using state-vector simulation.
Benchmarking the Multi-Knapsack Problem
The multi-dimensional Knapsack problem is a foundational model for many industry-relevant optimization tasks. At its core, the problem aims to assign N items—each with weight w_i and value v_i—to m bins with capacities W_j, such that the total value is maximized while respecting the total capacities of the bins.
This problem naturally incorporates the two main elements addressed by FlexQAOA: mutually exclusive assignments (each item goes into one bin or none) and inequality constraints (each bin has a limited capacity).
To also capture the case where an item is not selected at all, we introduce a binary dummy variable y_i for each item. This results in the following formulation:
To evaluate the performance of FlexQAOA on this problem class, we compared our approach against a recent study that analyzed the simulated performance of various encodings of the multi-dimensional Knapsack problem, formulated as an unconstrained model. The study focused on two key performance metrics:
-
P^*: the probability of sampling the optimal solution
-
P_{90}: the probability of sampling a “good” solution, defined as the aggregate probability of all samples with an approximation ratio \geq 90%
Higher values of these metrics indicate better algorithmic performance.
Even at just one QAOA layer (p = 1), FlexQAOA performs on par with the Trotterized Adiabatic Evolution (TAE) approach without slack variables — the best-performing method in the baseline study. As the number of layers increases, FlexQAOA drastically improves the solution quality: at p = 10, all instances achieve P^* \geq 1% and P_{90} \geq 10%, highlighting the algorithm’s strong solution quality even in constrained, multi-variable problem spaces.
For a comprehensive overview of the theoretical foundations and experimental results, see our publication on FlexQAOA here.
Looking Ahead
FlexQAOA is already fully available in its first version, including all key features described above. At the same time, we are actively expanding its capabilities to support even more use cases and optimize performance further. Current focus areas include:
- Support for additional constraint types: We’re expanding the modular compiler to support further industrial constraint patterns through specialized, pluggable encodings.
- Hardware-efficient implementations: Our team is optimizing quantum circuit designs to respect hardware limitations such as qubit connectivity and circuit depth, ensuring compatibility with near-term quantum devices.
- Hybrid quantum-classical approaches: We are integrating classical preprocessing and postprocessing methods to reduce quantum runtime, enhance robustness, and lower overall resource demands.
Real-World Applications
- Energy systems: Optimal allocation of generation units, demand response planning, and grid balancing – under capacity, timing, and regulatory constraints.
- Supply chain management: Inventory control with storage limits, supplier dependencies, and delivery deadlines.
- Manufacturing: Production scheduling across machines and shifts, considering setup times, material availability, and maintenance windows.
- Finance: Portfolio construction under risk exposure, diversification requirements, and investment ceilings.
- Mobility and logistics: Vehicle routing, workforce shift planning, and multimodal transport optimization with real-world feasibility boundaries.
The framework has shown strong performance in simulation benchmarks. Besides the results seen above for the Multi-Knapsack problem, FlexQAOA significantly outperformed QUBO-based methods on real-world case studies with our industry partners.
Conclusion
Encoding constraints directly into quantum algorithms can significantly improve both solution quality and implementation efficiency. By avoiding the limitations of penalty-based approaches, FlexQAOA opens up new possibilities for solving real-world optimization problems with quantum methods.
The framework is now available for simulation on our Luna platform, included in both academic and commercial plans. Users can start using the algorithm today. You can find the full documentation here and a hands-on introduction to the Luna platform here. After successful tests on real quantum hardware, support for live QPU execution is now in preparation and will be added to Luna in an upcoming release.
If you’re interested in the detailed formulation, implementation, and benchmarking results of FlexQAOA, take a look at our full research paper here.
This work was supported by the German Federal Ministry of Research, Technology and Space (BMFTR) under the funding program “Förderprogramm Quantentechnologien – von den Grundlagen zum Markt” (funding program quantum technologies — from basic research to market), project QuCUN.
About Aqarios
Aqarios, headquartered in Munich, Germany, is a leading provider of quantum computing solutions across industries such as energy, aerospace, logistics, finance, manufacturing and many more. The company delivers advanced quantum software that focuses on optimization, machine learning, and simulation, offering practical tools that address critical business challenges. Aqarios has collaborated with globally recognized organizations to deliver tailored quantum solutions that drive efficiency and innovation.
Founded in 2021 by three professors and seasoned business professionals, Aqarios is a spin-off from the QAR-Lab at LMU Munich, a globally renowned hub for quantum computing research that ranks among the world’s top quantum computing institutes. With nearly a decade of experience in quantum applications, Aqarios is at the forefront of quantum innovation, leveraging its deep expertise to bridge the gap between theoretical quantum research and real-world applications.