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>lp_names = tuple(next(self._var_names) for name in names)<EOL>lower = (-cp.infinity if value is None or value == -_INF<EOL>else float(value) for value in lower)<EOL>upper = (cp.infinity if value is None or value == _INF<EOL>else float(value) for value in upper)<EOL>vartype = tuple(VariableType.Continuous if value is None else value<EOL>for value in vartype)<EOL>args = {'<STR_LIT>': tuple(lower), '<STR_LIT>': tuple(upper)}<EOL>if any(value != VariableType.Continuous for value in vartype):<EOL><INDENT>args['<STR_LIT>'] = tuple(Problem.VARTYPE_MAP[t] for t in vartype)<EOL><DEDENT>self._variables.update(zip(names, lp_names))<EOL>self._cp.variables.add(**args)<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.