Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust code is calling the unwrap() method on an Option that is None #3

Open
slot721 opened this issue Nov 15, 2024 · 2 comments
Open

Comments

@slot721
Copy link

slot721 commented Nov 15, 2024

The error occurs in src/models/plan_analysis.rs at line 48, in the file where the unwrap() method is being called.

Im on ubuntu with this start cmd:

cargo run --release -- --name sLoTTeR --mission "Explore emergent behaviors in decentralized systems"

here are the final lines of the log before the panic:

║ Cell Details:
║   ID: 85430523-2cfb-4ca5-bee4-a2558cc2ca4f
║   Energy Level: 100.00
║   Position: (3.81, -0.06, 4.14)
║   Thoughts: 0
║   Neighbors: 2
║   Dimensional Position:
║     Emergence: 50.00
║     Coherence: 50.00
║     Resilience: 50.00
║     Intelligence: 50.00
║     Efficiency: 50.00
║     Integration: 50.00
║
║   Plan Details:
║     Nodes: 1
║     Score: 0.20
║     Participating Cells: 0
║ Creating plan for cell 9e9d25fd-44c2-45ad-9951-7f1a3b2cd7b7 (timeout: 300s)...
║ Successfully created plan for cell 9e9d25fd-44c2-45ad-9951-7f1a3b2cd7b7
║ Cell Details:
║   ID: 9e9d25fd-44c2-45ad-9951-7f1a3b2cd7b7
║   Energy Level: 100.00
║   Position: (4.01, 3.81, 2.10)
║   Thoughts: 0
║   Neighbors: 2
║   Dimensional Position:
║     Emergence: 50.00
║     Coherence: 50.00
║     Resilience: 50.00
║     Intelligence: 50.00
║     Efficiency: 50.00
║     Integration: 50.00
║
║   Plan Details:
║     Nodes: 1
║     Score: 0.20
║     Participating Cells: 0
╠════════════════════════════════════════════════════════════╣
║ Batch Summary:
║   Total plans created: 14
║   Best plan score: 0.00
║   Processing time: 0.93s
╚════════════════════════════════════════════════════════════╝
thread 'main' panicked at src/models/plan_analysis.rs:48:58:
called `Option::unwrap()` on a `None` value
@slot721
Copy link
Author

slot721 commented Nov 15, 2024

i didnt have any credits :/ that resolved. but maybe good to add this into the logs, instructions :D

@dustinsievers
Copy link

dustinsievers commented Dec 8, 2024

@slot721 - I'm still figuring out the codebase but here is what I did to keep it running. Keep in mind that today is my first day playing with this and I am on Ubuntu and not MacOS, so take any of my suggested advice here cautiously. In src/models/plan_analysis.rs, at line 47 there is 'let best_plan' etc. I changed it from this:

let best_plan = plans.iter() .max_by(|a, b| a.score.partial_cmp(&b.score).unwrap());

Modified line: using unwrap_or to handle None case from partial_cmp
to this:
let best_plan = plans.iter() .max_by(|a, b| a.score.partial_cmp(&b.score).unwrap_or(std::cmp::Ordering::Equal));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants