def get_constraints(self) -> Iterable[expr.BooleanExpression]: constraints = [] base_quantities = [ variable.get_name().replace('_1', '') for variable in self.problem.get_variables() if variable.get_name().endswith('_1') ] for quantity in base_quantities: original_variables = [ variable for variable in self.problem.get_variables() if re.search(quantity + '_[0-9]+$', variable.get_name()) is not None ] aggregate_variables = [ variable for variable in self.problem.get_variables() if re.search( quantity + '_(' + '|'.join(ms_data_utility.AGGREGATE_FUNCTIONS) + ')$', variable.get_name()) is not None ] constraints.append( expr.Not( expr.And([ expr.Or(original_variables), expr.Or(aggregate_variables) ]))) return constraints
def get_constraints(self) -> Iterable[expr.BooleanExpression]: gamma_variables = [ variable for variable in self.problem.get_variables() if 'gamma' in variable.get_name() ] gamma_abs_variables = [ variable for variable in gamma_variables if 'gamma_abs' in variable.get_name() ] gamma_variables = [ variable for variable in gamma_variables if 'gamma_abs' not in variable.get_name() ] return [ expr.Not( expr.And( [expr.Or(gamma_variables), expr.Or(gamma_abs_variables)])) ]
def get_constraints(self) -> Iterable[expr.BooleanExpression]: return [ expr.Not(v) for v, q in zip(self.problem.get_variables(), self.problem.get_qualities()) if q < self.threshold ] # could also express this with expr.Implies()
def get_constraints(self) -> Iterable[expr.BooleanExpression]: return [ expr.Not(expr.And([v1, v2])) for v1, v2 in self.correlation_pairs ]
def generate(self, variables: Sequence[expr.Variable]) -> expr.BooleanExpression: return expr.Not(expr.And(variables))