Skip to main content

Python client for SaaS optimization API

Project description

opticlient

A lightweight Python client for interacting with the SaaS optimization API.
This package provides a clean interface for submitting optimization jobs, polling their status, and retrieving results.

Currently supported tools:

  • MAXSAT - solves a .wcnf instance in the format of "maxsat evaluation" - post 2022
  • Single Machine Scheduling (sms) — submit an Excel instance and obtain an ordered job schedule.

More tools will be added in future versions.

For details visit: https://github.com/Milan-Adhikari/opticlient


Installation

pip install opticlient

Quick Usage Guide

opticlient requires an API key, which you obtain from the website https://cad-eta.vercel.app

You can provide it in either of two ways:

Option 1 - Environment variable (recommended)

export OPTICLIENT_API_TOKEN="YOUR_API_KEY"

Option 2 - Pass directly in code

from opticlient import OptiClient

client = OptiClient(api_token="YOUR_API_KEY")

Quick Start: Single Machine Scheduling (SMS)

The SMS tool takes an Excel file describing a scheduling instance and returns an ordered sequence of jobs. You can download the sample Excel file from https://cad-eta.vercel.app or see below.

Basic usage

# use case for maxsat
from opticlient import OptiClient

client = OptiClient()  # reads token/base URL from environment if available
# set the file path first (!!! necessary)
client.maxsatSolver.set_file("test.wcnf")
solution = client.maxsatSolver.optimize()

print("Solution:", solution)
# use case for single machine scheduling problem
from opticlient import OptiClient

client = OptiClient()  # reads token/base URL from environment if available

schedule = client.sms.run(
    file_path="instance.xlsx",
    description="Test run",
)

print("Job schedule:")
for job in schedule:
    print(job)

Sample .wcnf File format

c Example WCNF file (post-2023 MaxSAT Evaluation format) c Offset: 0

h 1 -2 3 0 h -1 4 0

5 2 -3 0 3 -4 0 1 5 0

Sample Excel File format

Job Job1 Job2 Job3 Job4
Job1 0 2 1 1
Job2 3 0 1 1
Job3 5 4 1 2
Job4 2 2 1 0

Versioning

This package follows semantic versioning:

  • 0.x — early releases, API may change
  • 1.0+ — stable API

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

opticlient-0.1.4.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

opticlient-0.1.4-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for opticlient-0.1.4.tar.gz
Algorithm Hash digest
SHA256 16554462d964ba91241c3a8538eedb9a9e6248092258d627c166a655a7a5e2ef
MD5 e43b49b82fb9bac62427b2a003e73fd9
BLAKE2b-256 22c910e1229ef1eaf6763a9a326b20ddfbcbd4ba7beb0aeee729e8445dfb9bc3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for opticlient-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 de931668766f0022e7bfbd41ca004c2aa3e0777e49496ef9a11eea66fc343b49
MD5 c530763d0c5396f134c19fe96f933be5
BLAKE2b-256 3b8f3ebd4cabafa6c0a3abda5a59722cebdcad97ecb1b79be9c2a0cf8ef0f555

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