specless.inference.timed_partial_order.TimeConstraintsLP

class specless.inference.timed_partial_order.TimeConstraintsLP(traces, partial_order, decimals: int = 2, threshold: float = 0.5, slack_threshold: float = 0.1)[source]

Bases: object

Handle Time Constraints Operation for Linear Programming

events                  A set of events
pairs                   A set of event pairs
Type:

source, target

event_to_bound          A dictionary that maps an event to
Type:

lb, ub

event_pair_to_bound     A dictionary that maps an event pair to
Type:

lb, ub

A, b
event_to_index
pair_to_index

Methods

construct_lp_constraints

Construct Linear Programming Constraints

get_column_index

Get the event variable index (column index)

get_constraint_string

Get Constraint String

get_constraints_without

Get Constraints A and b without the specified constraint

get_event_from_row_index

Get Event from index

get_event_row_index

Get an index for the given constraint (row index)

get_events

Find which event the indices are refering to

get_events_string

Translate a constraint to an strin

get_pair_bound

Get Lower/Upper bound for the event pair

get_pair_from_row_index

Get Pair From index

get_pair_row_index

Get Index of the constraint

get_row

Get a row of the provided constraint

get_signs

Get Sign

is_redundant

Check whther the constraint was redudant by analyzing the changes between the original bound and the new bound

remove_constraint

Remove the constraint

set_event_bound

Set Event Lower/Upper Bound

set_pair_bound

Set Pair Lower/Upper Bound

solvefor

Solve for the specified constraint.

construct_lp_constraints() None[source]

Construct Linear Programming Constraints

get_column_index(event: str) int[source]

Get the event variable index (column index)

get_constraint_string(source_event: str, target_event: str, get_lb: bool, decimals: int) str[source]

Get Constraint String

get_constraints_without(source_event: str, target_event: str, get_lb: bool) Tuple[ndarray, ndarray][source]

Get Constraints A and b without the specified constraint

get_event_from_row_index(index: int) str[source]

Get Event from index

get_event_row_index(event: str, get_lb: bool) int[source]

Get an index for the given constraint (row index)

get_events(row: ndarray) List[source]

Find which event the indices are refering to

get_events_string(source_event: str, target_event: str) str[source]

Translate a constraint to an strin

get_pair_bound(source_event: str, target_event: str, get_lb: bool) float[source]

Get Lower/Upper bound for the event pair

get_pair_from_row_index(index: int) Tuple[str, str][source]

Get Pair From index

get_pair_row_index(source_event: str, target_event: str, get_lb: bool) int[source]

Get Index of the constraint

get_row(source_event: str, target_event: str, get_lb: bool) ndarray[source]

Get a row of the provided constraint

get_signs(row: ndarray, get_lb: bool) ndarray[source]

Get Sign

is_redundant(orig_bound: float, new_bound: float, lb: bool, threshold: float) bool[source]

Check whther the constraint was redudant by analyzing the changes between the original bound and the new bound

remove_constraint(source_event: str, target_event, lb: bool) None[source]

Remove the constraint

set_event_bound(event: str, lb: float | None = None, ub: float | None = None) None[source]

Set Event Lower/Upper Bound

set_pair_bound(source_event: str, target_event: str, lb: float | None = None, ub: float | None = None) None[source]

Set Pair Lower/Upper Bound

solvefor(source_event: str, target_event: str, lb: bool, decimals: int | None = None, threshold: float | None = None, slack_threshold: float | None = None, debug: bool = False) Dict[source]

Solve for the specified constraint. 1. Remove the specified constraint from the constraint list 2. Optimize for the specified constraint (minimize if lb or else maximize if ub) 3. If the constraint was identified “redundant”, return all the information