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

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

  • 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.

  • Flexibility: Devs can leverage the client to tailor optimization problems to their specific needs by utilizing Qaekwy's modeling 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}")

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.3.tar.gz (32.5 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.1.3-py3-none-any.whl (49.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qaekwy-0.1.3.tar.gz
  • Upload date:
  • Size: 32.5 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.3.tar.gz
Algorithm Hash digest
SHA256 aee6fdfd0c86568ff712764315c49c63750900ccda9e067c09bf43f8a1218e2a
MD5 3803eab67eb7b9f95d3f9e628fddf466
BLAKE2b-256 52b99549abe7a4de02db6d2a4dbee0baee8d9407f4e1570e308b20dfde9146d2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qaekwy-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 49.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 61bff1983164bb243ae9b8818286b8e9c7ef75c54f0a39e4317d809c9becfa57
MD5 f92e80b59bff7f0b6b8ebae4f143c00b
BLAKE2b-256 75075619ca26af17486827f1dc41f1276b5c670bcaefcf19a5f20f1ac88c9ece

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