def main(): config = _load_config() session = get_session(config.url_path) graphs = [] if config.seed is None: seed = int(np.random.default_rng(None).integers(np.array([2**63]))[0]) config.seed = seed else: seed = int(config.seed) gen = np.random.default_rng(seed) counter = 0 assert len(config.vertex_shape) % 2 == 0 shapes = np.array(config.vertex_shape).reshape(round(len(config.vertex_shape)/2), 2) l_shapes = len(shapes) for n in range(config.min_n, config.max_n): size = config.cel_min while size <= config.cel_max: for i in range(config.repetitions): graphs.append(create_random_celest_graph(n,vertex_shape=shapes[counter % l_shapes], celest_bounds=(size,size+config.cel_range), seed=gen)) counter += 1 size += config.cel_step task = Task(name=config.name, task_type="CelestialGraphInstances", status=Task.STATUS_OPTIONS.FINISHED) # Convert the namespace config into database config task_config_holder = ConfigHolder.fromNamespace(config, task=task, ignored_attributes=["url_path", "name", "config"]) task.jobs = [TaskJobs(graph=graph, task=task) for graph in graphs] session.add(task) session.commit() print(counter, "instances were created. Corresponding task is", task.id)
def main(): config = _load_config() session = get_session(config.url_path) if config.seed is None: seed = int(np.random.default_rng(None).integers(np.array([2**63]))[0]) config.seed = seed else: seed = int(config.seed) gen = np.random.default_rng(seed) if config.fixed_edges: graphs = _fixed_generation(config, gen) else: graphs = _probability_generation(config, gen) task = Task(name=config.name, task_type="GeometricGraphInstances", status=Task.STATUS_OPTIONS.FINISHED) # Convert the namespace config into database config task_config_holder = ConfigHolder.fromNamespace( config, task=task, ignored_attributes=["url_path", "name", "config"]) task.jobs = [TaskJobs(graph=graph, task=task) for graph in graphs] session.add(task) session.commit() print(len(task.jobs), "instances were created. Corresponding task is", task.id)