Belle II Software development
Constraint Class Reference

Public Member Functions

def __init__ (self, comment="", value=0.)
 
def add (self, label, coeff)
 
def get_checksum (self)
 

Public Attributes

 value
 Value.
 
 comment
 Comment.
 
 data
 Data.
 

Detailed Description

Class representing a linear constraint for global parameters

Definition at line 16 of file constraints.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  comment = "",
  value = 0. 
)
Initialize constraint

comment : str
  TODO: Not yet used
value : float
  The constant term of the constraint: sum(c_i * par_i) = value

Definition at line 21 of file constraints.py.

21 def __init__(self, comment="", value=0.):
22 """
23 Initialize constraint
24
25 comment : str
26 TODO: Not yet used
27 value : float
28 The constant term of the constraint: sum(c_i * par_i) = value
29 """
30
31 self.value = value
32
33 self.comment = comment
34
35 self.data = []
36

Member Function Documentation

◆ add()

def add (   self,
  label,
  coeff 
)
Add coefficient for a global parameter

Parameters
----------
label : int
  global parameter id (GlobalLabel::label())
coeff : float
  coefficient of the parameter in constraint

Definition at line 37 of file constraints.py.

37 def add(self, label, coeff):
38 """
39 Add coefficient for a global parameter
40
41 Parameters
42 ----------
43 label : int
44 global parameter id (GlobalLabel::label())
45 coeff : float
46 coefficient of the parameter in constraint
47 """
48 entry = (label, coeff)
49 self.data.append(entry)
50

◆ get_checksum()

def get_checksum (   self)
Get a checksum to distinguish constraints quickly (computed only from labels)

Definition at line 51 of file constraints.py.

51 def get_checksum(self):
52 """Get a checksum to distinguish constraints quickly (computed only from labels)
53 """
54 labels_only = [label for (label, coeff) in self.data]
55 checksum = hash(str(labels_only))
56 return checksum
57
58

Member Data Documentation

◆ comment

comment

Comment.

Definition at line 33 of file constraints.py.

◆ data

data

Data.

Definition at line 35 of file constraints.py.

◆ value

value

Value.

Definition at line 31 of file constraints.py.


The documentation for this class was generated from the following file: