Skip to main content

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 three ways:

Option 1 - .env file (recommended)

# create a .env file and set the api token in it
OPTICLIENT_API_TOKEN="YOUR_API_KEY"

Option 2 - Environment variable

export OPTICLIENT_API_TOKEN="YOUR_API_KEY"

Option 3 - Pass directly in code

from opticlient import MaxSAT, OptiClient

solver = MaxSAT(api_token="YOUR_API_KEY")
client = OptiClient(api_token="YOUR_API_KEY")

Basic usage: MaxSAT

# use case for maxsat
from opticlient import MaxSAT

# solving from a file
solver = MaxSAT("filename.wcnf")  # reads token/base URL from environment if available
x = solver.optimize()
print("solution:", x)

# solving without a file
solver = MaxSAT()  # reads token/base URL from environment if available
solver.addClause([1,2])
solver.addClause([-1,2])
solver.setObjective({2 : -1 })
x = solver.optimize()
print("solution:", x)

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

Basic usage: Single Machine Scheduling

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.

# 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 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

Metadata

Release files for opticlient 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opticlient 0.1.6
File Size Uploaded
opticlient-0.1.6.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opticlient 0.1.6
File Interpreter ABI Platform
opticlient-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / opticlient-0.1.6.tar.gz

Download URL opticlient-0.1.6.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e860f8d915dcfdfb4b7a4653ae8c35777908864960806e868d2c8cfb3e4133af
BLAKE2b-256 checksum
How to use checksums
a45302e48203e76f24700d0025cddc0fa25a76b4ded37d234e1029af6b6ebacb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / opticlient-0.1.6-py3-none-any.whl

Download URL opticlient-0.1.6-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
21c654071217ebfbc04a63762e3593b1588196008d8e9236b7addae9595e7fd0
BLAKE2b-256 checksum
How to use checksums
21ca32398078915e65ba249628d4151f0752833c557176a00320d79d228c66ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.4

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page