def get_lpi(self): 'get (maybe create) the LpInstance object for this star + inputs, and return it' rv = self._star_lpi if rv is None: rv = LpInstance(self.num_dims, self.num_dims) rv.update_basis_matrix(self.basis_matrix) for lc in self.constraint_list: rv.add_basis_constraint(lc.vector, lc.value) # add the influence of the inputs if self.input_stars is not None: for input_star in self.input_stars: rv.add_input_star(input_star.a_matrix_t, input_star.b_vector, input_star.input_basis_matrix) self._star_lpi = rv return rv
def make_combined_lpi(self, automaton_transition=None, skip_inputs=False): 'create one lpi per guard, which will have both the star and input effects, as well as the guard condition' lpi = LpInstance(self.star.num_dims, self.star.num_dims) lpi.update_basis_matrix(self.star.basis_matrix) for lc in self.star.constraint_list: lpi.add_basis_constraint(lc.vector, lc.value) # add standard basis guard constraints if automaton_transition is not None: for lc in automaton_transition.condition_list: lpi.add_standard_constraint(lc.vector, lc.value) # add any input star constraints mode = self.star.mode if not skip_inputs and self.star.input_stars is not None: for input_star in self.star.input_stars: lpi.add_input_star(mode.u_constraints_a_t, mode.u_constraints_b, input_star.input_basis_matrix) return lpi