Synchronization with MK branch.
This commit is contained in:
		@@ -160,7 +160,7 @@ public class OptimizerFactory {
 | 
			
		||||
		de.addPopulationChangedEventListener(listener);
 | 
			
		||||
		de.init();
 | 
			
		||||
 | 
			
		||||
		listener.registerPopulationStateChanged(de.getPopulation(), "");
 | 
			
		||||
		if (listener!=null) listener.registerPopulationStateChanged(de.getPopulation(), "");
 | 
			
		||||
 | 
			
		||||
		return de;
 | 
			
		||||
	}
 | 
			
		||||
@@ -388,7 +388,7 @@ public class OptimizerFactory {
 | 
			
		||||
		hc.SetProblem(problem);
 | 
			
		||||
		hc.init();
 | 
			
		||||
 | 
			
		||||
		listener.registerPopulationStateChanged(hc.getPopulation(), "");
 | 
			
		||||
		if (listener != null) listener.registerPopulationStateChanged(hc.getPopulation(), "");
 | 
			
		||||
 | 
			
		||||
		return hc;
 | 
			
		||||
	}
 | 
			
		||||
@@ -419,7 +419,7 @@ public class OptimizerFactory {
 | 
			
		||||
		mc.SetProblem(problem);
 | 
			
		||||
		mc.init();
 | 
			
		||||
 | 
			
		||||
		listener.registerPopulationStateChanged(mc.getPopulation(), "");
 | 
			
		||||
		if (listener != null) listener.registerPopulationStateChanged(mc.getPopulation(), "");
 | 
			
		||||
 | 
			
		||||
		return mc;
 | 
			
		||||
	}
 | 
			
		||||
@@ -465,7 +465,7 @@ public class OptimizerFactory {
 | 
			
		||||
		pso.addPopulationChangedEventListener(listener);
 | 
			
		||||
		pso.init();
 | 
			
		||||
 | 
			
		||||
		listener.registerPopulationStateChanged(pso.getPopulation(), "");
 | 
			
		||||
		if (listener != null) listener.registerPopulationStateChanged(pso.getPopulation(), "");
 | 
			
		||||
 | 
			
		||||
		return pso;
 | 
			
		||||
	}
 | 
			
		||||
@@ -506,7 +506,7 @@ public class OptimizerFactory {
 | 
			
		||||
		sa.addPopulationChangedEventListener(listener);
 | 
			
		||||
		sa.init();
 | 
			
		||||
 | 
			
		||||
		listener.registerPopulationStateChanged(sa.getPopulation(), "");
 | 
			
		||||
		if (listener!=null) listener.registerPopulationStateChanged(sa.getPopulation(), "");
 | 
			
		||||
 | 
			
		||||
		return sa;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -430,6 +430,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
 | 
			
		||||
			String  name    = oldProps[i].getDisplayName();
 | 
			
		||||
			if (name.compareTo(string)==0) return i;
 | 
			
		||||
		}
 | 
			
		||||
		System.err.println("Error, property not found: " + string);
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -319,4 +319,4 @@ public class MutateESCovarianceMatrixAdaption implements InterfaceMutation, java
 | 
			
		||||
    public String initSigmaScalarTipText() {
 | 
			
		||||
        return "Set the initial sigma value.";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -144,7 +144,6 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem implemen
 | 
			
		||||
 | 
			
		||||
        x = getXVector(individual);
 | 
			
		||||
 | 
			
		||||
     //TODO call external runtime
 | 
			
		||||
        double[] fit = eval(x);
 | 
			
		||||
        individual.SetFitness(fit);
 | 
			
		||||
		        
 | 
			
		||||
 
 | 
			
		||||
@@ -1066,17 +1066,20 @@ public class Mathematics {
 | 
			
		||||
		double d = 0.;
 | 
			
		||||
		for (int i=0; i<x.length; i++) {
 | 
			
		||||
			double dimLen = range[i][1]-range[i][0];
 | 
			
		||||
			if (dimLen <= 0.) EVAERROR.errorMsgOnce("Error in reflectBounds: empty range! (possibly multiple errors)");
 | 
			
		||||
			if (x[i]<range[i][0]) {
 | 
			
		||||
				viols++;
 | 
			
		||||
				d = range[i][0]-x[i];
 | 
			
		||||
				while (d > dimLen) d -= dimLen; // avoid violating the other bound immediately
 | 
			
		||||
				x[i]=range[i][0]+d;
 | 
			
		||||
			} else if (x[i]>range[i][1]) {
 | 
			
		||||
				viols++;
 | 
			
		||||
				d = x[i]-range[i][1];
 | 
			
		||||
				while (d>dimLen) d -= dimLen; // avoid violating the other bound immediately
 | 
			
		||||
				x[i]=range[i][1]-d;
 | 
			
		||||
			if (dimLen <= 0.) {
 | 
			
		||||
				EVAERROR.errorMsgOnce("Error in reflectBounds: empty range! (possibly multiple errors)");
 | 
			
		||||
			} else {
 | 
			
		||||
				if (x[i]<range[i][0]) {
 | 
			
		||||
					viols++;
 | 
			
		||||
					d = range[i][0]-x[i];
 | 
			
		||||
					while (d > dimLen) d -= dimLen; // avoid violating the other bound immediately
 | 
			
		||||
					x[i]=range[i][0]+d;
 | 
			
		||||
				} else if (x[i]>range[i][1]) {
 | 
			
		||||
					viols++;
 | 
			
		||||
					d = x[i]-range[i][1];
 | 
			
		||||
					while (d>dimLen) d -= dimLen; // avoid violating the other bound immediately
 | 
			
		||||
					x[i]=range[i][1]-d;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return viols;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user