// Path: Random Regex Turtle/src/it/units/inginf/male/outputs/FinalSolution.java
// public class FinalSolution extends Solution{
// 
//     public FinalSolution() {
//     }
// 
//     public FinalSolution(Ranking individual) {
//         super(individual);
//         this.solutionJS = getDescriptionJavascript(individual.getTree());
//     }
//    
//     private String getDescriptionJavascript(Node node){
//         StringBuilder sb = new StringBuilder();
//         node.describe(sb, new DescriptionContext(), Node.RegexFlavour.JS);
//         return sb.toString();
//     }
// 
//     /**
//      * Create a FinalSolution for the Java regex (String) solution parameter.
//      * Javascript version is not automatically generate, this needs initialization
//      * with a Node individual.
//      * @param solution
//      */
//     public FinalSolution(String solution) {
//         super(solution);
//     }
// 
//     public FinalSolution(String solution, double[] fitness) {
//         super(solution, fitness);
//     }
// 
//     private String solutionJS;
//     private Map<String,Double> trainingPerformances = new HashMap<>();
//     private Map<String,Double> validationPerformances = new HashMap<>();
//     private Map<String,Double> learningPerformances = new HashMap<>();
// 
//     public Map<String, Double> getTrainingPerformances() {
//         return trainingPerformances;
//     }
// 
//     public void setTrainingPerformances(Map<String, Double> trainingPerformances) {
//         this.trainingPerformances = trainingPerformances;
//     }
// 
//     public Map<String, Double> getValidationPerformances() {
//         return validationPerformances;
//     }
// 
//     public void setValidationPerformances(Map<String, Double> validationPerformances) {
//         this.validationPerformances = validationPerformances;
//     }
// 
//     public Map<String, Double> getLearningPerformances() {
//         return learningPerformances;
//     }
// 
//     public void setLearningPerformances(Map<String, Double> learningPerformances) {
//         this.learningPerformances = learningPerformances;
//     }
// 
//     public String getSolutionJS() {
//         return solutionJS;
//     }
//      
// }


import it.units.inginf.male.outputs.FinalSolution;
/*
 * Copyright (C) 2015 Machine Learning Lab - University of Trieste, 
 * Italy (http://machinelearning.inginf.units.it/)  
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.units.inginf.male.strategy.impl;


/**
 *
 * @author MaleLabTs
 */
public class BasicExecutionStatus {
    
    public boolean isSearchRunning;
    public boolean hasFinalResult;
    public String evolutionEta;
    public FinalSolution best = null;
    
    //public double bestPerformance;
    public int jobTotal = 0;
    public int jobDone = 0;
    public int jobFailed = 0;
    public int overallGenerations = 0;
    public int overallGenerationsDone = 0;
    
    /**
     * Checks the candidate parameter to be better than previous recorded best.
     * When the candidate is better than the best, candidate becames the new best.
     * The best and the candidate need a populated trainingPerformance or the update'll fail
     * 
     * The best solution is the solution with higher training f-measure, when f-measure is the same
     * the best solution is the smaller (string length wise) one.
     * @param candidate
     */
// Path: Random Regex Turtle/src/it/units/inginf/male/outputs/FinalSolution.java
// public class FinalSolution extends Solution{
// 
//     public FinalSolution() {
//     }
// 
//     public FinalSolution(Ranking individual) {
//         super(individual);
//         this.solutionJS = getDescriptionJavascript(individual.getTree());
//     }
//    
//     private String getDescriptionJavascript(Node node){
//         StringBuilder sb = new StringBuilder();
//         node.describe(sb, new DescriptionContext(), Node.RegexFlavour.JS);
//         return sb.toString();
//     }
// 
//     /**
//      * Create a FinalSolution for the Java regex (String) solution parameter.
//      * Javascript version is not automatically generate, this needs initialization
//      * with a Node individual.
//      * @param solution
//      */
//     public FinalSolution(String solution) {
//         super(solution);
//     }
// 
//     public FinalSolution(String solution, double[] fitness) {
//         super(solution, fitness);
//     }
// 
//     private String solutionJS;
//     private Map<String,Double> trainingPerformances = new HashMap<>();
//     private Map<String,Double> validationPerformances = new HashMap<>();
//     private Map<String,Double> learningPerformances = new HashMap<>();
// 
//     public Map<String, Double> getTrainingPerformances() {
//         return trainingPerformances;
//     }
// 
//     public void setTrainingPerformances(Map<String, Double> trainingPerformances) {
//         this.trainingPerformances = trainingPerformances;
//     }
// 
//     public Map<String, Double> getValidationPerformances() {
//         return validationPerformances;
//     }
// 
//     public void setValidationPerformances(Map<String, Double> validationPerformances) {
//         this.validationPerformances = validationPerformances;
//     }
// 
//     public Map<String, Double> getLearningPerformances() {
//         return learningPerformances;
//     }
// 
//     public void setLearningPerformances(Map<String, Double> learningPerformances) {
//         this.learningPerformances = learningPerformances;
//     }
// 
//     public String getSolutionJS() {
//         return solutionJS;
//     }
//      
// }


// Path: Random Regex Turtle/src/it/units/inginf/male/strategy/impl/BasicExecutionStatus.java
import it.units.inginf.male.outputs.FinalSolution;

/*
 * Copyright (C) 2015 Machine Learning Lab - University of Trieste, 
 * Italy (http://machinelearning.inginf.units.it/)  
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.units.inginf.male.strategy.impl;


/**
 *
 * @author MaleLabTs
 */
public class BasicExecutionStatus {
    
    public boolean isSearchRunning;
    public boolean hasFinalResult;
    public String evolutionEta;
    public FinalSolution best = null;
    
    //public double bestPerformance;
    public int jobTotal = 0;
    public int jobDone = 0;
    public int jobFailed = 0;
    public int overallGenerations = 0;
    public int overallGenerationsDone = 0;
    
    /**
     * Checks the candidate parameter to be better than previous recorded best.
     * When the candidate is better than the best, candidate becames the new best.
     * The best and the candidate need a populated trainingPerformance or the update'll fail
     * 
     * The best solution is the solution with higher training f-measure, when f-measure is the same
     * the best solution is the smaller (string length wise) one.
     * @param candidate
     */
    synchronized public void updateBest(FinalSolution candidate){