Skip to content
Snippets Groups Projects
Commit 9e2abf97 authored by a.croix's avatar a.croix
Browse files

Refactoring

parent e0b848d6
No related branches found
No related tags found
No related merge requests found
package be.cylab.java.wowa.training;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
......@@ -20,9 +19,8 @@ public final class Example {
* Run algorithm with webshell dataset.
*
* @param args
* @throws IOException if input files cannot be read
*/
public static void main(final String[] args) throws IOException {
public static void main(final String[] args) {
int population_size = Integer.parseInt(args[0]);
int crossover_rate = Integer.parseInt(args[1]);
int mutation_rate = Integer.parseInt(args[2]);
......
......@@ -33,7 +33,7 @@ final class Utils {
* @param weights
* @return
*/
public static List<Double> normalizeWeights(final List<Double> weights) {
static List<Double> normalizeWeights(final List<Double> weights) {
Double sum_weight = Utils.sumListElements(weights);
List<Double> weights_normalized = new ArrayList<>();
for (int i = 0; i < weights.size(); i++) {
......@@ -48,7 +48,7 @@ final class Utils {
* @param solutions
* @return
*/
public static double findMaxDistance(
static double findMaxDistance(
final List<AbstractSolution> solutions) {
double max = Double.NEGATIVE_INFINITY;
for (AbstractSolution solution : solutions) {
......@@ -65,7 +65,7 @@ final class Utils {
* @param solutions
* @return
*/
public static double findMinDistance(
static double findMinDistance(
final List<AbstractSolution> solutions) {
double min = Double.POSITIVE_INFINITY;
for (AbstractSolution solution : solutions) {
......@@ -82,7 +82,7 @@ final class Utils {
* @param solutions
* @return
*/
public static double sumTotalDistance(
static double sumTotalDistance(
final List<AbstractSolution> solutions) {
double sum = 0;
for (AbstractSolution solution : solutions) {
......@@ -97,7 +97,7 @@ final class Utils {
* @param array
* @return
*/
public static Double sumListElements(final List<Double> array) {
static Double sumListElements(final List<Double> array) {
Double sum = 0.0;
for (Double weight : array) {
sum += weight;
......@@ -112,7 +112,7 @@ final class Utils {
* @param max
* @return
*/
public static int randomInteger(final int min, final int max) {
static int randomInteger(final int min, final int max) {
if (min >= max) {
throw new IllegalArgumentException("Max must be greater then min");
}
......@@ -126,7 +126,7 @@ final class Utils {
* @param filename
* @return
*/
public static List<List<Double>> convertJsonToDataForTrainer(
static List<List<Double>> convertJsonToDataForTrainer(
final String filename) {
Genson genson = new Genson();
String data_json = Utils.readFileToString(filename);
......@@ -143,7 +143,7 @@ final class Utils {
* @param filename
* @return
*/
public static List<Double> convertJsonToExpectedForTrainer(
static List<Double> convertJsonToExpectedForTrainer(
final String filename) {
Genson genson = new Genson();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment