gana.sets.constraint#

General Constraint Class

Functions

deepcopy(x[, memo, _nil])

Deep copy operation on arbitrary Python objects.

display(*objs[, include, exclude, metadata, ...])

Display a Python object in all frontends.

Classes

C(function[, leq, parent, pos, nn, category])

Represents a relationship between Parameters, Variables, or Expressions.

FCase(*values)

function cases

Math([data, url, filename, metadata])

class C(function: F | V, leq: bool = False, parent: C = None, pos: int = None, nn: bool = False, category: str = 'General')[source]#

Bases: object

Represents a relationship between Parameters, Variables, or Expressions.

This class is not intended to be used directly. It is constructed based on relationships between parameter sets, variable sets, or function sets.

Parameters:
  • function (F) – Function set

  • leq (bool, optional) – If the constraint is less than or equal to. Defaults to False.

  • parent (C, optional) – Parent constraint set. Defaults to None.

  • pos (int, optional) – Position of the constraint in the set. Defaults to None.

  • nn (bool, optional) – If the constraint is non-negative. Defaults to False.

Variables:
  • _ (list[Cons]) – List of constraints

  • function (F) – Function set

  • leq (bool) – If the constraint is less than or equal to

  • binding (bool) – If the constraint is binding

  • nn (bool) – If the constraint is non-negative

  • index (P) – Index of the constraint set (product of all indices)

  • eq (bool) – If the constraint is an equality constraint

  • one (V | P) – Element one in the function

  • two (V | P) – Element two in the function

  • name (str) – Name of the constraint (shows the operation)

  • n (int) – Number of the set in the program

  • pname (str) – Name given by user in program

Raises:
  • ValueError – Adding constraints of different types (leq and eq)

  • ValueError – Subtracting constraints of different types (leq and eq)

  • ValueError – Cannot multiply constraints

  • ValueError – Cannot divide constraints

property name: str#
categorize(category: str)[source]#

Categorizes the constraint

Parameters:

category (str) – Category name

update_variables()[source]#

Update variables in the constraint set

copy() Self[source]#

Copy the constraint set

property A: list[float | None]#

Variable Coefficients

property P: list[None | int]#

Variables

property B: float | None#

Constant

property F: float | None#
property Z: float | None#
property matrix: dict#

Matrix as dict

property eq#

Equality Constraint

property one#

element one in function

property two#

element two in function

mps()[source]#

Name in MPS file

latex() str[source]#

Latex representation

show(descriptive: bool = False)[source]#

Display the function

property longname: str#

Long name

output(n_sol: int = 0, compare=False)[source]#

Solution

order()[source]#