qat.opt.boolexpr.Var

class qat.opt.boolexpr.Var(index)

Simple class for boolean variables

index

the variable index (unique identifier)

Type

int

Parameters

index (int) – the variable index

evaluate(assignment)

Returns the boolean value of the variable in an assignment list

Parameters

assignment (list<bool>) – A list of boolean representing the value of each variables

Returns

The result of the evaluation

Return type

bool

get_terms_obs()

Returns a boolean valued diagonal cost observable matching the evaluation of the variable: \((1 - \sigma_z^i) / 2\) where \(i\) is the index of the variable.

The observable will act upon self.index + 1 qubits.

get_variables()

Returns a singleton with the index of the variable