diff --git a/results.txt b/results.txt new file mode 100644 index 0000000..3379561 --- /dev/null +++ b/results.txt @@ -0,0 +1,115 @@ + 20 + 11074/12628 + ["muscleMemory", "manipulation", "veneration", "wasteNot2", "groundwork", "groundwork", "basicSynth", "innovation", "preparatoryTouch", "basicTouch", "standardTouch", "advancedTouch", "innovation", "prudentTouch", "prudentTouch", "basicTouch", "standardTouch", "innovation", "prudentTouch", "trainedFinesse", "greatStrides", "byregotsBlessing", "basicSynth2"] + + 8 + Quality: 11074/12628 + ["muscleMemory", "manipulation", "veneration", "wasteNot2", "groundwork", "groundwork", "basicSynth", "innovation", "preparatoryTouch", "basicTouch", "standardTouch", "advancedTouch", "innovation", "prudentTouch", "prudentTouch", "basicTouch", "standardTouch", "innovation", "prudentTouch", "trainedFinesse", "greatStrides", "byregotsBlessing", "basicSynth2"] + + 7 + 11074/12628 + ["muscleMemory", "manipulation", "veneration", "wasteNot2", "groundwork", "groundwork", "basicSynth", "innovation", "preparatoryTouch", "basicTouch", "standardTouch", "advancedTouch", "innovation", "prudentTouch", "prudentTouch", "basicTouch", "standardTouch", "innovation", "prudentTouch", "trainedFinesse", "greatStrides", "byregotsBlessing", "basicSynth2"] + + + Bir6 + [P2] Found 305 solutions, sorting + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Delicate Synthesis, Delicate Synthesis, Delicate Synthesis, Careful Synthesis, Innovation, Prudent Touch, Prudent Touch, Manipulation, Prudent Touch, Innovation, Basic Touch, Standard Touch, Advanced Touch, Great Strides, Innovation, Byregot's Blessing] p:90% q:68% d:15 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Delicate Synthesis, Delicate Synthesis, Careful Synthesis, Delicate Synthesis, Innovation, Prudent Touch, Prudent Touch, Manipulation, Prudent Touch, Innovation, Basic Touch, Standard Touch, Advanced Touch, Great Strides, Innovation, Byregot's Blessing] p:92% q:68% d:15 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Delicate Synthesis, Careful Synthesis, Delicate Synthesis, Delicate Synthesis, Innovation, Prudent Touch, Prudent Touch, Manipulation, Prudent Touch, Innovation, Basic Touch, Standard Touch, Advanced Touch, Great Strides, Innovation, Byregot's Blessing] p:92% q:68% d:15 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Careful Synthesis, Delicate Synthesis, Delicate Synthesis, Delicate Synthesis, Innovation, Prudent Touch, Prudent Touch, Manipulation, Prudent Touch, Innovation, Basic Touch, Standard Touch, Advanced Touch, Great Strides, Innovation, Byregot's Blessing] p:92% q:68% d:15 + [F] Top route { step_count: 22, progression: "4800/5060", quality: "11074/12628", durability: "-5/70", actions: [Muscle Memory, Manipulation, Veneration, Waste Not II, Groundwork, Groundwork, Basic Synthesis, Innovation, Preparatory Touch, Basic Touch, Standard Touch, Advanced Touch, Innovation, Prudent Touch, Prudent Touch, Basic Touch, Standard Touch, Innovation, Prudent Touch, Trained Finesse, Great Strides, Byregot's Blessing] } + Quality: 11074/12628 + ["muscleMemory", "manipulation", "veneration", "wasteNot2", "groundwork", "groundwork", "basicSynth", "innovation", "preparatoryTouch", "basicTouch", "standardTouch", "advancedTouch", "innovation", "prudentTouch", "prudentTouch", "basicTouch", "standardTouch", "innovation", "prudentTouch", "trainedFinesse", "greatStrides", "byregotsBlessing", "basicSynth2"] + + Program finished sucessfuly in 56s and found 305 solutions, [prog:5060] + Press enter to exit... + + Bir8 + [P2] Found 305 solutions, sorting + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Delicate Synthesis, Delicate Synthesis, Delicate Synthesis, Careful Synthesis, Innovation, Prudent Touch, Prudent Touch, Manipulation, Prudent Touch, Innovation, Basic Touch, Standard Touch, Advanced Touch, Great Strides, Innovation, Byregot's Blessing] p:90% q:68% d:15 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Delicate Synthesis, Delicate Synthesis, Careful Synthesis, Delicate Synthesis, Innovation, Prudent Touch, Prudent Touch, Manipulation, Prudent Touch, Innovation, Basic Touch, Standard Touch, Advanced Touch, Great Strides, Innovation, Byregot's Blessing] p:92% q:68% d:15 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Delicate Synthesis, Careful Synthesis, Delicate Synthesis, Delicate Synthesis, Innovation, Prudent Touch, Prudent Touch, Manipulation, Prudent Touch, Innovation, Basic Touch, Standard Touch, Advanced Touch, Great Strides, Innovation, Byregot's Blessing] p:92% q:68% d:15 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Careful Synthesis, Delicate Synthesis, Delicate Synthesis, Delicate Synthesis, Innovation, Prudent Touch, Prudent Touch, Manipulation, Prudent Touch, Innovation, Basic Touch, Standard Touch, Advanced Touch, Great Strides, Innovation, Byregot's Blessing] p:92% q:68% d:15 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Delicate Synthesis, Groundwork, Groundwork] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Careful Synthesis, Groundwork, Groundwork] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Basic Synthesis, Groundwork, Groundwork] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Groundwork, Delicate Synthesis, Groundwork] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Groundwork, Careful Synthesis, Groundwork] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Groundwork, Basic Synthesis, Groundwork] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Groundwork, Groundwork, Basic Synthesis] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Groundwork, Groundwork, Careful Synthesis] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Groundwork, Groundwork, Delicate Synthesis] p:90% q:2% d:45 + [F] Top route { step_count: 22, progression: "4800/5060", quality: "11074/12628", durability: "-5/70", actions: [Muscle Memory, Manipulation, Veneration, Waste Not II, Groundwork, Groundwork, Basic Synthesis, Innovation, Preparatory Touch, Basic Touch, Standard Touch, Advanced Touch, Innovation, Prudent Touch, Prudent Touch, Basic Touch, Standard Touch, Innovation, Prudent Touch, Trained Finesse, Great Strides, Byregot's Blessing] } + Quality: 11074/12628 + ["muscleMemory", "manipulation", "veneration", "wasteNot2", "groundwork", "groundwork", "basicSynth", "innovation", "preparatoryTouch", "basicTouch", "standardTouch", "advancedTouch", "innovation", "prudentTouch", "prudentTouch", "basicTouch", "standardTouch", "innovation", "prudentTouch", "trainedFinesse", "greatStrides", "byregotsBlessing", "basicSynth2"] + + Program finished sucessfuly in 26s and found 305 solutions, [prog:5060] + Press enter to exit... + + Bir10 + [P2] Found 305 solutions, sorting + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Delicate Synthesis, Delicate Synthesis, Delicate Synthesis, Careful Synthesis] p:90% q:6% d:20 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Delicate Synthesis, Delicate Synthesis, Delicate Synthesis, Prudent Synthesis] p:90% q:6% d:25 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Delicate Synthesis, Delicate Synthesis, Prudent Synthesis, Delicate Synthesis] p:92% q:6% d:25 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Delicate Synthesis, Delicate Synthesis, Careful Synthesis, Delicate Synthesis] p:92% q:6% d:20 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Delicate Synthesis, Prudent Synthesis, Delicate Synthesis, Delicate Synthesis] p:92% q:6% d:25 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Delicate Synthesis, Careful Synthesis, Delicate Synthesis, Delicate Synthesis] p:92% q:6% d:20 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Prudent Synthesis, Delicate Synthesis, Delicate Synthesis, Delicate Synthesis] p:92% q:6% d:25 + [P2] [Muscle Memory, Manipulation, Veneration, Groundwork, Careful Synthesis, Delicate Synthesis, Delicate Synthesis, Delicate Synthesis] p:92% q:6% d:20 + [P2] [Muscle Memory, Manipulation, Waste Not II, Groundwork, Basic Synthesis, Basic Synthesis, Groundwork, Groundwork] p:97% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not II, Groundwork, Basic Synthesis, Groundwork, Basic Synthesis, Groundwork] p:97% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not II, Groundwork, Groundwork, Basic Synthesis, Basic Synthesis, Groundwork] p:97% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not, Groundwork, Delicate Synthesis, Groundwork, Groundwork] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not, Groundwork, Careful Synthesis, Groundwork, Groundwork] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not, Groundwork, Basic Synthesis, Groundwork, Groundwork] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not, Groundwork, Groundwork, Delicate Synthesis, Groundwork] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not, Groundwork, Groundwork, Careful Synthesis, Groundwork] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not, Groundwork, Groundwork, Basic Synthesis, Groundwork] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not, Groundwork, Groundwork, Groundwork, Basic Synthesis] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not, Groundwork, Groundwork, Groundwork, Careful Synthesis] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not, Groundwork, Groundwork, Groundwork, Delicate Synthesis] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Delicate Synthesis, Groundwork, Groundwork] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Careful Synthesis, Groundwork, Groundwork] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Basic Synthesis, Groundwork, Groundwork] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Groundwork, Delicate Synthesis, Groundwork] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Groundwork, Careful Synthesis, Groundwork] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Groundwork, Basic Synthesis, Groundwork] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Groundwork, Groundwork, Basic Synthesis] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Groundwork, Groundwork, Careful Synthesis] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not II, Waste Not II, Groundwork, Groundwork, Groundwork, Delicate Synthesis] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Groundwork, Careful Synthesis, Careful Synthesis, Groundwork, Basic Synthesis] p:91% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not, Groundwork, Careful Synthesis, Careful Synthesis, Groundwork, Careful Synthesis] p:94% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not, Groundwork, Careful Synthesis, Basic Synthesis, Groundwork, Careful Synthesis] p:91% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not, Groundwork, Careful Synthesis, Groundwork, Careful Synthesis, Basic Synthesis] p:91% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not, Groundwork, Careful Synthesis, Groundwork, Careful Synthesis, Careful Synthesis] p:94% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not, Groundwork, Careful Synthesis, Groundwork, Basic Synthesis, Careful Synthesis] p:91% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not, Groundwork, Basic Synthesis, Careful Synthesis, Groundwork, Careful Synthesis] p:91% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not, Groundwork, Basic Synthesis, Groundwork, Careful Synthesis, Careful Synthesis] p:91% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not, Groundwork, Groundwork, Careful Synthesis, Careful Synthesis, Basic Synthesis] p:91% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not, Groundwork, Groundwork, Careful Synthesis, Careful Synthesis, Careful Synthesis] p:94% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not, Groundwork, Groundwork, Careful Synthesis, Basic Synthesis, Careful Synthesis] p:91% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not, Groundwork, Groundwork, Basic Synthesis, Careful Synthesis, Careful Synthesis] p:91% q:0% d:40 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not, Groundwork, Delicate Synthesis, Groundwork, Groundwork] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not, Groundwork, Careful Synthesis, Groundwork, Groundwork] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not, Groundwork, Basic Synthesis, Groundwork, Groundwork] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not, Groundwork, Groundwork, Delicate Synthesis, Groundwork] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not, Groundwork, Groundwork, Careful Synthesis, Groundwork] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not, Groundwork, Groundwork, Basic Synthesis, Groundwork] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not, Groundwork, Groundwork, Groundwork, Basic Synthesis] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not, Groundwork, Groundwork, Groundwork, Careful Synthesis] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not, Groundwork, Groundwork, Groundwork, Delicate Synthesis] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not II, Groundwork, Delicate Synthesis, Groundwork, Groundwork] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not II, Groundwork, Careful Synthesis, Groundwork, Groundwork] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not II, Groundwork, Basic Synthesis, Groundwork, Groundwork] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not II, Groundwork, Groundwork, Delicate Synthesis, Groundwork] p:90% q:2% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not II, Groundwork, Groundwork, Careful Synthesis, Groundwork] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not II, Groundwork, Groundwork, Basic Synthesis, Groundwork] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not II, Groundwork, Groundwork, Groundwork, Basic Synthesis] p:91% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not II, Groundwork, Groundwork, Groundwork, Careful Synthesis] p:94% q:0% d:45 + [P2] [Muscle Memory, Manipulation, Waste Not, Waste Not II, Groundwork, Groundwork, Groundwork, Delicate Synthesis] p:90% q:2% d:45 + [F] Top route { step_count: 22, progression: "4800/5060", quality: "11074/12628", durability: "-5/70", actions: [Muscle Memory, Manipulation, Veneration, Waste Not II, Groundwork, Groundwork, Basic Synthesis, Innovation, Preparatory Touch, Basic Touch, Standard Touch, Advanced Touch, Innovation, Prudent Touch, Prudent Touch, Basic Touch, Standard Touch, Innovation, Prudent Touch, Trained Finesse, Great Strides, Byregot's Blessing] } + Quality: 11074/12628 + ["muscleMemory", "manipulation", "veneration", "wasteNot2", "groundwork", "groundwork", "basicSynth", "innovation", "preparatoryTouch", "basicTouch", "standardTouch", "advancedTouch", "innovation", "prudentTouch", "prudentTouch", "basicTouch", "standardTouch", "innovation", "prudentTouch", "trainedFinesse", "greatStrides", "byregotsBlessing", "basicSynth2"] + + Program finished sucessfuly in 13s and found 305 solutions, [prog:5060] + Press enter to exit... diff --git a/src/main.rs b/src/main.rs index 8c73248..c48e37c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,9 @@ use crate::solver::{generate_routes_phase1, generate_routes_phase2}; use crate::specs::{Recipe, Stats}; use clap::Parser; +use std::thread; +use std::time::{Duration,Instant}; + mod specs; pub mod action; pub mod craft; @@ -39,6 +42,10 @@ fn main() { // Get args let args = Args::parse(); + // Start timer + let now = Instant::now(); + + //read craft.toml let config: toml::Value = toml::from_str( &std::fs::read_to_string(&args.file_name) @@ -101,7 +108,7 @@ fn main() { &args.character_name,&args.file_name)) .as_integer().expect("Can't convert max_cp as an integer") as u32, }; - let craft = Craft::new(&recipe, &stats, &args.depth); + let craft = Craft::new(recipe, stats, args.depth); if args.verbose>0{ println!("Solving...\n"); @@ -123,13 +130,30 @@ fn main() { }; } - let mut phase2_routes = Vec::new(); - for route in phase1_routes { - if let Some(route) = generate_routes_phase2(route) { - phase2_routes.push(route); - } - } + // Core algorith, fill all found routes with the best route (doesn't branch, just replace) + let mut phase2_routes: Vec = Vec::new(); + // for route in phase1_routes { + // if let Some(route) = generate_routes_phase2(route) { + // phase2_routes.push(route); + // } + // } + let handle = thread::spawn(|| { + // for i in 1..10 { + // println!("hi number {} from the spawned thread!", i); + // thread::sleep(Duration::from_millis(1)); + // } + for route in phase1_routes { + /*if let Some(route) = */generate_routes_phase2(route); //{ + // phase2_routes.push(route); + //} + } + } + ); + + handle.join().unwrap(); + + // Print the results if verbose if args.verbose>1{ println!("[P2] Found {} solutions, sorting",phase2_routes.len()); for r in &phase2_routes{ @@ -141,10 +165,14 @@ fn main() { }; } + let top_route = match phase2_routes.iter().max_by_key(|route| route.quality) { Some(top) => top, None => return, }; + + + // let top_route = match phase2_routes.iter().min_by_key(|route| route.step_count) { // Some(top) => top, // None => return, @@ -173,6 +201,10 @@ fn main() { // Wait for enter println!(); + println!("Program finished sucessfuly in {}s and found {} solutions, [prog:{}]", + now.elapsed().as_secs(), + phase2_routes.len(), + top_route.recipe.progress); println!("Press enter to exit..."); let mut input = String::new(); std::io::stdin().read_line(&mut input).unwrap(); diff --git a/src/solver.rs b/src/solver.rs index 8f1db5e..3019137 100644 --- a/src/solver.rs +++ b/src/solver.rs @@ -126,6 +126,7 @@ pub fn next_action_phase_2<'a>(craft: &Craft) -> Vec> { available_actions.push(&ACTIONS.advanced_touch); forbidden_actions.push(&ACTIONS.basic_touch); } + // Todo, allow earlier byregot if the craft can be finished all the same (useless with always optimize on) if craft.buffs.inner_quiet >= 10 { available_actions.push(&ACTIONS.trained_finesse); available_actions.push(&ACTIONS.great_strides); @@ -167,7 +168,8 @@ pub fn generate_routes_phase2(craft: Craft) -> Option { if action.unwrap() == &ACTIONS.byregot_blessing { if let Some(top_route) = &mut top_route { if top_route.quality < craft.quality { - *top_route = craft; + // TODO: Should we erase the craft if the improvement is cosmetic (aka, already finished) + *top_route = craft; } } else { top_route = Some(craft);