Fix factory.yml for fast-inserter
This commit is contained in:
parent
c472a28591
commit
abf2cac093
4 changed files with 85 additions and 11 deletions
|
|
@ -11,7 +11,7 @@ subfactories:
|
||||||
recipe: electronic-circuit
|
recipe: electronic-circuit
|
||||||
machines: 6
|
machines: 6
|
||||||
machine: assembly-machine-3
|
machine: assembly-machine-3
|
||||||
- !BeltPool
|
- !Splitter
|
||||||
- !SubFactory
|
- !SubFactory
|
||||||
recipe: inserter
|
recipe: inserter
|
||||||
machines: 2
|
machines: 2
|
||||||
|
|
@ -20,11 +20,16 @@ subfactories:
|
||||||
recipe: fast-inserter
|
recipe: fast-inserter
|
||||||
machines: 2
|
machines: 2
|
||||||
machine: assembly-machine-3
|
machine: assembly-machine-3
|
||||||
|
- !SideLoader
|
||||||
|
- !ExternalConnection
|
||||||
|
inputs: 1
|
||||||
|
outputs: 8
|
||||||
|
- !SideLoader
|
||||||
factory_connections:
|
factory_connections:
|
||||||
- item: iron-gear-wheel
|
- item: iron-gear-wheel
|
||||||
amount: 5
|
amount: 5
|
||||||
from: 0
|
from: 0
|
||||||
to: 4
|
to: 6
|
||||||
- item: copper-cable
|
- item: copper-cable
|
||||||
amount: 45
|
amount: 45
|
||||||
from: 1
|
from: 1
|
||||||
|
|
@ -41,3 +46,39 @@ factory_connections:
|
||||||
amount: 10
|
amount: 10
|
||||||
from: 3
|
from: 3
|
||||||
to: 5
|
to: 5
|
||||||
|
- item: iron-plate;iron-gear-wheel
|
||||||
|
amount: 10
|
||||||
|
from: 6
|
||||||
|
to: 4
|
||||||
|
- item: iron-plate
|
||||||
|
amount: 5
|
||||||
|
from: 7
|
||||||
|
to: 6
|
||||||
|
- item: iron-plate
|
||||||
|
amount: 15
|
||||||
|
from: 7
|
||||||
|
to: 2
|
||||||
|
- item: inserter
|
||||||
|
amount: 5
|
||||||
|
from: 4
|
||||||
|
to: 8
|
||||||
|
- item: iron-plate
|
||||||
|
amount: 10
|
||||||
|
from: 7
|
||||||
|
to: 8
|
||||||
|
- item: iron-plate;inserter
|
||||||
|
amount: 20
|
||||||
|
from: 8
|
||||||
|
to: 5
|
||||||
|
- item: fast-inserter
|
||||||
|
amount: 5
|
||||||
|
from: 5
|
||||||
|
to: 7
|
||||||
|
- item: copper-plate
|
||||||
|
amount: 22.5
|
||||||
|
from: 7
|
||||||
|
to: 1
|
||||||
|
- item: iron-plate
|
||||||
|
amount: 10
|
||||||
|
from: 7
|
||||||
|
to: 0
|
||||||
|
|
|
||||||
|
|
@ -29,16 +29,16 @@ fn main() {
|
||||||
let l = ValidLayout {
|
let l = ValidLayout {
|
||||||
max_tries: 10,
|
max_tries: 10,
|
||||||
retries: 20,
|
retries: 20,
|
||||||
start_size: Position::new(48, 48),
|
start_size: Position::new(64, 64),
|
||||||
growth: Position::new(0, 0),
|
growth: Position::new(4, 4),
|
||||||
};
|
};
|
||||||
|
|
||||||
let l = GeneticAlgorithm {
|
let l = GeneticAlgorithm {
|
||||||
mutation_retries: 20,
|
mutation_retries: 20,
|
||||||
population_size: 20,
|
population_size: 40,
|
||||||
population_keep: 1,
|
population_keep: 5,
|
||||||
population_new: 2,
|
population_new: 5,
|
||||||
generations: 50,
|
generations: 40,
|
||||||
valid_layout: l,
|
valid_layout: l,
|
||||||
};
|
};
|
||||||
let p = ConflictAvoidance {
|
let p = ConflictAvoidance {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ pub enum Building {
|
||||||
inputs: usize,
|
inputs: usize,
|
||||||
outputs: usize,
|
outputs: usize,
|
||||||
},
|
},
|
||||||
BeltPool,
|
Splitter,
|
||||||
SideLoader,
|
SideLoader,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -140,7 +140,40 @@ pub fn generate_factory<L: Layouter, P: Pathfinder>(
|
||||||
blueprints.push(blueprint);
|
blueprints.push(blueprint);
|
||||||
used_connections.push((0, 0));
|
used_connections.push((0, 0));
|
||||||
}
|
}
|
||||||
Building::BeltPool => todo!(),
|
Building::Splitter => {
|
||||||
|
let mut blueprint = Blueprint::new();
|
||||||
|
blueprint.add_entity(Entity::new_splitter(
|
||||||
|
Beltspeed::Fast,
|
||||||
|
Position::new(2, 1),
|
||||||
|
Direction::Up,
|
||||||
|
));
|
||||||
|
|
||||||
|
blocks.push(MacroBlock {
|
||||||
|
size: Position::new(2, 1),
|
||||||
|
input: vec![
|
||||||
|
Interface {
|
||||||
|
offset: Position::new(0, 0),
|
||||||
|
dir: Direction::Up,
|
||||||
|
},
|
||||||
|
Interface {
|
||||||
|
offset: Position::new(1, 0),
|
||||||
|
dir: Direction::Up,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
output: vec![
|
||||||
|
Interface {
|
||||||
|
offset: Position::new(0, 0),
|
||||||
|
dir: Direction::Up,
|
||||||
|
},
|
||||||
|
Interface {
|
||||||
|
offset: Position::new(1, 0),
|
||||||
|
dir: Direction::Up,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
blueprints.push(blueprint);
|
||||||
|
used_connections.push((0, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ impl Layouter for GeneticAlgorithm {
|
||||||
if population[0].1 < best_result.1 {
|
if population[0].1 < best_result.1 {
|
||||||
best_result = population[0].clone();
|
best_result = population[0].clone();
|
||||||
}
|
}
|
||||||
println!("completed generation {g}\nscore: {}", population[0].1);
|
eprintln!("completed generation {g}\nscore: {}", population[0].1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(best_result.0)
|
Some(best_result.0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue