def create_iteration(self, num_suggestions=<NUM_LIT:0>):
from db.models.experiment_groups import ExperimentGroupIteration<EOL>search_manager = self.experiment_group.search_manager<EOL>iteration_config = self.experiment_group.iteration_config<EOL>if iteration_config is None:<EOL><INDENT>iteration = <NUM_LIT:0><EOL>bracket_iteration = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>should_reschedule = search_manager.should_reschedule(<EOL>iteration=iteration_config.iteration,<EOL>bracket_iteration=iteration_config.bracket_iteration)<EOL>should_reduce_configs = search_manager.should_reduce_configs(<EOL>iteration=iteration_config.iteration,<EOL>bracket_iteration=iteration_config.bracket_iteration)<EOL>if should_reschedule:<EOL><INDENT>iteration = iteration_config.iteration + <NUM_LIT:1><EOL>bracket_iteration = <NUM_LIT:0><EOL><DEDENT>elif should_reduce_configs:<EOL><INDENT>iteration = iteration_config.iteration<EOL>bracket_iteration = iteration_config.bracket_iteration + <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(self.experiment_group.id))<EOL><DEDENT><DEDENT>iteration_config = HyperbandIterationConfig(<EOL>iteration=iteration,<EOL>num_suggestions=num_suggestions,<EOL>bracket_iteration=bracket_iteration)<EOL>iteration_config.experiment_ids = []<EOL>return ExperimentGroupIteration.objects.create(<EOL>experiment_group=self.experiment_group,<EOL>data=iteration_config.to_dict())<EOL>
Create an iteration for the experiment group.