def define(self, *names, **kwargs):
names = tuple(names)<EOL>for name in names:<EOL><INDENT>if name in self._variables:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(name))<EOL><DEDENT><DEDENT>lower = kwargs.get('<STR_LIT>', None)<EOL>upper = kwargs.get('<STR_LIT>', None)<EOL>vartype = kwargs.get('<STR_LIT>', None)<EOL>if lower is None or isinstance(lower, numbers.Number):<EOL><INDENT>lower = repeat(lower, len(names))<EOL><DEDENT>if upper is None or isinstance(upper, numbers.Number):<EOL><INDENT>upper = repeat(upper, len(names))<EOL><DEDENT>if vartype is None or vartype in (<EOL>VariableType.Continuous, VariableType.Binary,<EOL>VariableType.Integer):<EOL><INDENT>vartype = repeat(vartype, len(names))<EOL><DEDENT>vartype = tuple(VariableType.Continuous if value is None else value<EOL>for value in vartype)<EOL>if len(names) == <NUM_LIT:0>:<EOL><INDENT>return<EOL><DEDENT>var_indices = count(swiglpk.glp_add_cols(self._p, len(names)))<EOL>for i, name, lb, ub, vt in zip(<EOL>var_indices, names, lower, upper, vartype):<EOL><INDENT>self._variables[name] = i<EOL>lb = None if lb == -_INF else lb<EOL>ub = None if ub == _INF else ub<EOL>if lb is None and ub is None:<EOL><INDENT>swiglpk.glp_set_col_bnds(self._p, i, swiglpk.GLP_FR, <NUM_LIT:0>, <NUM_LIT:0>)<EOL><DEDENT>elif lb is None:<EOL><INDENT>swiglpk.glp_set_col_bnds(<EOL>self._p, i, swiglpk.GLP_UP, <NUM_LIT:0>, float(ub))<EOL><DEDENT>elif ub is None:<EOL><INDENT>swiglpk.glp_set_col_bnds(<EOL>self._p, i, swiglpk.GLP_LO, float(lb), <NUM_LIT:0>)<EOL><DEDENT>elif lb == ub:<EOL><INDENT>swiglpk.glp_set_col_bnds(<EOL>self._p, i, swiglpk.GLP_FX, float(lb), <NUM_LIT:0>)<EOL><DEDENT>else:<EOL><INDENT>swiglpk.glp_set_col_bnds(<EOL>self._p, i, swiglpk.GLP_DB, float(lb), float(ub))<EOL><DEDENT>if vt != VariableType.Continuous:<EOL><INDENT>swiglpk.glp_set_col_kind(self._p, i, self.VARTYPE_MAP[vt])<EOL><DEDENT><DEDENT>self._do_presolve = True<EOL>
Define a variable in the problem.

        Variables must be defined before they can be accessed by var() or
        set(). This function takes keyword arguments lower and upper to define
        the bounds of the variable (default: -inf to inf). The keyword argument
        types can be used to select the type of the variable (Continuous
        (default), Binary or Integer). Setting any variables different than
        Continuous will turn the problem into an MILP problem. Raises
        ValueError if a name is already defined.