Add rayon to genetic_algorithm_v1

This commit is contained in:
hal8174 2025-02-18 22:02:31 +01:00
parent 81edc8e67a
commit 3b8865c169
4 changed files with 72 additions and 57 deletions

View file

@ -4,7 +4,7 @@ use factorio_blueprint::abstraction::{Blueprint, Entity};
use factorio_core::{beltoptions::Beltspeed, prelude::*, visualize::Visualize};
use factorio_layout::{Connection, Interface, LayoutInput, Layouter, MacroBlock};
use factorio_pathfinding::Pathfinder;
use rand::{Rng, seq::IndexedRandom};
use rand::{Rng, SeedableRng, seq::IndexedRandom};
use serde::{Deserialize, Serialize};
use crate::assembly::assembly_line_2_input;
@ -38,11 +38,11 @@ pub struct FactoryConnection {
pub to: usize,
}
pub fn generate_factory<L: Layouter, P: Pathfinder>(
pub fn generate_factory<L: Layouter, P: Pathfinder + Sync, R: Rng + SeedableRng + Send + Sync>(
layouter: &L,
pathfinder: &P,
factory_graph: FactoryGraph,
rng: &mut impl Rng,
rng: &mut R,
) -> Blueprint {
let mut blocks = Vec::new();
let mut blueprints = Vec::new();