Add beltfinding timeout and debugging.
This commit is contained in:
parent
f20a1841c9
commit
79c8b0c710
13 changed files with 278 additions and 53 deletions
|
|
@ -48,7 +48,7 @@ fn main() {
|
|||
|
||||
match args.mode {
|
||||
Mode::Solutions => {
|
||||
while b.next_finish_state() {
|
||||
while b.next_finish_state(None) {
|
||||
println!("{}\n{}\n{}", b.count(), b.solution_count(), b.cost());
|
||||
b.print();
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ fn main() {
|
|||
println!("Solutions: {}\nStates: {}", b.solution_count(), b.count());
|
||||
}
|
||||
Mode::Statistics => {
|
||||
while b.next_finish_state() {}
|
||||
while b.next_finish_state(None) {}
|
||||
|
||||
println!("Solutions: {}\nStates: {}", b.solution_count(), b.count());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
use clap::Parser;
|
||||
use factorio_blueprint::{
|
||||
belt_finding::{conflict_avoidance::ConflictAvoidance, Problem},
|
||||
common::visualize::Visualize,
|
||||
layout::{GeneticAlgorithm, Layout, PathLayout},
|
||||
};
|
||||
use factorio_blueprint::layout::GeneticAlgorithm;
|
||||
use rand::{rngs::SmallRng, SeedableRng};
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
|
|
@ -15,7 +11,7 @@ struct Args {
|
|||
fn main() {
|
||||
let args = Args::parse();
|
||||
|
||||
let file = std::fs::File::open("layout2.yml").unwrap();
|
||||
let file = std::fs::File::open("layout3.yml").unwrap();
|
||||
|
||||
let p = serde_yaml::from_reader(file).unwrap();
|
||||
|
||||
|
|
@ -23,7 +19,7 @@ fn main() {
|
|||
|
||||
dbg!(&p);
|
||||
|
||||
let mut g = GeneticAlgorithm::new(&p, 20, 4, 2, &mut rng);
|
||||
let mut g = GeneticAlgorithm::new(&p, 40, 5, 5, &mut rng);
|
||||
|
||||
for i in 0..100 {
|
||||
println!("Generatrion {i}");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use clap::{Parser, ValueEnum};
|
||||
use factorio_blueprint::belt_finding::{conflict_avoidance::ConflictAvoidance, problems, Problem};
|
||||
use std::io;
|
||||
use std::{io, path::PathBuf};
|
||||
|
||||
#[derive(ValueEnum, Clone)]
|
||||
enum Mode {
|
||||
|
|
@ -59,9 +59,9 @@ fn main() {
|
|||
p.print();
|
||||
p.find_path();
|
||||
p.print();
|
||||
let mut c = ConflictAvoidance::new(p);
|
||||
let mut c = ConflictAvoidance::new(&p);
|
||||
c.print();
|
||||
while c.remove_conflict() {
|
||||
while c.remove_conflict(None) {
|
||||
c.print();
|
||||
}
|
||||
}
|
||||
|
|
@ -75,9 +75,9 @@ fn main() {
|
|||
p.print();
|
||||
p.find_path();
|
||||
p.print();
|
||||
let mut c = ConflictAvoidance::new(p);
|
||||
let mut c = ConflictAvoidance::new(&p);
|
||||
c.print();
|
||||
while c.remove_conflict() {
|
||||
while c.remove_conflict(None) {
|
||||
c.print();
|
||||
let mut s = String::new();
|
||||
let _ = io::stdin().read_line(&mut s);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue