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.

def define(self, *names, **kwargs):
        """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.
        """
        names = tuple(names)
        for name in names:
            if name in self._variables:
                raise ValueError('Variable already defined: {!r}'.format(name))

        lower = kwargs.get('lower', None)
        upper = kwargs.get('upper', None)
        vartype = kwargs.get('types', None)

        # Repeat values if a scalar is given
        if lower is None or isinstance(lower, numbers.Number):
            lower = repeat(lower, len(names))
        if upper is None or isinstance(upper, numbers.Number):
            upper = repeat(upper, len(names))
        if vartype is None or vartype in (
                VariableType.Continuous, VariableType.Binary,
                VariableType.Integer):
            vartype = repeat(vartype, len(names))

        # Assign default values
        vartype = tuple(VariableType.Continuous if value is None else value
                        for value in vartype)

        if len(names) == 0:
            return

        var_indices = count(swiglpk.glp_add_cols(self._p, len(names)))

        for i, name, lb, ub, vt in zip(
                var_indices, names, lower, upper, vartype):
            self._variables[name] = i

            lb = None if lb == -_INF else lb
            ub = None if ub == _INF else ub

            if lb is None and ub is None:
                swiglpk.glp_set_col_bnds(self._p, i, swiglpk.GLP_FR, 0, 0)
            elif lb is None:
                swiglpk.glp_set_col_bnds(
                    self._p, i, swiglpk.GLP_UP, 0, float(ub))
            elif ub is None:
                swiglpk.glp_set_col_bnds(
                    self._p, i, swiglpk.GLP_LO, float(lb), 0)
            elif lb == ub:
                swiglpk.glp_set_col_bnds(
                    self._p, i, swiglpk.GLP_FX, float(lb), 0)
            else:
                swiglpk.glp_set_col_bnds(
                    self._p, i, swiglpk.GLP_DB, float(lb), float(ub))

            if vt != VariableType.Continuous:
                swiglpk.glp_set_col_kind(self._p, i, self.VARTYPE_MAP[vt])

        self._do_presolve = True