Skip to main content

Python client library for Qaekwy, a high-performance operational research solver.

Project description

Qaekwy Python Client

An Open-source Python framework for constraint programming and optimization

GitHub License PyPI - Version PyPI - Downloads

The Qaekwy Python Client serves as a powerful tool to interact with the Qaekwy optimization solver engine through its API. This client provides a convenient and programmatic way to create, model, and solve optimization problems by streamlining the process of formulating complex problems and finding optimal solutions.

Qaekwy is small optimization problem solver engine designed to provide powerful modeling capabilities and efficient solving algorithms to find optimal solutions to complex problems.

Features

  • Variables: Supports integer, float, and boolean variables, including arrays for complex models.
  • Constraints: Offers a wide range of constraints for flexible problem modeling.
  • Optimization: Minimize or maximize objective functions to find optimal solutions.
  • Flexible Search Strategies: Choose from algorithms like Depth-First Search (DFS) and Branch and Bound (BAB).

Documentation

Explore the Qaekwy Documentation for in-depth guides, examples, and usage details.

Getting Started

Prerequisites

  • Python 3.12 or higher
  • pip (Python package manager)

Installation

pip install qaekwy

Verify the installation

python -m qaekwy --version

Code

Get started with Qaekwy in just a few steps:

  • Create a model by defining:
    • variables
    • constraints
    • objectives (optional)
  • Run your model and retrieve solutions.

See the Example below for a practical demonstration:

from qaekwy.engine import DirectEngine
from qaekwy.model.specific import SpecificMaximum
from qaekwy.model.variable.integer import (
    IntegerVariable,
    IntegerExpressionVariable
)
from qaekwy.model.modeller import Modeller
from qaekwy.model.searcher import SearcherType

# Define the optimization model
class SimpleOptimizationProblem(Modeller):
    def __init__(self):
        super().__init__()

        # Define integer variables with domain [0, 10]
        x = IntegerVariable("x", domain_low=0, domain_high=10)
        y = IntegerVariable("y", domain_low=0, domain_high=10)
        z = IntegerExpressionVariable("z", expression=y - x)

        # Add variables to the model
        self.add_variable(x).add_variable(y).add_variable(z)

        # Define constraints
        self.add_constraint(y > 2 * x)
        self.add_constraint(x >= 4)

        # Set objective: Maximize z
        self.add_objective(
            SpecificMaximum(variable=z)
        )

        # Set search strategy
        self.set_searcher(SearcherType.BAB)

# Instantiate the cloud-based solver
qaekwy_engine = DirectEngine()

# Build and solve the model
model = SimpleOptimizationProblem()
response = qaekwy_engine.model(model=model)

# Display solutions
for solution in response.get_solutions():
    print(f"Optimal solution:")
    print(f"- x = {solution.x}")
    print(f"- y = {solution.y}")
    print(f"- z = {solution.z}")

Output:

Optimal solution:
- x = 4
- y = 10
- z = 6

License

Project details


Download files

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

Source Distribution

qaekwy-0.2.0.tar.gz (37.7 kB view details)

Uploaded Source

Built Distribution

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

qaekwy-0.2.0-py3-none-any.whl (58.4 kB view details)

Uploaded Python 3

File details

Details for the file qaekwy-0.2.0.tar.gz.

File metadata

  • Download URL: qaekwy-0.2.0.tar.gz
  • Upload date:
  • Size: 37.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for qaekwy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b1d5828eb0139fcc1436e1eaf23c371ec47217db92dab47f4bab6ce961695bec
MD5 277c2c7903361004987a4da7efe0618f
BLAKE2b-256 139a3b7023126063947594f8ad6d5b00f6761a680e5d85c1c536a60b8efb67d5

See more details on using hashes here.

File details

Details for the file qaekwy-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: qaekwy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 58.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for qaekwy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b4b81f1f1796febe43ea30c413815fbbeb9d2a8a4dde72f1026f30aa9c80544
MD5 36326c124529b1d83ad80d86a67728a5
BLAKE2b-256 5bde6e5b33ac8f74929923803c78070d77aa67b01f682a76b23a1fc38b203cfb

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