Bugfix(Modules) - Maybe this time around it's good ?

This commit is contained in:
Dandaedre 2023-02-20 06:10:56 +01:00
parent 5322b28c1a
commit 34c7cf86ed
10 changed files with 56 additions and 155 deletions

2
Cargo.lock generated
View File

@ -552,7 +552,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "xiv_craft_solver"
name = "xiv_craft_solver_lib"
version = "0.1.2"
dependencies = [
"clap",

View File

@ -1,5 +1,5 @@
[package]
name = "xiv_craft_solver"
name = "xiv_craft_solver_lib"
version = "0.1.2"
edition = "2021"
authors = ["谭俊健","Dandaedre"]
@ -22,14 +22,14 @@ panic = 'abort'
opt-level = 3
lto = true
# [lib]
# name = "xiv_craft_solver"
# path = "src/lib/libs.rs"
# crate-type = ["cdylib"]
[lib]
name = "xiv_craft_solver_lib"
path = "src/lib.rs"
crate-type = ["cdylib"]
# [[bin]]
# name = "xiv_craft_solver"
# path = "src/main.rs"
[[bin]]
name = "xiv_craft_solver"
path = "src/bin/bin.rs"
[tool.maturin]
python-source = "python"

View File

@ -1,115 +0,0 @@
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...

View File

@ -2,8 +2,8 @@
use std::fmt::Debug;
use lazy_static::lazy_static;
use crate::utils::craft::Craft;
use crate::utils::specs::{Buff, Success};
use crate::craft::Craft;
use crate::specs::{Buff, Success};
pub struct Action {
pub name: String,

25
src/bin/bin.rs Normal file
View File

@ -0,0 +1,25 @@
// // #![warn(missing_docs,unsafe_code,unstable_features,)]
// #[allow(dead_code)]
// use clap::Parser;
// use xiv_craft_solver_lib;
// #[derive(Debug)]
// struct CustomError(String);
// fn main() {
// let args = xiv_craft_solver_lib::Args::parse();
// let params = xiv_craft_solver_lib::Parameters{
// depth: args.depth,
// threads: args.threads,
// verbose: args.verbose,
// };
// let (recipe,stats) = xiv_craft_solver_lib::load_from_config(&args.recipe_name, &args.file_name, &args.character_name);
// xiv_craft_solver_lib::solve_craft(recipe,stats,params);
// ()
// }
fn main() {
unimplemented!();
}

View File

@ -1,7 +1,7 @@
use std::fmt::{Debug, Formatter,Display};
use crate::utils::action::Action;
use crate::utils::specs::{Buff, BuffState, Recipe, Stats, Success};
use crate::utils::Parameters;
use crate::action::Action;
use crate::specs::{Buff, BuffState, Recipe, Stats, Success};
use crate::Parameters;
#[derive(Clone)]

View File

@ -1,4 +1,4 @@
use crate::utils::{
use crate::{
craft::Craft,
specs::{Recipe,Stats},
};
@ -6,6 +6,7 @@ use std::time::{Instant};
use threadpool::ThreadPool;
use std::sync::{Arc,Mutex};
use clap::Parser;
use pyo3::prelude::*;
mod solver;
mod specs;
@ -48,6 +49,18 @@ pub struct Args {
pub threads: usize,
}
#[pyfunction]
pub fn pouet()-> &'static str {
return "pouet";
}
/// A Python module implemented in Rust.
#[pymodule]
fn xiv_craft_solver_lib(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(pouet, m)?)?;
Ok(())
}
/// Solve the craft with given arguments
pub fn solve_craft<'a>(recipe: Recipe, stats: Stats, params: Parameters) -> Option<Vec<Craft<'a>>>{
// Load the craft with given arguments

View File

@ -1,22 +0,0 @@
// #![warn(missing_docs,unsafe_code,unstable_features,)]
#[allow(dead_code)]
use clap::Parser;
mod utils;
#[derive(Debug)]
struct CustomError(String);
fn main() {
let args = utils::Args::parse();
let params = utils::Parameters{
depth: args.depth,
threads: args.threads,
verbose: args.verbose,
};
let (recipe,stats) = utils::load_from_config(&args.recipe_name, &args.file_name, &args.character_name);
utils::solve_craft(recipe,stats,params);
()
}

View File

@ -1,8 +1,8 @@
use std::collections::VecDeque;
use std::ops::Not;
use crate::utils::action::{Action, ACTIONS};
use crate::utils::craft::Craft;
use crate::utils::specs::Success;
use crate::action::{Action, ACTIONS};
use crate::craft::Craft;
use crate::specs::Success;
macro_rules! action_vec {
($($tt:expr),*) => { vec![ $(Some(&$tt),)*]};