Skip to main content

No project description provided

Project description

A quick what-is-dis

A Python library for connecting to a puan-db instance. Puan DB is a logical reasoning database which draws conclusions from a model and finds combinations which satisfies a model while minimizing/maximizing some objective function.

There are two types of variables to keep in mind:

  • Primitives. These are defined by an ID given by you, and a lower and upper bound representing which integer values this variable may take in the future. The bound is a complex number so a boolean variable x would be declared with the bound 0+1j, or just 1j, as such model.set_primitive("x", 1j)
  • Composites. These are created using one or more other primitives or composites as a connecter between them. For instance, an OR-connector is defined as model.set_or(["x","y","z"]).

Example

import puan_db_python

model = puan_db_python.PuanClient(
    host="localhost",
    port=50051,
    password=None,
    ssl=False
)

# Set some primitive variables
model.set_primitives(["x","y","z"])

# And a composite
id = model.set_atleast(["x","y","z"], 1, alias="A")

# Same one could be set instead by
other_id = model.set_or(["x","y","z"], alias="A")
assert id == other_id

# If you forget the id but remember the alias, there's a pointer to it
forgot_id = model.id_from_alias("A")
assert (id == forgot_id) and (forgot_id == other_id)

# Now we can do some propagation to verify some values.
# For instance, if x is 1, then A should be true as well.
# Note that you must give the ID and not the alias when getting its value
model.propagate_downstream({"x": 1+1j}).get(id) == 1+1j 

# Or maybe we want to find a combination that trying
# to not include x and even more not y, such that (x or y or z) must be true.
# Note that we can send in multiple "objectives" and there's one solution returned
# by each objective
solutions = model.solve([{"x": -1, "y": -2}], {id: 1})

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

puan_db_python-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

puan_db_python-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file puan_db_python-0.1.0.tar.gz.

File metadata

  • Download URL: puan_db_python-0.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.19 Darwin/23.1.0

File hashes

Hashes for puan_db_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 055ce5ee4c7dca26593891f339931eaceae6bb7905c8d3886384171657655d15
MD5 48a3305ace6da703f16f585928df006d
BLAKE2b-256 8cd0d7884e9161e652d4f30b8e6b7aa8612e3e0d9ae72a3ad9b6c6878e4990f4

See more details on using hashes here.

File details

Details for the file puan_db_python-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: puan_db_python-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.19 Darwin/23.1.0

File hashes

Hashes for puan_db_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a7b98c87ab19bb51ef91da5df980582d11c9924eb1ad167ec07dd45bfeb7392
MD5 3e4f1f7be62c0d3dc8ca58e0c542de9b
BLAKE2b-256 47dae95e1f1a4fc63e1b80baef1440636302c5f0ba3d92a43dcf7e00244654b5

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