// Path: src/ch/epfl/bigdata/ts/dataparser/Tick.java
// public class Tick implements Comparable<Tick> {
// 
//     long orderID;
//     long timestamp;
//     char type;
//     long numberShares;
//     double price;
// 
//     public long getOrderID() {
//         return orderID;
//     }
// 
//     public long getTimestamp() {
//         return timestamp;
//     }
// 
//     public char getType() {
//         return type;
//     }
// 
//     public long getNumberShares() {
//         return numberShares;
//     }
// 
//     public double getPrice() {
//         return price;
//     }
// 
//     public Tick(long orderID, long timestamp, char type, long numberShares, long price) {
//         this.orderID = orderID;
//         this.timestamp = timestamp;
//         this.type = type;
//         this.numberShares = numberShares;
//         this.price = price / 10000;
//     }
// 
//     public Tick(long orderID, long timestamp, long numberShares, long price) {
//         this.orderID = orderID;
//         this.timestamp = timestamp;
//         this.numberShares = numberShares;
//         this.price = price / 10000.0;
//     }
// 
// 
//     @Override
//     public int compareTo(Tick o) {
//         if (this.timestamp < o.timestamp)
//             return -1;
//         else if (this.timestamp==o.timestamp)
//              return  0;
// 
//         return 1;
//     }
// 
//     @Override
//     public String toString() {
//         return timestamp +
//                 "," + type +
//                 "," + numberShares +
//                 "," + price;
//     }
// }
// 
// Path: src/ch/epfl/bigdata/ts/dataparser/Utils.java
// public class Utils {
// 
//     public static final String FILE_SUFFIX = "_MSFT_tick.csv";
//     public static final String pathToInput = "data\\";//put the absolute path to the data folder
// 
//     public static final String  pathToEvaluation = "results\\evaluations\\";
//     public static final String  pathToTraining = "results\\trainings\\";
//     public static final String  pathToVisualisation = "results\\visualisations\\";
// 
//     public static final int STARTING_YEAR = 2014;
//     public static final int STARTING_MONTH = 0;
//     public static final int STARTING_DAY = 30;
//     public static final SimpleDateFormat SDF = new SimpleDateFormat("yyyyMMdd");
// 
//     public static String[] dataFileNames = {"20140130_MSFT_tick.csv",
//             "20140131_MSFT_tick.csv",
//             "20140203_MSFT_tick.csv",
//             "20140204_MSFT_tick.csv",
//             "20140205_MSFT_tick.csv",
//             "20140206_MSFT_tick.csv",
//             "20140207_MSFT_tick.csv",
//             "20140210_MSFT_tick.csv",
//             "20140211_MSFT_tick.csv",
//             "20140212_MSFT_tick.csv",
//             "20140213_MSFT_tick.csv",
//             "20140214_MSFT_tick.csv",
//             "20140218_MSFT_tick.csv",
//             "20140219_MSFT_tick.csv",
//             "20140220_MSFT_tick.csv",
//             "20140221_MSFT_tick.csv",
//             "20140224_MSFT_tick.csv",
//             "20140225_MSFT_tick.csv",
//             "20140226_MSFT_tick.csv",
//             "20140227_MSFT_tick.csv",
//             "20140228_MSFT_tick.csv",
//             "20140303_MSFT_tick.csv",
//             "20140304_MSFT_tick.csv",
//             "20140305_MSFT_tick.csv",
//             "20140306_MSFT_tick.csv",
//             "20140307_MSFT_tick.csv",
//             "20140310_MSFT_tick.csv",
//             "20140311_MSFT_tick.csv",
//             "20140312_MSFT_tick.csv",
//             "20140313_MSFT_tick.csv",
//             "20140314_MSFT_tick.csv",
//             "20140317_MSFT_tick.csv",
//             "20140318_MSFT_tick.csv",
//             "20140319_MSFT_tick.csv",
//             "20140320_MSFT_tick.csv",
//             "20140321_MSFT_tick.csv",
//             "20140324_MSFT_tick.csv",
//             "20140325_MSFT_tick.csv",
//             "20140326_MSFT_tick.csv",
//             "20140327_MSFT_tick.csv",
//             "20140328_MSFT_tick.csv",
//             "20140331_MSFT_tick.csv"};
// 
//     /**
//      * @param filename - fileName in data folder
//      * @return
//      * @throws FileNotFoundException
//      */
//     public static List<Tick> readCSV(String filename) throws FileNotFoundException {
// 
//         List<Tick> result = new ArrayList<Tick>();
//         File file = new File(pathToInput + filename);
//         Scanner scanner = new Scanner(file);
// 
//         while (scanner.hasNext()) {
//             String line = scanner.nextLine();
//             String data[] = line.split(",");
//             Long orderId = Long.parseLong(data[0]);
//             Long timestamp = Long.parseLong(data[1]);
//             Long numberShares = Long.parseLong(data[3]);
//             Long price = Long.parseLong(data[4]);
//             result.add(new Tick(orderId, timestamp, numberShares, price));
//         }
// 
//         Collections.sort(result);
// 
//         return result;
//     }
// }


