feat: cleaning empty lines in config

This commit is contained in:
Ahmet Kaan GÜMÜŞ 2024-11-20 00:20:40 +03:00
parent 6be3a7f5c6
commit 2ee8c435d1
2 changed files with 8 additions and 6 deletions

View file

@ -1,8 +1,8 @@
[start_parameters]
decision_variable_count = 50
[input_parameters]
decision_variable_count = 30
food_source_number = 20
food_source_try_limit = 1000
food_source_try_limit = 60
upper_bound = 100
lower_bound = -100
iteration = 100
run = 30
iteration = 1000
run = 100

View file

@ -89,12 +89,13 @@ impl Input {
reader
.lines()
.map(|unchecked_line| unchecked_line.unwrap())
.map(|mut line|{
.map(|mut line| {
if let Some(comment_location) = line.find('#') {
let _ = line.split_off(comment_location);
}
line
})
.filter(|uncommented_line| !uncommented_line.is_empty())
.for_each(|line| {
lines.append(
&mut line
@ -103,6 +104,7 @@ impl Input {
.collect::<Vec<String>>(),
)
});
if lines[0].starts_with("[input_parameters]") {
for i in 1..lines.len() {
match lines[i].as_str() {