Merge MK 263:264: Some new functions (coming with NES tests)
This commit is contained in:
		@@ -5,6 +5,7 @@ import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
import eva2.server.go.individuals.AbstractEAIndividual;
 | 
			
		||||
import eva2.server.go.populations.Population;
 | 
			
		||||
import eva2.tools.EVAERROR;
 | 
			
		||||
 | 
			
		||||
/** This abstract implementation gives some general
 | 
			
		||||
 * methods for retrieving and cleaning fitness values.
 | 
			
		||||
@@ -70,34 +71,42 @@ public abstract class AbstractSelProb implements InterfaceSelectionProbability,
 | 
			
		||||
            tmpList = new ArrayList();
 | 
			
		||||
            for (int j = 0; j < inputs.length; j++) {
 | 
			
		||||
                obj = tmpIndy.getData(inputs[j]);
 | 
			
		||||
                if (obj==null) EVAERROR.errorMsgOnce("Error: could not get data by key " + inputs[j] + " from individual in AbstractSelProb");
 | 
			
		||||
                if (obj instanceof double[]) {
 | 
			
		||||
                    for (int m = 0; m < ((double[])obj).length; m++) {
 | 
			
		||||
                        tmpList.add(new Double(((double[])obj)[m]));
 | 
			
		||||
                    }
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                if (obj instanceof Double) {
 | 
			
		||||
                    tmpList.add((Double)obj);
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                if (obj instanceof float[]) {
 | 
			
		||||
                    for (int m = 0; m < ((float[])obj).length; m++) {
 | 
			
		||||
                        tmpList.add(new Double(((float[])obj)[m]));
 | 
			
		||||
                    }
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                if (obj instanceof Float) {
 | 
			
		||||
                    tmpList.add((Float)obj);
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                if (obj instanceof long[]) {
 | 
			
		||||
                    for (int m = 0; m < ((long[])obj).length; m++) {
 | 
			
		||||
                        tmpList.add(new Double(((long[])obj)[m]));
 | 
			
		||||
                    }
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                if (obj instanceof Long) {
 | 
			
		||||
                    tmpList.add((Long)obj);
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                if (obj instanceof int[]) {
 | 
			
		||||
                    for (int m = 0; m < ((int[])obj).length; m++) {
 | 
			
		||||
                        tmpList.add(new Double(((int[])obj)[m]));
 | 
			
		||||
                    }
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                if (obj instanceof Integer) {
 | 
			
		||||
                    tmpList.add((Integer)obj);
 | 
			
		||||
 
 | 
			
		||||
@@ -402,6 +402,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
 | 
			
		||||
	    		resultPop.setPopulationSize(resultPop.size());
 | 
			
		||||
	    	}
 | 
			
		||||
	    	resultPop = PostProcess.postProcess(ppp, resultPop, (AbstractOptimizationProblem)goParams.getProblem(), listener);
 | 
			
		||||
	    	resPop = resultPop;
 | 
			
		||||
	    	return resultPop;
 | 
			
		||||
    	} else return null;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,12 @@ public class Serializer {
 | 
			
		||||
  static public void store(Serializable o, File f) throws IOException {
 | 
			
		||||
    FileOutputStream file = new FileOutputStream(f);
 | 
			
		||||
    ObjectOutputStream out = new ObjectOutputStream(file);
 | 
			
		||||
    out.writeObject(o);
 | 
			
		||||
    try {
 | 
			
		||||
    	out.writeObject(o);
 | 
			
		||||
    } catch (java.io.NotSerializableException e) {
 | 
			
		||||
    	System.err.println("Error: Object " + o.getClass() + " is not serializable - run settings cannot be stored.");
 | 
			
		||||
    	e.printStackTrace();
 | 
			
		||||
    }
 | 
			
		||||
    out.flush();
 | 
			
		||||
    out.close();
 | 
			
		||||
    file.close();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user