import ch.epfl.bigdata.ts.dataparser.Tick;
import ch.epfl.bigdata.ts.dataparser.Utils;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Scanner;
import java.util.logging.FileHandler;
package ch.epfl.bigdata.ts.genalg;



/**
 * Created by dorwi on 05.04.14.
 */
public class GA {

    // Create an initial population
    public static Population population = new Population(Constants.MAX_INDIVIDUALS, true);
    //public static StockParameters stock_parameters = new StockParameters();


/*
    public static void send_values(long time, double price) {

        for (int i = 0; i < population.size(); i++) {
            population.getIndividual(i).trade(time, price);
        }
    }
*/
// Path: src/ch/epfl/bigdata/ts/dataparser/Tick.java
// public class Tick implements Comparable<Tick> {
// 
//     long orderID;
//     long timestamp;
//     char type;
//     long numberShares;
//     double price;
// 
//     public long getOrderID() {
//         return orderID;
//     }
// 
//     public long getTimestamp() {
//         return timestamp;
//     }
// 
//     public char getType() {
//         return type;
//     }
// 
//     public long getNumberShares() {
//         return numberShares;
//     }
// 
//     public double getPrice() {
//         return price;
//     }
// 
//     public Tick(long orderID, long timestamp, char type, long numberShares, long price) {
//         this.orderID = orderID;
//         this.timestamp = timestamp;
//         this.type = type;
//         this.numberShares = numberShares;
//         this.price = price / 10000;
//     }
// 
//     public Tick(long orderID, long timestamp, long numberShares, long price) {
//         this.orderID = orderID;
//         this.timestamp = timestamp;
//         this.numberShares = numberShares;
//         this.price = price / 10000.0;
//     }
// 
// 
//     @Override
//     public int compareTo(Tick o) {
//         if (this.timestamp < o.timestamp)
//             return -1;
//         else if (this.timestamp==o.timestamp)
//              return  0;
// 
//         return 1;
//     }
// 
//     @Override
//     public String toString() {
//         return timestamp +
//                 "," + type +
//                 "," + numberShares +
//                 "," + price;
//     }
// }
// 
// Path: src/ch/epfl/bigdata/ts/dataparser/Utils.java
// public class Utils {
// 
//     public static final String FILE_SUFFIX = "_MSFT_tick.csv";
//     public static final String pathToInput = "data\\";//put the absolute path to the data folder
// 
//     public static final String  pathToEvaluation = "results\\evaluations\\";
//     public static final String  pathToTraining = "results\\trainings\\";
//     public static final String  pathToVisualisation = "results\\visualisations\\";
// 
//     public static final int STARTING_YEAR = 2014;
//     public static final int STARTING_MONTH = 0;
//     public static final int STARTING_DAY = 30;
//     public static final SimpleDateFormat SDF = new SimpleDateFormat("yyyyMMdd");
// 
//     public static String[] dataFileNames = {"20140130_MSFT_tick.csv",
//             "20140131_MSFT_tick.csv",
//             "20140203_MSFT_tick.csv",
//             "20140204_MSFT_tick.csv",
//             "20140205_MSFT_tick.csv",
//             "20140206_MSFT_tick.csv",
//             "20140207_MSFT_tick.csv",
//             "20140210_MSFT_tick.csv",
//             "20140211_MSFT_tick.csv",
//             "20140212_MSFT_tick.csv",
//             "20140213_MSFT_tick.csv",
//             "20140214_MSFT_tick.csv",
//             "20140218_MSFT_tick.csv",
//             "20140219_MSFT_tick.csv",
//             "20140220_MSFT_tick.csv",
//             "20140221_MSFT_tick.csv",
//             "20140224_MSFT_tick.csv",
//             "20140225_MSFT_tick.csv",
//             "20140226_MSFT_tick.csv",
//             "20140227_MSFT_tick.csv",
//             "20140228_MSFT_tick.csv",
//             "20140303_MSFT_tick.csv",
//             "20140304_MSFT_tick.csv",
//             "20140305_MSFT_tick.csv",
//             "20140306_MSFT_tick.csv",
//             "20140307_MSFT_tick.csv",
//             "20140310_MSFT_tick.csv",
//             "20140311_MSFT_tick.csv",
//             "20140312_MSFT_tick.csv",
//             "20140313_MSFT_tick.csv",
//             "20140314_MSFT_tick.csv",
//             "20140317_MSFT_tick.csv",
//             "20140318_MSFT_tick.csv",
//             "20140319_MSFT_tick.csv",
//             "20140320_MSFT_tick.csv",
//             "20140321_MSFT_tick.csv",
//             "20140324_MSFT_tick.csv",
//             "20140325_MSFT_tick.csv",
//             "20140326_MSFT_tick.csv",
//             "20140327_MSFT_tick.csv",
//             "20140328_MSFT_tick.csv",
//             "20140331_MSFT_tick.csv"};
// 
//     /**
//      * @param filename - fileName in data folder
//      * @return
//      * @throws FileNotFoundException
//      */
//     public static List<Tick> readCSV(String filename) throws FileNotFoundException {
// 
//         List<Tick> result = new ArrayList<Tick>();
//         File file = new File(pathToInput + filename);
//         Scanner scanner = new Scanner(file);
// 
//         while (scanner.hasNext()) {
//             String line = scanner.nextLine();
//             String data[] = line.split(",");
//             Long orderId = Long.parseLong(data[0]);
//             Long timestamp = Long.parseLong(data[1]);
//             Long numberShares = Long.parseLong(data[3]);
//             Long price = Long.parseLong(data[4]);
//             result.add(new Tick(orderId, timestamp, numberShares, price));
//         }
// 
//         Collections.sort(result);
// 
//         return result;
//     }
// }


// Path: src/ch/epfl/bigdata/ts/genalg/GA.java
import ch.epfl.bigdata.ts.dataparser.Tick;
import ch.epfl.bigdata.ts.dataparser.Utils;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Scanner;
import java.util.logging.FileHandler;

package ch.epfl.bigdata.ts.genalg;



/**
 * Created by dorwi on 05.04.14.
 */
public class GA {

    // Create an initial population
    public static Population population = new Population(Constants.MAX_INDIVIDUALS, true);
    //public static StockParameters stock_parameters = new StockParameters();


/*
    public static void send_values(long time, double price) {

        for (int i = 0; i < population.size(); i++) {
            population.getIndividual(i).trade(time, price);
        }
    }
*/
public static void send_values(Tick tick) {