Skip to content

Commit

Permalink
Another fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kkafar committed Apr 12, 2024
1 parent e0c68b0 commit a17d5af
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
7 changes: 1 addition & 6 deletions examples/jssp/problem/fitness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,7 @@ impl JsspFitness {
self.calculate_critical_distance(indv, 0, &mut visited)
}

fn calculate_critical_distance(
&mut self,
indv: &mut JsspIndividual,
op_id: usize,
visited: &mut [bool],
) {
fn calculate_critical_distance(&mut self, indv: &mut JsspIndividual, op_id: usize, visited: &mut [bool]) {
let mut stack: Vec<usize> = Vec::with_capacity(visited.len() * 2);

stack.push(op_id);
Expand Down
42 changes: 28 additions & 14 deletions src/test_functions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1253,14 +1253,18 @@ pub fn hartmann_3d(x: &[f64]) -> f64 {
"Hartmann 3-dimensional function takes only a three dimensional vector as a parameter."
);
let alfa = [1.0, 1.2, 3.0, 3.2];
let a = [vec![3.0, 10.0, 30.0],
let a = [
vec![3.0, 10.0, 30.0],
vec![0.1, 10.0, 35.0],
vec![3.0, 10.0, 30.0],
vec![0.1, 10.0, 35.0]];
let p = [vec![3.689, 1.17, 2.673],
vec![0.1, 10.0, 35.0],
];
let p = [
vec![3.689, 1.17, 2.673],
vec![4.699, 4.387, 7.47],
vec![1.091, 8.732, 5.547],
vec![0.381, 5.743, 8.828]];
vec![0.381, 5.743, 8.828],
];
let mut res = 0_f64;
for i in 1..5 {
let mut sum = 0_f64;
Expand All @@ -1282,14 +1286,18 @@ pub fn hartmann_4d(x: &[f64]) -> f64 {
"Hartmann 4-dimensional function takes only a three dimensional vector as a parameter."
);
let alfa = [1.0, 1.2, 3.0, 3.2];
let a = [vec![10.0, 3.0, 17.0, 3.5, 1.7, 8.0],
let a = [
vec![10.0, 3.0, 17.0, 3.5, 1.7, 8.0],
vec![0.05, 10.0, 17.0, 0.1, 8.0, 14.0],
vec![3.0, 3.5, 1.7, 10.0, 17.0, 8.0],
vec![17.0, 8.0, 0.05, 10.0, 0.1, 14.0]];
let p = [vec![1.312, 1.696, 5.569, 1.24, 8.283, 5.886],
vec![17.0, 8.0, 0.05, 10.0, 0.1, 14.0],
];
let p = [
vec![1.312, 1.696, 5.569, 1.24, 8.283, 5.886],
vec![2.329, 4.135, 8.307, 3.736, 1.004, 9.991],
vec![2.348, 1.451, 3.522, 2.883, 3.047, 6.650],
vec![4.047, 8.828, 8.732, 5.743, 1.091, 3.81]];
vec![4.047, 8.828, 8.732, 5.743, 1.091, 3.81],
];
let mut sum = 0_f64;
for i in 1..5 {
let mut inner_sum = 0_f64;
Expand All @@ -1313,14 +1321,18 @@ pub fn hartmann_6d(x: &[f64]) -> f64 {
"Hartmann 6-dimensional function takes only a six dimensional vector as a parameter."
);
let alfa = [1.0, 1.2, 3.0, 3.2];
let a = [vec![10.0, 3.0, 17.0, 3.5, 1.7, 8.0],
let a = [
vec![10.0, 3.0, 17.0, 3.5, 1.7, 8.0],
vec![0.05, 10.0, 17.0, 0.1, 8.0, 14.0],
vec![3.0, 3.5, 1.7, 10.0, 17.0, 8.0],
vec![17.0, 8.0, 0.05, 10.0, 0.1, 14.0]];
let p = [vec![1.312, 1.696, 5.569, 1.24, 8.283, 5.886],
vec![17.0, 8.0, 0.05, 10.0, 0.1, 14.0],
];
let p = [
vec![1.312, 1.696, 5.569, 1.24, 8.283, 5.886],
vec![2.329, 4.135, 8.307, 3.736, 1.004, 9.991],
vec![2.348, 1.451, 0.522, 2.883, 3.047, 6.650],
vec![4.047, 8.828, 8.732, 5.743, 1.091, 3.81]];
vec![4.047, 8.828, 8.732, 5.743, 1.091, 3.81],
];
let mut sum = 0_f64;
for i in 1..5 {
let mut inner_sum = 0_f64;
Expand Down Expand Up @@ -2365,10 +2377,12 @@ pub fn shekel_default(x: &[f64]) -> f64 {
let mut res = 0.0;
let raw = vec![1.0, 2.0, 2.0, 4.0, 4.0, 6.0, 3.0, 7.0, 5.0, 5.0];
let beta = raw.into_iter().map(|x| 0.1 * x).collect::<Vec<_>>();
let c = [vec![4.0, 1.0, 8.0, 6.0, 3.0, 2.0, 5.0, 8.0, 6.0, 7.0],
let c = [
vec![4.0, 1.0, 8.0, 6.0, 3.0, 2.0, 5.0, 8.0, 6.0, 7.0],
vec![4.0, 1.0, 8.0, 6.0, 7.0, 9.0, 3.0, 1.0, 2.0, 3.6],
vec![4.0, 1.0, 8.0, 6.0, 3.0, 2.0, 5.0, 8.0, 6.0, 7.0],
vec![4.0, 1.0, 8.0, 6.0, 7.0, 9.0, 3.0, 1.0, 2.0, 3.6]];
vec![4.0, 1.0, 8.0, 6.0, 7.0, 9.0, 3.0, 1.0, 2.0, 3.6],
];
for i in 1..11 {
let mut sum = 0_f64;
for j in 1..5 {
Expand Down

0 comments on commit a17d5af

Please sign in to comment.