def _add_constraints(self, relation):
expression = relation.expression<EOL>constr_count = sum(True for _ in expression.value_sets())<EOL>if constr_count == <NUM_LIT:0>:<EOL><INDENT>return []<EOL><DEDENT>row_indices = count(swiglpk.glp_add_rows(self._p, constr_count))<EOL>names = []<EOL>for i, value_set in zip(row_indices, expression.value_sets()):<EOL><INDENT>value_set = list(value_set)<EOL>var_indices = swiglpk.intArray(<NUM_LIT:1> + len(value_set))<EOL>var_values = swiglpk.doubleArray(<NUM_LIT:1> + len(value_set))<EOL>for j, (variable, coeff) in enumerate(value_set):<EOL><INDENT>var_indices[<NUM_LIT:1> + j] = self._variables[variable]<EOL>var_values[<NUM_LIT:1> + j] = float(coeff)<EOL><DEDENT>swiglpk.glp_set_mat_row(<EOL>self._p, i, len(value_set), var_indices, var_values)<EOL>if relation.sense == RelationSense.Greater:<EOL><INDENT>swiglpk.glp_set_row_bnds(<EOL>self._p, i, swiglpk.GLP_LO, -float(expression.offset), <NUM_LIT:0>)<EOL><DEDENT>elif relation.sense == RelationSense.Less:<EOL><INDENT>swiglpk.glp_set_row_bnds(<EOL>self._p, i, swiglpk.GLP_UP, <NUM_LIT:0>, -float(expression.offset))<EOL><DEDENT>else:<EOL><INDENT>swiglpk.glp_set_row_bnds(<EOL>self._p, i, swiglpk.GLP_FX, -float(expression.offset), <NUM_LIT:0>)<EOL><DEDENT>names.append(i)<EOL><DEDENT>self._do_presolve = True<EOL>return names<EOL>
Add the given relation as one or more constraints.

        Return a list of the names of the constraints added.