Skip to main content

Python Client library for Qaekwy Operational Research Solver

Project description

Qaekwy Python Client

Operational Research at your fingertips.

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 using Qaekwy, streamlining the process of formulating complex problems and finding optimal solutions.

Qaekwy is small optimization problem solver engine designed to tackle a wide range of real-world challenges. It provides powerful modeling capabilities and efficient solving algorithms to find optimal solutions to complex problems.

Features

  • Modeling Made Easy: Define variables, constraints, and objective functions seamlessly. Qaekwy's Modeller class helps you create optimization models with clarity and precision.

  • Diverse Constraint Support: Qaekwy supports various constraint types, from simple arithmetic to complex mathematical expressions. Create constraints that accurately represent real-world scenarios.

  • Effortless Optimization: Qaekwy abstracts away the complexities of communication with optimization engine. Send requests and receive responses using intuitive methods.

  • Flexibility: You can leverage the Qaekwy Python Client to tailor optimization problems to their specific needs by utilizing Qaekwy's modelling capabilities. This includes handling various types of constraints, objectives, and solver algorithms.

Installation

pip install qaekwy

Documentation

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

Example

How to use the Qaekwy Python Client to solve a very small optimization problem:

from qaekwy.engine import DirectEngine
from qaekwy.model.constraint.relational import RelationalExpression
from qaekwy.model.specific import SpecificMaximum
from qaekwy.model.variable.integer import IntegerVariable
from qaekwy.model.modeller import Modeller
from qaekwy.model.searcher import SearcherType

# Define the optimization problem using Qaekwy Python Client
class SimpleOptimizationProblem(Modeller):
    def __init__(self):
        super().__init__()

        # Create a integer variables
        x = IntegerVariable(var_name="x", domain_low=0, domain_high=10)
        y = IntegerVariable(var_name="y", domain_low=0, domain_high=10)
        z = IntegerVariable(var_name="z", domain_low=0, domain_high=10)

        # Constraints
        constraint_1 = RelationalExpression(y > 2 * x)
        constraint_2 = RelationalExpression(x >= 4)
        constraint_3 = RelationalExpression(z == y - x)

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

        # Add variable and constraint to the problem
        self.add_variable(x)
        self.add_variable(y)
        self.add_variable(z)
        self.add_constraint(constraint_1)
        self.add_constraint(constraint_2)
        self.add_constraint(constraint_3)

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

# Create a Qaekwy engine for interaction with the freely-available Cloud instance
qaekwy_engine = DirectEngine()

# Create the optimization problem instance
optimization_problem = SimpleOptimizationProblem()

# Request the Qaekwy engine to solve the problem
response = qaekwy_engine.model(model=optimization_problem)

# Retrieve the list of solutions from the response
list_of_solutions = response.get_solutions()

# Print the solution(s) obtained
for solution in list_of_solutions:
    print(f"Optimal solution: x = {solution.x}")
    print(f"Optimal solution: y = {solution.y}")
    print(f"Optimal solution: z = {solution.z}")

Output:

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

License

This software is licensed under the European Union Public License v1.2

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.1.4.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

qaekwy-0.1.4-py3-none-any.whl (49.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qaekwy-0.1.4.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for qaekwy-0.1.4.tar.gz
Algorithm Hash digest
SHA256 3a173ce97baaf90b44a42ec05ce7ea64ed7321381265ca3ca0a832147f01b54b
MD5 f72f9b9d3c744db42a7baf3c4d5cb058
BLAKE2b-256 00cddc690a0675bf74176fc892743704d5f1ccdb2c9cbebd5995ffbebd868793

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qaekwy-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 49.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for qaekwy-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5ca501687b3fc93d61d3c83ee7492e2e012a4c8f8c15268c3995614ec19f87a4
MD5 7f173441536a0f271461c3d3c8f73cc0
BLAKE2b-256 72c91fdc984d7edf639df140b54afe960f84288d13d2a6fa310e08aa02edb1c3

See more details on using hashes here.

Supported by

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