Some updates to the ant-file, RandomNumberGenerator has been reunified with RNG

This commit is contained in:
Marcel Kronfeld 2008-04-17 16:36:21 +00:00
parent 0105c97c41
commit b72d2a86b4
135 changed files with 829 additions and 1087 deletions

View File

@ -2,5 +2,9 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/asm-3.1.jar"/>
<classpathentry kind="lib" path="lib/jaxen-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/junit-4.4.jar"/>
<classpathentry kind="lib" path="lib/pmd-4.2.1.jar"/>
<classpathentry kind="output" path="build"/>
</classpath>

View File

@ -1,6 +1,6 @@
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Filename: $RCSfile$
Purpose: Ant build file for JavaEvA.
Purpose: Ant build file for EvA2.
Ant-Download: http://jakarta.apache.org/ant
Ant-Manual: http://jakarta.apache.org/ant/manual/index.html
@ -11,14 +11,14 @@
Language: XML
Compiler: Ant
Authors: Holger Ulmer, Felix Streichert, Joerg Wegner
Authors: M.Kronfeld, H.Planatscher, Holger Ulmer, Felix Streichert, Joerg Wegner
Version: $Revision: 284 $
$Date: 2007-11-27 14:37:05 +0100 (Tue, 27 Nov 2007) $
$Author: mkron $
Copyright (c) Dept. Computer Architecture, University of Tuebingen, Germany
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<project name="JavaEvA" default="compile" basedir="..">
<project name="EvA2" default="compile" basedir="..">
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Set properties
@ -38,17 +38,21 @@
<property name="check.libraries.ant" value="ant/check.xml" />
<property name="windows.libraries" value="${library.directory}/windows" />
<property name="unix.libraries" value="${library.directory}/linux" />
<!--
<property name="library.SNNS" value="SNNS_jkr" />
<property name="library.JMatLink" value="JMatLink" />
<property name="library.WSI.ant" value="../java" />
<property name="library.WSI.original" value="${library.WSI.ant}/dist/wsi.jar" />
<property name="library.WSI" value="lib/wsi2.jar" />
-->
<!-- SET THE JAVA BINARY LIBRARIES PROPERTIES -->
<property name="ant.java.version" value="1.5" />
<!-- SET CLASSPATH -->
<path id="project.class.path">
<pathelement location="." />
<!-- shouldnt be required for EvA2
<pathelement location="${env.JAVA_HOME}/jre/lib/rt.jar" />
<pathelement location="${env.JAVA_HOME}/lib/dt.jar" />
<pathelement location="${env.JAVA_HOME}/lib/tools.jar" />
@ -60,6 +64,7 @@
<fileset dir="${library.directory}">
<include name="*.jar" />
</fileset>
-->
</path>
<!-- SET THE CVS RELEVANT PROPERTIES -->
@ -89,7 +94,7 @@
binaryDist - will create a complete binary distribution
clean - will clean up files, except the source files and the api
documentation
run - will start JavaEvA
run - will start EvA2
use 'ant -projecthelp' for further Main targets
</echo>
@ -148,29 +153,15 @@
</target>
<target name="cleanAll" depends="init, clean">
<!--
<ant inheritAll="false" antfile="build.xml" dir="${library.WSI.ant}" target="clean">
<property name="silent" value="true"/>
</ant>
</ant>-->
</target>
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Update libraries
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<target name="update.library.WSI" depends="init">
<!--<ant inheritAll="false" antfile="build.xml" dir="${library.WSI.ant}" target="compile">
<property name="silent" value="true"/>
</ant>
-->
<ant inheritAll="false" antfile="build.xml"
dir="${library.WSI.ant}" target="dist4JOpt">
<property name="silent" value="true"/>
</ant>
<delete>
<fileset dir="${library.directory}" includes="wsi*jar" />
</delete>
<copy file="${library.WSI.original}" tofile="${library.WSI}"/>
</target>
<target name="update.libraries" depends="update.library.WSI">
<target name="update.libraries">
</target>
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Compile
@ -221,67 +212,20 @@
<copy todir="${build.directory}/resources">
<fileset dir="${resources.directory}" includes="**/*" />
</copy>
<!--
<copy todir="${build.directory}/resources/images">
<fileset dir="${resources.directory}/images" includes="*gif" />
</copy>
<copy todir="${build.directory}/resources/images">
<fileset dir="${resources.directory}/images" includes="*jpg" />
</copy>
<copy todir="${build.directory}/resources/images">
<fileset dir="${resources.directory}/images" includes="*png" />
</copy>
<copy todir="${build.directory}/resources/">
<fileset dir="${resources.directory}" includes="*html" />
</copy>
<copy todir="${build.directory}/resources/ORLibrary">
<fileset dir="${resources.directory}/ORLibrary" includes="*txt" />
</copy>
<copy todir="${build.directory}/resources/Altana">
<fileset dir="${resources.directory}/Altana" includes="*dat" />
</copy>
<copy todir="${build.directory}/resources/TSP">
<fileset dir="${resources.directory}/TSP" includes="*" />
</copy>
<copy todir="${build.directory}/resources/TSP/euc2d">
<fileset dir="${resources.directory}/TSP/euc2d" includes="*tsp" />
</copy>
<copy todir="${build.directory}/resources/TSP/instances">
<fileset dir="${resources.directory}/TSP/instances" includes="*tsp" />
</copy>
-->
</target>
<!-- =================================================================== -->
<!-- Jars all classes into one jar file -->
<!-- =================================================================== -->
<target name="bundle" depends="compile" description="Compiles the project and puts the whole stuff into a jar-file..">
<property name="bin.dist.dir" value="${binary.distribution.directory}/javaeva-${DSTAMP}" />
<property name="bin.dist.dir" value="${binary.distribution.directory}/eva2-${DSTAMP}" />
<mkdir dir="${bin.dist.dir}" />
<mkdir dir="${bin.dist.dir}/${library.directory}" />
<delete> <fileset dir="${bin.dist.dir}/${library.directory}" includes="*JavaEvA*jar" /> </delete>
<jar jarfile="${bin.dist.dir}/${library.directory}/JavaEvA.jar" basedir="${build.directory}">
<delete> <fileset dir="${bin.dist.dir}/${library.directory}" includes="*EvA*jar" /> </delete>
<jar jarfile="${bin.dist.dir}/${library.directory}/EvA2Base.jar" basedir="${build.directory}">
<!-- JKW: That's bad practice, if we have internal dependencies -->
<!-- JKW: Use a correct shell script or ant task to run application, which -->
<!-- JKW: resolves the classpath automatically from all libraries in the library directory -->
<zipgroupfileset dir="${library.directory}">
<include name="jdom.jar"/>
<include name="activation.jar"/>
<include name="imap.jar"/>
<include name="joelib.jar"/>
<include name="log4j.jar"/>
<include name="mail.jar"/>
<include name="mailapi.jar"/>
<include name="pop3.jar"/>
<include name="smtp.jar"/>
<include name="xalan2.jar"/>
<include name="wsi.jar"/>
</zipgroupfileset>
<!--<fileset dir="${classes.dir}" excludes="*test*"/>-->
<manifest> <attribute name="Main-Class" value="javaeva.client.EvAClient"/> </manifest>
<manifest> <attribute name="Main-Class" value="eva2.client.EvAClient"/> </manifest>
</jar>
</target>
@ -292,13 +236,13 @@
<!-- ===================================================================
-->
<target name="bundlehannes" depends="compile" description="Compiles the project and puts the whole stuff into a jar-file..">
<property name="bin.dist.dir" value="${binary.distribution.directory}/javaeva-${DSTAMP}" />
<property name="bin.dist.dir" value="${binary.distribution.directory}/eva2-${DSTAMP}" />
<mkdir dir="${bin.dist.dir}" />
<mkdir dir="${bin.dist.dir}/${library.directory}" />
<delete>
<fileset dir="${bin.dist.dir}/${library.directory}" includes="*JavaEvA*jar" />
<fileset dir="${bin.dist.dir}/${library.directory}" includes="*EvA*jar" />
</delete>
<jar jarfile="${bin.dist.dir}/${library.directory}/JavaEvA.jar" basedir="${build.directory}" filesetmanifest="mergewithoutmain">
<jar jarfile="${bin.dist.dir}/${library.directory}/EvA2Base.jar" basedir="${build.directory}" filesetmanifest="mergewithoutmain">
<!-- JKW: That's bad practice, if we have internal dependencies -->
<!-- JKW: Use a correct shell script or ant task to run application, which -->
<!-- JKW: resolves the classpath automatically from all libraries in the library directory -->
@ -308,7 +252,7 @@
<!-- <fileset dir="${classes.dir}" excludes="*test*"/>
-->
<manifest>
<attribute name="Main-Class" value="javaeva.client.EvAClient" />
<attribute name="Main-Class" value="eva2.client.EvAClient" />
</manifest>
</jar>
</target>
@ -317,16 +261,15 @@
Binary Distribution
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<target name="binaryDist" depends="compile" description="Compiles the project and puts the whole stuff into a jar-file..">
<property name="bin.dist.dir" value="${binary.distribution.directory}/javaeva-${DSTAMP}" />
<property name="bin.dist.dir" value="${binary.distribution.directory}/eva-${DSTAMP}" />
<mkdir dir="${bin.dist.dir}" />
<mkdir dir="${bin.dist.dir}/${library.directory}" />
<delete>
<fileset dir="${bin.dist.dir}/${library.directory}" includes="*JavaEvA*jar" />
<fileset dir="${bin.dist.dir}/${library.directory}" includes="*EvA*jar" />
</delete>
<!-- <jar jarfile="${bin.dist.dir}/${library.directory}/JavaEvA.jar" manifest="project/javaeva.man" basedir="${build.directory}" /> -->
<jar jarfile="${bin.dist.dir}/${library.directory}/JavaEvA.jar" basedir="${build.directory}" >
<manifest> <attribute name="Main-Class" value="javaeva.client.EvAClient"/> </manifest>
<jar jarfile="${bin.dist.dir}/${library.directory}/EvA2Base.jar" basedir="${build.directory}" >
<manifest> <attribute name="Main-Class" value="eva2.client.EvAClient"/> </manifest>
</jar>
<copy todir="${bin.dist.dir}/${library.directory}">
<fileset dir="${library.directory}">
@ -379,17 +322,17 @@
</copy>
-->
<tar tarfile="${distribution.directory}/javaeva-bin-${DSTAMP}.tar">
<tar tarfile="${distribution.directory}/eva2-bin-${DSTAMP}.tar">
<tarfileset dir="${binary.distribution.directory}">
<include name="**" />
<exclude name="*.tar*, *.zip" />
</tarfileset>
</tar>
<gzip zipfile="${distribution.directory}/javaeva-bin-${DSTAMP}.tar.gz"
src="${distribution.directory}/javaeva-bin-${DSTAMP}.tar" />
<delete file="${distribution.directory}/javaeva-bin-${DSTAMP}.tar" />
<gzip zipfile="${distribution.directory}/eva2-bin-${DSTAMP}.tar.gz"
src="${distribution.directory}/eva2-bin-${DSTAMP}.tar" />
<delete file="${distribution.directory}/eva2-bin-${DSTAMP}.tar" />
<zip zipfile="${distribution.directory}/javaeva-bin-${DSTAMP}.zip">
<zip zipfile="${distribution.directory}/eva2-bin-${DSTAMP}.zip">
<zipfileset dir="${binary.distribution.directory}">
<include name="**" />
<exclude name="*.tar*, *.zip" />
@ -404,7 +347,7 @@
<target name="sourceDist" depends="init">
<fail message="Not properly supported yet!"/>
<property name="src.dist.dir" value="${source.distribution.directory}/javaeva-${DSTAMP}" />
<property name="src.dist.dir" value="${source.distribution.directory}/eva2-${DSTAMP}" />
<mkdir dir="${src.dist.dir}" />
<copy todir="${src.dist.dir}">
@ -445,13 +388,13 @@
</fileset>
</copy>
<tar tarfile="${distribution.directory}/javaeva-src-${DSTAMP}.tar"
<tar tarfile="${distribution.directory}/eva2-src-${DSTAMP}.tar"
basedir="${source.distribution.directory}" includes="**" excludes="*.tar*, *.zip"/>
<gzip zipfile="${distribution.directory}/javaeva-src-${DSTAMP}.tar.gz"
src="${distribution.directory}/javaeva-src-${DSTAMP}.tar" />
<delete file="${distribution.directory}/javaeva-src-${DSTAMP}.tar" />
<gzip zipfile="${distribution.directory}/eva2-src-${DSTAMP}.tar.gz"
src="${distribution.directory}/eva2-src-${DSTAMP}.tar" />
<delete file="${distribution.directory}/eva2-src-${DSTAMP}.tar" />
<zip zipfile="${distribution.directory}/javaeva-src-${DSTAMP}.zip">
<zip zipfile="${distribution.directory}/eva2-src-${DSTAMP}.zip">
<zipfileset dir="${source.distribution.directory}">
<include name="**" />
<exclude name="*.tar*, *.zip" />
@ -467,50 +410,50 @@
</target>
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Run JavaEvA
Run EvA2
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<target name="run" description="Runs JavaEvA.">
<java classname="javaeva.client.EvAClient" fork="yes">
<target name="run" description="Runs EvA2.">
<java classname="eva2.client.EvAClient" fork="yes">
<jvmarg value="-Xmx512m"/>
<classpath refid="project.class.path" />
</java>
</target>
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Run JavaEvA
Run EvA2
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<target name="Altana" description="Runs Altana CombiLib Problem.">
<java classname="javaeva.server.oa.go.GOAltana" fork="yes">
<java classname="eva2.server.oa.go.GOAltana" fork="yes">
<jvmarg value="-Xmx512m"/>
<classpath refid="project.class.path" />
</java>
</target>
<target name="Portfolio" description="Runs GOPortfolio.">
<java classname="javaeva.server.oa.go.GOPortfolio" fork="yes">
<java classname="eva2.server.oa.go.GOPortfolio" fork="yes">
<jvmarg value="-Xmx512m" />
<classpath refid="project.class.path" />
</java>
</target>
<target name="PortfolioLS" description="Runs GOPortfolioLS.">
<java classname="javaeva.server.oa.go.GOPortfolioLS" fork="yes">
<java classname="eva2.server.oa.go.GOPortfolioLS" fork="yes">
<jvmarg value="-Xmx512m" />
<classpath refid="project.class.path" />
</java>
</target>
<target name="PMOEA" description="Runs ParallelMOEAs.">
<java classname="javaeva.server.oa.go.GOParallelMOEA" fork="yes">
<java classname="eva2.server.oa.go.GOParallelMOEA" fork="yes">
<jvmarg value="-Xmx512m" />
<classpath refid="project.class.path" />
</java>
</target>
<target name="GridMC" description="Runs a Grid Search for GO.">
<java classname="javaeva.server.oa.go.GOGridSearchTwo" fork="yes">
<java classname="eva2.server.oa.go.GOGridSearchTwo" fork="yes">
<jvmarg value="-Xmx512m" />
<classpath refid="project.class.path" />
</java>
@ -518,49 +461,49 @@
<target name="GOSSFirst" description="Runs a comparison on system identification.">
<java classname="javaeva.server.oa.go.GOSystemComparing" fork="yes">
<java classname="eva2.server.oa.go.GOSystemComparing" fork="yes">
<jvmarg value="-Xmx512m" />
<classpath refid="project.class.path" />
</java>
</target>
<target name="GOSSMSHC" description="Runs a comparison on system identification.">
<java classname="javaeva.server.oa.go.GOSystemMSHC" fork="yes">
<java classname="eva2.server.oa.go.GOSystemMSHC" fork="yes">
<jvmarg value="-Xmx512m" />
<classpath refid="project.class.path" />
</java>
</target>
<target name="GOSSESPopSize" description="Runs a comparison on system identification.">
<java classname="javaeva.server.oa.go.GOSystemESPopSize" fork="yes">
<java classname="eva2.server.oa.go.GOSystemESPopSize" fork="yes">
<jvmarg value="-Xmx512m" />
<classpath refid="project.class.path" />
</java>
</target>
<target name="GOSSPmPc" description="Runs a comparison on system identification.">
<java classname="javaeva.server.oa.go.GOSystemPmPc" fork="yes">
<java classname="eva2.server.oa.go.GOSystemPmPc" fork="yes">
<jvmarg value="-Xmx512m" />
<classpath refid="project.class.path" />
</java>
</target>
<target name="GOSSESMutation" description="Runs a comparison on system identification.">
<java classname="javaeva.server.oa.go.GOSystemESMutation" fork="yes">
<java classname="eva2.server.oa.go.GOSystemESMutation" fork="yes">
<jvmarg value="-Xmx512m" />
<classpath refid="project.class.path" />
</java>
</target>
<target name="GOSSGACrossover" description="Runs a comparison on system identification.">
<java classname="javaeva.server.oa.go.GOSystemGACrossover" fork="yes">
<java classname="eva2.server.oa.go.GOSystemGACrossover" fork="yes">
<jvmarg value="-Xmx512m" />
<classpath refid="project.class.path" />
</java>
</target>
<target name="GOSSMALSLI" description="Runs a comparison on system identification.">
<java classname="javaeva.server.oa.go.GOSystemMA" fork="yes">
<java classname="eva2.server.oa.go.GOSystemMA" fork="yes">
<jvmarg value="-Xmx512m" />
<classpath refid="project.class.path" />
</java>
@ -571,9 +514,9 @@
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<target name="javadoc" description="Generates the JavaDoc-API Documentation.">
<javadoc packagenames="javaeva.*"
windowtitle ="JavaEvA API Documentation"
doctitle ="JavaEvA API Documentation"
<javadoc packagenames="eva2.*"
windowtitle ="EvA2 API Documentation"
doctitle ="EvA2 API Documentation"
author ="true"
version ="true"
use ="true"
@ -586,23 +529,28 @@
<doctitle><![CDATA[<h1>Test</h1>]]></doctitle>
<header><![CDATA[<font size="-1"><b><i>
<A HREF="http://www-ra.informatik.uni-tuebingen.de/forschung/"
target="_top">JavaEvA
<A HREF="http://www.ra.cs.uni-tuebingen.de/forschung/"
target="_top">EvA2
</A>
</b></i></font>]]>
</header>
<!--
<footer><![CDATA[javaeva<br>
<A HREF="http://www-ra.informatik.uni-tuebingen.de/forschung/"
<A HREF="http://www.ra.cs.uni-tuebingen.de/forschung/"
target="_top">JavaEvA
</A><BR>
E-Mail:
<A HREF="mailto:ulmer@informatik.uni-tuebingen.de">
ulmer@informatik.uni-tuebingen.de
</A>]]>
</footer>
-->
<footer><![CDATA[eva2<br>
<A HREF="http://www.ra.cs.uni-tuebingen.de/forschung/"
target="_top">EvA2
</A>]]>
</footer>
<link offline="true"
href="http://java.sun.com/j2se/jdk1.5.0_03/docs/api/"
packagelistLoc="${env.JAVA_HOME}/docs/api"

View File

@ -240,7 +240,7 @@ public class OptimizerFactory {
InterfacePopulationChangedEventListener listener) {
problem.initProblem();
// RandomNumberGenerator.setRandomSeed(100);
// RNG.setRandomSeed(100);
AbstractEAIndividual tmpIndi = problem.getIndividualTemplate();
tmpIndi.setMutationOperator(mutationoperator);

View File

@ -27,11 +27,11 @@ import eva2.server.stat.StatisticsStandalone;
*
*/
public class OptimizerRunnable implements Runnable {
Processor proc;
boolean isFinished = false;
boolean doRestart = false; // indicate whether start or restart should be done --> whether pop will be reinitialized.
boolean postProcessOnly = false;
InterfaceTextListener listener = null;
private Processor proc;
private boolean isFinished = false;
private boolean doRestart = false; // indicate whether start or restart should be done --> whether pop will be reinitialized.
private boolean postProcessOnly = false;
private InterfaceTextListener listener = null;
public OptimizerRunnable(GOParameters params, String outputFilePrefix) {
this(params, outputFilePrefix, false);

View File

@ -78,6 +78,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
private static Properties EVA_PROPERTIES;
public static final String iconLocation = "resources/images/icon3.gif";
private static final String splashLocation = "resources/images/splashScreen2.png";
private static final String infoTitle = "EvA2 Information";
final int splashScreenTime = 1500;
public static boolean TRACE = false;
@ -510,7 +511,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
if (selectedModule == null) { // show a dialog and ask for a module
String[] ModuleNameList = m_ComAdapter.getModuleNameList();
if (ModuleNameList == null) {
JOptionPane.showMessageDialog(m_Frame.getContentPane(), "No modules available on " + m_ComAdapter.getHostName(), "EvA2 Information", 1);
JOptionPane.showMessageDialog(m_Frame.getContentPane(), "No modules available on " + m_ComAdapter.getHostName(), infoTitle, 1);
} else {
String LastModuleName = Serializer.loadString("lastmodule.ser");
if (LastModuleName == null) LastModuleName = ModuleNameList[0];
@ -643,7 +644,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
}
private void showPleaseWaitDialog() {
JOptionPane.showMessageDialog(m_Frame.getContentPane(), "Please wait one moment.", "EvA2 Information", 1);
JOptionPane.showMessageDialog(m_Frame.getContentPane(), "Please wait one moment.", infoTitle, 1);
}
private void showAboutDialog() {
@ -651,11 +652,11 @@ public class EvAClient implements RemoteStateListener, Serializable {
(m_Frame,
m_ProductName +
"\n University of Tuebingen\n Computer Architecture\n H. Ulmer & F. Streichert & H. Planatscher & M. de Paly & M. Kronfeld\n Prof. Dr. Andreas Zell \n (c) 2008 \n Version " +
EvAServer.Version + " \n http://www.ra.cs.uni-tuebingen.de/software/EvA2", "EvA2 Information", 1);
EvAServer.Version + " \n http://www.ra.cs.uni-tuebingen.de/software/EvA2", infoTitle, 1);
}
private void showNoHostFoundDialog() {
JOptionPane.showMessageDialog(m_Frame.getContentPane(), "No host with running EVASERVER found. Please start one or \nadd the correct address to the properties list.", "EvA2 Information", 1);
JOptionPane.showMessageDialog(m_Frame.getContentPane(), "No host with running EVASERVER found. Please start one or \nadd the correct address to the properties list.", infoTitle, 1);
}
/**

View File

@ -431,7 +431,8 @@ public class BeanInspector {
continue;
}
StringBuffer memberInfoBf = new StringBuffer("Member:\t");
StringBuffer memberInfoBf = new StringBuffer(40);
memberInfoBf.append("Member:\t");
memberInfoBf.append(name);
memberInfoBf.append("\tType: ");
@ -530,7 +531,7 @@ public class BeanInspector {
public static Object doubleToPrimitive(Double d, Class<?> destType) {
if ((destType == Double.class) || (destType == double.class)) return d;
if ((destType == Integer.class) || (destType == int.class)) return new Integer(d.intValue());
else if ((destType == Boolean.class) || (destType == boolean.class)) return new Boolean(d != 0);
else if ((destType == Boolean.class) || (destType == boolean.class)) return (d!=0) ? Boolean.TRUE : Boolean.FALSE;
else if ((destType == Byte.class) || (destType == byte.class)) return new Byte(d.byteValue());
else if ((destType == Short.class) || (destType == short.class)) return new Short(d.shortValue());
else if ((destType == Long.class) || (destType == long.class)) return new Long(d.longValue());

View File

@ -121,9 +121,9 @@ public class PropertyRemoteServers implements java.io.Serializable {
*/
public String[] getServerNodes() {
String[] result;
ArrayList tmpList = new ArrayList();
ArrayList<String> tmpList = new ArrayList<String>();
for (int i = 0; i < this.m_AvailableNodes.length; i++) {
for (int j = 0; j < this.m_AvailableNodes[i].m_CPUs; i++) {
for (int j = 0; j < this.m_AvailableNodes[i].m_CPUs; j++) {
tmpList.add(this.m_AvailableNodes[i].m_ServerName);
}
}

View File

@ -25,6 +25,8 @@ import javax.swing.JProgressBar;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;
import wsi.ra.jproxy.ThreadProxy;
import wsi.ra.math.RNG;
import eva2.client.EvAClient;
import eva2.gui.JParaPanel;
import eva2.server.go.individuals.AbstractEAIndividual;
@ -42,12 +44,9 @@ import eva2.server.go.problems.F1Problem;
import eva2.server.go.strategies.EvolutionStrategies;
import eva2.server.go.strategies.GeneticAlgorithm;
import eva2.server.go.strategies.InterfaceOptimizer;
import eva2.server.go.tools.RandomNumberGenerator;
import eva2.server.modules.GOParameters;
import eva2.tools.TokenHolder;
import wsi.ra.jproxy.ThreadProxy;
/**
* Created by IntelliJ IDEA.
* User: streiche
@ -113,7 +112,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
this.m_GO = GOParameters.getInstance();
this.m_ExperimentName = this.m_GO.getOptimizer().getName()+"-"+this.m_PerformedRuns.size();
this.m_GO.addPopulationChangedEventListener(this);
RandomNumberGenerator.setRandomSeed(m_GO.getSeed());
RNG.setRandomSeed(m_GO.getSeed());
}
/** This method allows you to get the current GO parameters
@ -370,7 +369,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
this.m_GO.saveInstance();
if (this.show) this.m_StatusField.setText("Optimizing...");
RandomNumberGenerator.setRandomSeed(m_GO.getSeed());
RNG.setRandomSeed(m_GO.getSeed());
// opening output file...
if (!this.m_OutputFileName.equalsIgnoreCase("none")) {
String name = "";
@ -541,7 +540,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
app.setShow(false);
} else {
GOStandaloneVersion program = new GOStandaloneVersion();
RandomNumberGenerator.setRandomSeed(1);
RNG.setRandomSeed(1);
program.initFrame();
program.setShow(true);
}
@ -646,10 +645,10 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
*/
// MK: These methods have nothing to do with the seed parameter from the m_GO object which is actually used, so I comment them out
// public void setSeed(long seed) {
// RandomNumberGenerator.setseed(seed);
// RNG.setseed(seed);
// }
// public long getSeed() {
// return RandomNumberGenerator.getRandomSeed();
// return RNG.getRandomSeed();
// }
// public String seedTipText() {
// return "Choose the seed for the random number generator.";

View File

@ -6,6 +6,7 @@ import java.util.BitSet;
import java.util.LinkedList;
import java.util.List;
import wsi.ra.math.RNG;
import eva2.gui.BeanInspector;
import eva2.server.go.IndividualInterface;
import eva2.server.go.individuals.codings.gp.InterfaceProgram;
@ -16,8 +17,6 @@ import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.NoMutation;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.GONamingBox;
import eva2.server.go.tools.RandomNumberGenerator;
/** This is the abstract EA individual implementing the most important methods giving
* access to mutation and crossover rates and operators, fitness values and selection
@ -243,7 +242,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
/** This method will mutate the individual randomly
*/
public void mutate() {
if (RandomNumberGenerator.flipCoin(this.m_MutationProbability)) this.m_MutationOperator.mutate(this);
if (RNG.flipCoin(this.m_MutationProbability)) this.m_MutationOperator.mutate(this);
}
/**
@ -257,7 +256,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
*/
public AbstractEAIndividual[] mateWith(Population partners) {
AbstractEAIndividual[] result;
if (RandomNumberGenerator.flipCoin(this.m_CrossoverProbability)) {
if (RNG.flipCoin(this.m_CrossoverProbability)) {
result = this.m_CrossoverOperator.mate(this, partners);
if (logParentLen > 0) {
for (int i = 0; i < result.length; i++) {

View File

@ -2,12 +2,11 @@ package eva2.server.go.individuals;
import java.util.BitSet;
import eva2.server.go.IndividualInterface;
import wsi.ra.math.RNG;
import eva2.server.go.operators.crossover.CrossoverESDefault;
import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.MutateESGlobal;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
/** This individual uses a real-valued genotype to code for binary values, either
@ -127,7 +126,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
} else {
// in this case the value of the genotype is interpreted as a probability
for (int i = 0; i < this.m_Genotype.length; i++) {
if (RandomNumberGenerator.flipCoin(this.m_Genotype[i])) {
if (RNG.flipCoin(this.m_Genotype[i])) {
this.m_Phenotype.set(i);
} else {
this.m_Phenotype.clear(i);
@ -159,8 +158,8 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
this.SetBinaryData(binaryData);
for (int i = 0; i < this.m_Genotype.length; i++) {
if (this.m_UseHardSwitch) {
if (binaryData.get(i)) this.m_Genotype[i] = RandomNumberGenerator.randomDouble(0.55,1.0);
else this.m_Genotype[i] = RandomNumberGenerator.randomDouble(0.0,0.45);
if (binaryData.get(i)) this.m_Genotype[i] = RNG.randomDouble(0.55,1.0);
else this.m_Genotype[i] = RNG.randomDouble(0.0,0.45);
} else {
if (binaryData.get(i)) this.m_Genotype[i] = 0.9;
else this.m_Genotype[i] = 0.1;
@ -258,8 +257,8 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method performs a simple one element mutation on the double vector
*/
public void defaultMutate() {
int mutationIndex = RandomNumberGenerator.randomInt(0, this.m_Genotype.length-1);
this.m_Genotype[mutationIndex] += ((this.m_Range[mutationIndex][1] - this.m_Range[mutationIndex][0])/2)*RandomNumberGenerator.gaussianDouble(0.05f);
int mutationIndex = RNG.randomInt(0, this.m_Genotype.length-1);
this.m_Genotype[mutationIndex] += ((this.m_Range[mutationIndex][1] - this.m_Range[mutationIndex][0])/2)*RNG.gaussianDouble(0.05f);
if (this.m_Genotype[mutationIndex] < this.m_Range[mutationIndex][0]) this.m_Genotype[mutationIndex] = this.m_Range[mutationIndex][0];
if (this.m_Genotype[mutationIndex] > this.m_Range[mutationIndex][1]) this.m_Genotype[mutationIndex] = this.m_Range[mutationIndex][1];
}
@ -268,7 +267,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
*/
public void defaultInit() {
for (int i = 0; i < this.m_Genotype.length; i++) {
this.m_Genotype[i] = RandomNumberGenerator.randomDouble(this.m_Range[i][0], this.m_Range[i][1]);
this.m_Genotype[i] = RNG.randomDouble(this.m_Range[i][0], this.m_Range[i][1]);
}
}
/**********************************************************************************************************************

View File

@ -8,7 +8,7 @@ import eva2.server.go.operators.crossover.CrossoverESDefault;
import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.MutateESGlobal;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This individual uses a real-valued genotype to code for double values.
* Created by IntelliJ IDEA.
@ -279,8 +279,8 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method performs a simple one element mutation on the double vector
*/
public void defaultMutate() {
int mutationIndex = RandomNumberGenerator.randomInt(0, this.m_Genotype.length-1);
this.m_Genotype[mutationIndex] += ((this.m_Range[mutationIndex][1] - this.m_Range[mutationIndex][0])/2)*RandomNumberGenerator.gaussianDouble(0.05f);
int mutationIndex = RNG.randomInt(0, this.m_Genotype.length-1);
this.m_Genotype[mutationIndex] += ((this.m_Range[mutationIndex][1] - this.m_Range[mutationIndex][0])/2)*RNG.gaussianDouble(0.05f);
if (this.m_Genotype[mutationIndex] < this.m_Range[mutationIndex][0]) this.m_Genotype[mutationIndex] = this.m_Range[mutationIndex][0];
if (this.m_Genotype[mutationIndex] > this.m_Range[mutationIndex][1]) this.m_Genotype[mutationIndex] = this.m_Range[mutationIndex][1];
}
@ -289,7 +289,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
*/
public void defaultInit() {
for (int i = 0; i < this.m_Genotype.length; i++) {
this.m_Genotype[i] = RandomNumberGenerator.randomDouble(this.m_Range[i][0], this.m_Range[i][1]);
this.m_Genotype[i] = RNG.randomDouble(this.m_Range[i][0], this.m_Range[i][1]);
}
}

View File

@ -8,7 +8,7 @@ import eva2.server.go.operators.crossover.CrossoverESDefault;
import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.MutateESGlobal;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This individual uses a real-valued genotype to code for integer values.
* Created by IntelliJ IDEA.
@ -255,8 +255,8 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method performs a simple one element mutation on the double vector
*/
public void defaultMutate() {
int mutationIndex = RandomNumberGenerator.randomInt(0, this.m_Genotype.length-1);
this.m_Genotype[mutationIndex] += ((this.m_Range[mutationIndex][1] - this.m_Range[mutationIndex][0])/2)*RandomNumberGenerator.gaussianDouble(0.05f);
int mutationIndex = RNG.randomInt(0, this.m_Genotype.length-1);
this.m_Genotype[mutationIndex] += ((this.m_Range[mutationIndex][1] - this.m_Range[mutationIndex][0])/2)*RNG.gaussianDouble(0.05f);
if (this.m_Genotype[mutationIndex] < this.m_Range[mutationIndex][0]) this.m_Genotype[mutationIndex] = this.m_Range[mutationIndex][0];
if (this.m_Genotype[mutationIndex] > this.m_Range[mutationIndex][1]) this.m_Genotype[mutationIndex] = this.m_Range[mutationIndex][1];
}
@ -277,7 +277,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
*/
public void defaultInit() {
for (int i = 0; i < this.m_Genotype.length; i++) {
this.m_Genotype[i] = RandomNumberGenerator.randomInt(this.m_Range[i][0], this.m_Range[i][1]);
this.m_Genotype[i] = RNG.randomInt(this.m_Range[i][0], this.m_Range[i][1]);
}
}
/**********************************************************************************************************************

View File

@ -5,7 +5,7 @@ import eva2.server.go.operators.crossover.CrossoverESDefault;
import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.MutateESGlobal;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This individual uses a real-valued genotype to code for a permutations,
* the sorting of the real-valued genotype gives the permutation.
@ -180,7 +180,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
for (int j = 0; j < this.m_Genotype[p].length; j++) {
if ((i != j) && (this.m_Genotype[p][i] == this.m_Genotype[p][j])) {
notValid = true;
this.m_Genotype[p][j] = RandomNumberGenerator.randomDouble(0, 1);
this.m_Genotype[p][j] = RNG.randomDouble(0, 1);
}
}
}
@ -320,8 +320,8 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
*/
public void defaultMutate() {
for (int i = 0; i < m_Genotype.length; i++) {
int mutationIndex = RandomNumberGenerator.randomInt(0, this.m_Genotype[i].length-1);
this.m_Genotype[i][mutationIndex] += ((this.m_Range[i][mutationIndex][1] - this.m_Range[i][mutationIndex][0])/2)*RandomNumberGenerator.gaussianDouble(0.05f);
int mutationIndex = RNG.randomInt(0, this.m_Genotype[i].length-1);
this.m_Genotype[i][mutationIndex] += ((this.m_Range[i][mutationIndex][1] - this.m_Range[i][mutationIndex][0])/2)*RNG.gaussianDouble(0.05f);
if (this.m_Genotype[i][mutationIndex] < this.m_Range[i][mutationIndex][0]) this.m_Genotype[i][mutationIndex] = this.m_Range[i][mutationIndex][0];
if (this.m_Genotype[i][mutationIndex] > this.m_Range[i][mutationIndex][1]) this.m_Genotype[i][mutationIndex] = this.m_Range[i][mutationIndex][1];
}
@ -333,7 +333,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
public void defaultInit() {
for (int i = 0; i < this.m_Genotype.length; i++) {
for (int j = 0; j < this.m_Genotype[i].length; j++) {
this.m_Genotype[i][j] = RandomNumberGenerator.randomDouble(this.m_Range[i][j][0], this.m_Range[i][j][1]);
this.m_Genotype[i][j] = RNG.randomDouble(this.m_Range[i][j][0], this.m_Range[i][j][1]);
}
}
}

View File

@ -6,7 +6,7 @@ import java.util.BitSet;
import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This individual combines a binary and a real-valued phenotype.
* Created by IntelliJ IDEA.
@ -99,8 +99,8 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
/** This method will mutate the individual randomly
*/
public void mutate() {
if (RandomNumberGenerator.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Numbers).mutate();
if (RandomNumberGenerator.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_BitSet).mutate();
if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Numbers).mutate();
if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_BitSet).mutate();
}
/** This method will mate the Individual with given other individuals
@ -110,7 +110,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
*/
public AbstractEAIndividual[] mateWith(Population partners) {
AbstractEAIndividual[] result;
if (RandomNumberGenerator.flipCoin(this.m_CrossoverProbability)) {
if (RNG.flipCoin(this.m_CrossoverProbability)) {
AbstractEAIndividual[] resNum, resBin;
AbstractEAIndividual numTmp, binTmp;
Population numPop, binPop;

View File

@ -12,7 +12,7 @@ import eva2.server.go.operators.mutation.MutateGADefault;
import eva2.server.go.operators.mutation.MutateGAStandard;
import eva2.server.go.operators.mutation.NoMutation;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This individual uses a binary genotype to code for binary values.
* Created by IntelliJ IDEA.
@ -183,7 +183,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
*/
public void defaultInit() {
for (int i = 0; i < this.m_GenotypeLength; i++) {
if (RandomNumberGenerator.flipCoin(0.5)) this.m_Genotype.set(i);
if (RNG.flipCoin(0.5)) this.m_Genotype.set(i);
else this.m_Genotype.clear(i);
}
}
@ -191,7 +191,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method performs a simple one point mutation in the genotype
*/
public void defaultMutate() {
int mutationIndex = RandomNumberGenerator.randomInt(0, this.m_GenotypeLength);
int mutationIndex = RNG.randomInt(0, this.m_GenotypeLength);
//if (mutationIndex > 28) System.out.println("Mutate: " + this.getSolutionRepresentationFor());
if (this.m_Genotype.get(mutationIndex)) this.m_Genotype.clear(mutationIndex);
else this.m_Genotype.set(mutationIndex);

View File

@ -12,7 +12,7 @@ import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.MutateGADefault;
import eva2.server.go.operators.mutation.MutateGAStandard;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This individual uses a binary genotype to code for double values
* using two alternative encodings.
@ -296,7 +296,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
*/
public void defaultInit() {
for (int i = 0; i < this.m_GenotypeLength; i++) {
if (RandomNumberGenerator.flipCoin(0.5)) this.m_Genotype.set(i);
if (RNG.flipCoin(0.5)) this.m_Genotype.set(i);
else this.m_Genotype.clear(i);
}
}
@ -304,7 +304,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method performs a simple one point mutation in the genotype
*/
public void defaultMutate() {
int mutationIndex = RandomNumberGenerator.randomInt(0, this.m_GenotypeLength);
int mutationIndex = RNG.randomInt(0, this.m_GenotypeLength);
if (this.m_Genotype.get(mutationIndex)) this.m_Genotype.clear(mutationIndex);
else this.m_Genotype.set(mutationIndex);
}

View File

@ -11,7 +11,7 @@ import eva2.server.go.operators.crossover.CrossoverGANPoint;
import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.MutateGAStandard;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This individual uses a binary genotype to code for binary values using
* two alternative encodings.
@ -313,7 +313,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
int overallLength = 0;
for (int i = 0; i < this.m_CodingLenghts.length; i++) overallLength += this.m_CodingLenghts[i];
for (int i = 0; i < overallLength; i++) {
if (RandomNumberGenerator.flipCoin(0.5)) this.m_Genotype.set(i);
if (RNG.flipCoin(0.5)) this.m_Genotype.set(i);
else this.m_Genotype.clear(i);
}
}
@ -323,7 +323,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
public void defaultMutate() {
int overallLength = 0;
for (int i = 0; i < this.m_CodingLenghts.length; i++) overallLength += this.m_CodingLenghts[i];
int mutationIndex = RandomNumberGenerator.randomInt(0, overallLength);
int mutationIndex = RNG.randomInt(0, overallLength);
if (this.m_Genotype.get(mutationIndex)) this.m_Genotype.clear(mutationIndex);
else this.m_Genotype.set(mutationIndex);
}
@ -350,7 +350,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
System.out.println(tmp+"}");
tmp = "Setting {";
for (int i = 0; i < data.length; i++) {
data[i] = RandomNumberGenerator.randomInt(range[i][0], range[i][1]);
data[i] = RNG.randomInt(range[i][0], range[i][1]);
tmp += data[i] + "; ";
}
System.out.println(tmp+"}");

View File

@ -14,7 +14,7 @@ import eva2.server.go.operators.mutation.MutateESDefault;
import eva2.server.go.operators.mutation.MutateGPDefault;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This individual combines a real-valued phenotype with a tree-based phenotype.
* Created by IntelliJ IDEA.
@ -107,8 +107,8 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method will mutate the individual randomly
*/
public void mutate() {
if (RandomNumberGenerator.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Numbers).mutate();
if (RandomNumberGenerator.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Program).mutate();
if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Numbers).mutate();
if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Program).mutate();
}
/** This method will mate the Individual with given other individuals
@ -118,7 +118,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
*/
public AbstractEAIndividual[] mateWith(Population partners) {
AbstractEAIndividual[] result;
if (RandomNumberGenerator.flipCoin(this.m_CrossoverProbability)) {
if (RNG.flipCoin(this.m_CrossoverProbability)) {
AbstractEAIndividual[] resNum, resBin;
AbstractEAIndividual numTmp, binTmp;
Population numPop, binPop;

View File

@ -11,7 +11,7 @@ import eva2.server.go.operators.crossover.CrossoverGADefault;
import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.MutateGADefault;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This individual uses a binary genotype to code for a tree-based representation
* using a BNF grammar, see also Grammatical Evolution.
@ -578,7 +578,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
*/
public void defaultInit() {
for (int i = 0; i < this.m_GenotypeLengthPerProgram*this.m_Area.length; i++) {
if (RandomNumberGenerator.flipCoin(0.5)) this.m_Genotype.set(i);
if (RNG.flipCoin(0.5)) this.m_Genotype.set(i);
else this.m_Genotype.clear(i);
}
}
@ -586,7 +586,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
/** This method performs a simple one point mutation in the genotype
*/
public void defaultMutate() {
int mutationIndex = RandomNumberGenerator.randomInt(0, this.m_GenotypeLengthPerProgram*this.m_Area.length);
int mutationIndex = RNG.randomInt(0, this.m_GenotypeLengthPerProgram*this.m_Area.length);
//if (mutationIndex > 28) System.out.println("Mutate: " + this.getSolutionRepresentationFor());
if (this.m_Genotype.get(mutationIndex)) this.m_Genotype.clear(mutationIndex);
else this.m_Genotype.set(mutationIndex);

View File

@ -4,7 +4,7 @@ import eva2.server.go.operators.crossover.CrossoverGIDefault;
import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.MutateGIDefault;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This individual uses a integer genotype to code for integer values.
* Created by IntelliJ IDEA.
@ -275,15 +275,15 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method performs a simple one point mutation in the genotype
*/
public void defaultMutate() {
int mutationIndex = RandomNumberGenerator.randomInt(0, this.m_Genotype.length-1);
this.m_Genotype[mutationIndex] = RandomNumberGenerator.randomInt(this.m_Range[mutationIndex][0], this.m_Range[mutationIndex][1]);
int mutationIndex = RNG.randomInt(0, this.m_Genotype.length-1);
this.m_Genotype[mutationIndex] = RNG.randomInt(this.m_Range[mutationIndex][0], this.m_Range[mutationIndex][1]);
}
/** This method initializes the GA genotype randomly
*/
public void defaultInit() {
for (int i = 0; i < this.m_Genotype.length; i++) {
this.m_Genotype[i] = RandomNumberGenerator.randomInt(this.m_Range[i][0], this.m_Range[i][1]);
this.m_Genotype[i] = RNG.randomInt(this.m_Range[i][0], this.m_Range[i][1]);
}
}

View File

@ -6,7 +6,7 @@ import java.util.BitSet;
import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This individual combines a binary and a real-valued phenotype.
* Created by IntelliJ IDEA.
@ -99,8 +99,8 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** This method will mutate the individual randomly
*/
public void mutate() {
if (RandomNumberGenerator.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Integer).mutate();
if (RandomNumberGenerator.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Permutation).mutate();
if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Integer).mutate();
if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Permutation).mutate();
}
/** This method will mate the Individual with given other individuals
@ -110,7 +110,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
*/
public AbstractEAIndividual[] mateWith(Population partners) {
AbstractEAIndividual[] result;
if (RandomNumberGenerator.flipCoin(this.m_CrossoverProbability)) {
if (RNG.flipCoin(this.m_CrossoverProbability)) {
AbstractEAIndividual[] resNum, resBin;
AbstractEAIndividual numTmp, binTmp;
Population numPop, binPop;

View File

@ -10,7 +10,7 @@ import eva2.server.go.operators.crossover.CrossoverGPDefault;
import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.MutateGPDefault;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
import eva2.tools.EVAERROR;
import eva2.tools.EVAHELP;
@ -270,7 +270,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
ArrayList allNodes = new ArrayList();
for (int i = 0; i < this.m_Genotype.length; i++) {
this.m_Genotype[i].addNodesTo(allNodes);
AbstractGPNode nodeToMutate = (AbstractGPNode) allNodes.get(RandomNumberGenerator.randomInt(0, allNodes.size()-1));
AbstractGPNode nodeToMutate = (AbstractGPNode) allNodes.get(RNG.randomInt(0, allNodes.size()-1));
if (nodeToMutate.getParent() == null) {
this.defaultInit();
} else {
@ -292,8 +292,8 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
} else {
this.m_Genotype[i] = (AbstractGPNode)(this.m_Area[i].getRandomNonTerminal()).clone();
this.m_Genotype[i].setDepth(0);
int targetDepth = RandomNumberGenerator.randomInt(1, this.m_InitDepth);
if (RandomNumberGenerator.flipCoin(this.m_InitFullGrowRatio))
int targetDepth = RNG.randomInt(1, this.m_InitDepth);
if (RNG.flipCoin(this.m_InitFullGrowRatio))
this.m_Genotype[i].initFull(this.m_Area[i], targetDepth);
else
this.m_Genotype[i].initGrow(this.m_Area[i], targetDepth);

View File

@ -7,7 +7,7 @@ import eva2.server.go.operators.crossover.CrossoverOBGAPMX;
import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.MutateOBGAFlip;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This individual uses a permutation based genotype to code for
* permutations.
@ -170,8 +170,8 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
int[][] permmatrix = this.getPermutationData();
for (int i = 0; i < permmatrix.length; i++) {
int[] perm = permmatrix[i];
int p1 = RandomNumberGenerator.randomInt(0,perm.length-1);
int p2 = RandomNumberGenerator.randomInt(0,perm.length-1);
int p1 = RNG.randomInt(0,perm.length-1);
int p2 = RNG.randomInt(0,perm.length-1);
int temp = perm[p1];
perm[p1] = perm[p2];
perm[p2] = temp;
@ -192,7 +192,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
}
int i = 0;
while (!pot.isEmpty()) {
perm[p][i] = ((Integer) (pot.remove(RandomNumberGenerator.randomInt(0, pot.size() - 1)))).intValue();
perm[p][i] = ((Integer) (pot.remove(RNG.randomInt(0, pot.size() - 1)))).intValue();
i++;
}
}

View File

@ -3,7 +3,7 @@ package eva2.server.go.individuals.codings.ga;
import java.util.BitSet;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This gives the gray coding for double with a variable number of bits for coding
* As far as i recall the least significant bit is to the left.
@ -86,7 +86,7 @@ public class GAGrayCodingDouble implements InterfaceGADoubleCoding, java.io.Seri
range[0] = -10;
range[1] = 10;
for (int i = 0; i < 10; i++) {
value = RandomNumberGenerator.randomDouble(range[0], range[1]);
value = RNG.randomDouble(range[0], range[1]);
tmp = value;
System.out.println("Coding Value : " + value);
t.codeValue(value, range, tmpBitSet, locus);

View File

@ -3,7 +3,7 @@ package eva2.server.go.individuals.codings.ga;
import java.util.BitSet;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** The traditional binary coding for integer number, no variable number of bits here, sorry.
* Created by IntelliJ IDEA.
@ -55,7 +55,7 @@ public class GAStandardCodingInteger implements InterfaceGAIntegerCoding, java.i
//System.out.print("Korregiere: " + tmpV + " > " + u_max);
if (correction) {
// a new value within the bounds is generated
tmpV = RandomNumberGenerator.randomInt(u_min, u_max);
tmpV = RNG.randomInt(u_min, u_max);
//System.out.println("zu: " + tmpV);
codeValue((int)tmpV, range, refBitSet, locus);
} else {

View File

@ -3,7 +3,7 @@ package eva2.server.go.individuals.codings.gp;
import java.util.ArrayList;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This class gives the area of GPNodes for a GP problem. The area gives
* the range of possible nodes to select from for a GP.
@ -114,14 +114,14 @@ public class GPArea implements java.io.Serializable {
if (((AbstractGPNode)this.m_ReducedList.get(i)).getArity() == targetarity) tmpArray.add(this.m_ReducedList.get(i));
}
if (tmpArray.size() == 0) return null;
else return (AbstractGPNode)tmpArray.get(RandomNumberGenerator.randomInt(0, tmpArray.size()-1));
else return (AbstractGPNode)tmpArray.get(RNG.randomInt(0, tmpArray.size()-1));
}
/** This method will return a random node.
*/
public AbstractGPNode getRandomNode() {
if (this.m_ReducedList.size() == 0) return null;
else return (AbstractGPNode)this.m_ReducedList.get(RandomNumberGenerator.randomInt(0, this.m_ReducedList.size()-1));
else return (AbstractGPNode)this.m_ReducedList.get(RNG.randomInt(0, this.m_ReducedList.size()-1));
}
/** This method will return a non terminal
@ -132,6 +132,6 @@ public class GPArea implements java.io.Serializable {
if (((AbstractGPNode)this.m_ReducedList.get(i)).getArity() > 0) tmpArray.add(this.m_ReducedList.get(i));
}
if (tmpArray.size() == 0) return null;
else return (AbstractGPNode)tmpArray.get(RandomNumberGenerator.randomInt(0, tmpArray.size()-1));
else return (AbstractGPNode)tmpArray.get(RNG.randomInt(0, tmpArray.size()-1));
}
}

View File

@ -13,7 +13,7 @@ import eva2.server.go.operators.moso.MOSOLpMetric;
import eva2.server.go.problems.AbstractMultiObjectiveOptimizationProblem;
import eva2.server.go.strategies.IslandModelEA;
import eva2.server.go.tools.GeneralGOEProperty;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
import java.awt.*;
import java.awt.event.ActionListener;
@ -235,7 +235,7 @@ public class MOCCOParameterizeRefPoint extends MOCCOPhase implements InterfacePr
for (int i = 0; i < m_Perturbations; i++) {
tmpD = new double[m_RefPoint.length];
for (int j = 0; j < tmpD.length; j++) {
if (i > 0) tmpD[j] = m_RefPoint[j] + RandomNumberGenerator.gaussianDouble(m_Perturbation);
if (i > 0) tmpD[j] = m_RefPoint[j] + RNG.gaussianDouble(m_Perturbation);
else tmpD[j] = m_RefPoint[j];
}
tmpLPs[i] = (MOSOLpMetric)m_LpMetric.clone();

View File

@ -13,7 +13,7 @@ import eva2.server.go.operators.moso.MOSOWeightedLPTchebycheff;
import eva2.server.go.problems.AbstractMultiObjectiveOptimizationProblem;
import eva2.server.go.strategies.IslandModelEA;
import eva2.server.go.tools.GeneralGOEProperty;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
import java.awt.*;
import java.awt.event.ActionListener;
@ -257,7 +257,7 @@ public class MOCCOParameterizeTchebycheff extends MOCCOPhase implements Interfac
u = l; l = t;
}
if (i > 0) tmpD[j] = RandomNumberGenerator.randomDouble(l,u);
if (i > 0) tmpD[j] = RNG.randomDouble(l,u);
else tmpD[j] = 1;
sum += tmpD[j];
}

View File

@ -8,7 +8,7 @@ import eva2.server.go.IndividualInterface;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.ESIndividualDoubleData;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
import wsi.ra.chart2d.DPoint;
import wsi.ra.chart2d.DPointIcon;

View File

@ -11,7 +11,7 @@ import eva2.gui.*;
import eva2.server.go.IndividualInterface;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** The Pareto envelope sorting algorithm using a hybergrid and
* the so called squezze factor.
@ -145,7 +145,7 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
bigSqueeze = squeezeFactor[i];
index = i;
}
if ((bigSqueeze == squeezeFactor[i]) && RandomNumberGenerator.flipCoin(0.5)) index = i;
if ((bigSqueeze == squeezeFactor[i]) && RNG.flipCoin(0.5)) index = i;
}
archive.remove(index);
}

View File

@ -1,7 +1,7 @@
package eva2.server.go.operators.archiving;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This information retrieval method simply add the retrieved solutions
* to the current population.
@ -34,7 +34,7 @@ public class InformationRetrievalReplacing implements InterfaceInformationRetrie
tmp.addPopulation(archive);
while (tmp.size() < archive.getPopulationSize()) {
tmp.add(pop.get(RandomNumberGenerator.randomInt(0,pop.size()-1)));
tmp.add(pop.get(RNG.randomInt(0,pop.size()-1)));
}
pop.clear();

View File

@ -2,7 +2,7 @@ package eva2.server.go.operators.archiving;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This class removes surplus individuals based on bounding
* hybercube, which can be calculated in objective or decision
@ -50,7 +50,7 @@ public class RemoveSurplusIndividualsDynamicHyperCube implements InterfaceRemove
if (space[i] < space[indexSmallHyperCube]) indexSmallHyperCube = i;
else {
// if they are equal give them a fair chance to exchange between them
if ((space[i] == space[indexSmallHyperCube]) && (RandomNumberGenerator.flipCoin(0.5))) {
if ((space[i] == space[indexSmallHyperCube]) && (RNG.flipCoin(0.5))) {
indexSmallHyperCube = i;
}
}

View File

@ -2,7 +2,7 @@ package eva2.server.go.operators.archiving;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This class removes surplus individuals based on bounding
* hybercube, which can be calculated in objective or decision
@ -59,7 +59,7 @@ public class RemoveSurplusIndividualsStaticHyperCube extends RemoveSurplusIndivi
indexSmallHyperCube = i;
} else {
// if they are equal give them a fair chance to exchange between them
if ((tmpS == smallestHyperCube) && (RandomNumberGenerator.flipCoin(0.5))) {
if ((tmpS == smallestHyperCube) && (RNG.flipCoin(0.5))) {
smallestHyperCube = tmpS;
indexSmallHyperCube = i;
}

View File

@ -3,7 +3,7 @@ package eva2.server.go.operators.classification;
import javax.swing.*;
import eva2.gui.Chart2DDPointIconCross;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
import wsi.ra.chart2d.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
@ -124,7 +124,7 @@ public class ClassificationSelfOrganizingMaps implements java.io.Serializable, I
for (int i = 0; i < this.m_SOM.length; i++) {
for (int j = 0; j < this.m_SOM[0].length; j++) {
for (int k = 0; k < this.m_SOM[0][0].length; k++) {
this.m_SOM[i][j][k] = 0*RandomNumberGenerator.randomDouble(
this.m_SOM[i][j][k] = 0*RNG.randomDouble(
(this.m_Range[k][0] - this.m_Range[k][2])/(1+this.m_Range[k][3]),
(this.m_Range[k][1] - this.m_Range[k][2])/(1+this.m_Range[k][3]));
}
@ -155,7 +155,7 @@ public class ClassificationSelfOrganizingMaps implements java.io.Serializable, I
int[] winner;
for (int t = 0; t < this.m_TrainingCycles; t++) {
// train the full set
order = RandomNumberGenerator.randomPermutation(space.length);
order = RNG.randomPermutation(space.length);
for (int i = 0; i < order.length; i++) {
winner = this.findWinningNeuron(space[order[i]]);
// now i got the winning neuron *puh*
@ -453,11 +453,11 @@ public class ClassificationSelfOrganizingMaps implements java.io.Serializable, I
double[][] data = new double[num*2][2];
int[] type = new int[num*2];
for (int i = 0; i < num; i++) {
data[i][0] = -0.8 + RandomNumberGenerator.gaussianDouble(0.3);
data[i][1] = -0.5 + RandomNumberGenerator.gaussianDouble(0.1);
data[i][0] = -0.8 + RNG.gaussianDouble(0.3);
data[i][1] = -0.5 + RNG.gaussianDouble(0.1);
type[i] = 0;
data[i+num][0] = 0.1 + RandomNumberGenerator.gaussianDouble(0.1);
data[i+num][1] = 0.2 + RandomNumberGenerator.gaussianDouble(0.1);
data[i+num][0] = 0.1 + RNG.gaussianDouble(0.1);
data[i+num][1] = 0.2 + RNG.gaussianDouble(0.1);
type[i+num] = 1;
}
som.init(data, type);

View File

@ -9,7 +9,7 @@ import eva2.server.go.individuals.ESIndividualDoubleData;
import eva2.server.go.individuals.InterfaceDataTypeDouble;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.F1Problem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
import wsi.ra.chart2d.DPoint;
/** The k-mean clustering algorithms. I guess it is not a hierachical
@ -65,7 +65,7 @@ public class ClusteringKMeans implements InterfaceClustering, java.io.Serializab
this.m_C = new double[this.m_K][];
// now choose random initial Cs
for (int i = 0; i < this.m_C.length; i++) {
this.m_C[i] = data[RandomNumberGenerator.randomInt(0, data.length-1)];
this.m_C[i] = data[RNG.randomInt(0, data.length-1)];
//this.m_C[i] = data[i]; // This works!!
// we won't check for double instances assuming that double instances
// will be ironed out during clustering and to prevent infinite loops

View File

@ -9,7 +9,7 @@ import eva2.server.go.individuals.ESIndividualDoubleData;
import eva2.server.go.individuals.InterfaceDataTypeDouble;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.F1Problem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
import wsi.ra.chart2d.DPoint;
/** The x-means clustering method should be able to determine a
@ -285,28 +285,28 @@ public class ClusteringXMeans implements InterfaceClustering, java.io.Serializab
x = ((InterfaceDataTypeDouble)pop.get(i)).getDoubleData();
switch (i%k) {
case 0 : {
x[0] = 0 + RandomNumberGenerator.gaussianDouble(1.2);
x[1] = -1 + RandomNumberGenerator.gaussianDouble(1.5);
x[0] = 0 + RNG.gaussianDouble(1.2);
x[1] = -1 + RNG.gaussianDouble(1.5);
break;
}
case 1 : {
x[0] = 3 + RandomNumberGenerator.gaussianDouble(1.8);
x[1] = 8 + RandomNumberGenerator.gaussianDouble(0.9);
x[0] = 3 + RNG.gaussianDouble(1.8);
x[1] = 8 + RNG.gaussianDouble(0.9);
break;
}
case 2 : {
x[0] = -4 + RandomNumberGenerator.gaussianDouble(1.2);
x[1] = -8 + RandomNumberGenerator.gaussianDouble(1.2);
x[0] = -4 + RNG.gaussianDouble(1.2);
x[1] = -8 + RNG.gaussianDouble(1.2);
break;
}
case 3 : {
x[0] = 7 + RandomNumberGenerator.gaussianDouble(1.1);
x[1] = -5 + RandomNumberGenerator.gaussianDouble(1.0);
x[0] = 7 + RNG.gaussianDouble(1.1);
x[1] = -5 + RNG.gaussianDouble(1.0);
break;
}
default : {
x[0] = -2 + RandomNumberGenerator.gaussianDouble(1.2);
x[1] = 5 + RandomNumberGenerator.gaussianDouble(1.2);
x[0] = -2 + RNG.gaussianDouble(1.2);
x[1] = 5 + RNG.gaussianDouble(1.2);
}
}
if (i == 0) {

View File

@ -6,7 +6,7 @@ import eva2.gui.GenericObjectEditor;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
@ -119,7 +119,7 @@ public class CrossoverEAMixer implements InterfaceCrossover, java.io.Serializabl
double[] probs = this.m_Crossers.getWeights();
if (this.m_UseSelfAdaption) {
for (int i = 0; i < probs.length; i++) {
probs[i] = probs[i] * Math.exp(this.m_Tau1 * RandomNumberGenerator.gaussianDouble(1));
probs[i] = probs[i] * Math.exp(this.m_Tau1 * RNG.gaussianDouble(1));
if (probs[i] <= this.m_LowerLimitChance) probs[i] = this.m_LowerLimitChance;
if (probs[i] >= 1) probs[i] = 1;
}
@ -127,14 +127,14 @@ public class CrossoverEAMixer implements InterfaceCrossover, java.io.Serializabl
}
InterfaceCrossover[] crossover = this.m_Crossers.getSelectedCrossers();
double pointer = RandomNumberGenerator.randomFloat(0, 1);
double pointer = RNG.randomFloat(0, 1);
double dum = probs[0];
int index = 0;
while ((pointer > dum) && (index < probs.length-1)) {
index++;
dum += probs[index];
}
if (index == probs.length) index = RandomNumberGenerator.randomInt(0, probs.length-1);
if (index == probs.length) index = RNG.randomInt(0, probs.length-1);
// System.out.println("Using : " + mutators[index].getStringRepresentation());
// for (int i = 0; i < probs.length; i++) {
// System.out.println(""+mutators[i].getStringRepresentation()+" : "+ probs[i]);

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -61,7 +61,7 @@ public class CrossoverESArithmetical implements InterfaceCrossover, java.io.Seri
for (int i = 0; i < children.length; i++) {
sum = 0;
for (int j = 0; j < alpha.length; j++) {
alpha[j] = RandomNumberGenerator.randomDouble(0,1);
alpha[j] = RNG.randomDouble(0,1);
sum += alpha[j];
}
for (int j = 0; j <alpha.length; j++) alpha[j] = alpha[j]/sum;

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -71,7 +71,7 @@ public class CrossoverESBLXAlpha implements InterfaceCrossover, java.io.Serializ
for (int i = 0; i < children.length; i++) {
for(int j = 0; j < children[i].length; j++) {
I = (extremeValues[j][1] - extremeValues[j][0])*this.m_Alpha;
children[i][j] = RandomNumberGenerator.randomDouble(extremeValues[j][0]-I, extremeValues[j][1]+I);
children[i][j] = RNG.randomDouble(extremeValues[j][0]-I, extremeValues[j][1]+I);
}
}
// write the result back

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -48,8 +48,8 @@ public class CrossoverESDefault implements InterfaceCrossover, java.io.Serializa
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
if ((indy1 instanceof InterfaceESIndividual) && (partners.get(0) instanceof InterfaceESIndividual)) {
int crossoverpoint = RandomNumberGenerator.randomInt(0,((InterfaceESIndividual)indy1).getDGenotype().length-1);
boolean switcher = RandomNumberGenerator.randomBoolean();
int crossoverpoint = RNG.randomInt(0,((InterfaceESIndividual)indy1).getDGenotype().length-1);
boolean switcher = RNG.randomBoolean();
parents = new double[result.length][];
children = new double[result.length][];
for (int i = 0; i < result.length; i++) {

View File

@ -8,7 +8,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -71,7 +71,7 @@ public class CrossoverESFlat implements InterfaceCrossover, java.io.Serializable
for (int i = 0; i < children.length; i++) {
for(int j = 0; j < children[i].length; j++) {
children[i][j] = RandomNumberGenerator.randomDouble(extremeValues[j][0], extremeValues[j][1]);
children[i][j] = RNG.randomDouble(extremeValues[j][0], extremeValues[j][1]);
}
}
// write the result back

View File

@ -1,10 +1,10 @@
package eva2.server.go.operators.crossover;
import wsi.ra.math.RNG;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
/**
* Created by IntelliJ IDEA.
@ -51,7 +51,7 @@ public class CrossoverESNPointDiscrete implements InterfaceCrossover, java.io.Se
if ((indy1 instanceof InterfaceESIndividual) && (partners.get(0) instanceof InterfaceESIndividual)) {
int length = ((InterfaceESIndividual)result[0]).getDGenotype().length;
int mixer = RandomNumberGenerator.randomInt(0, partners.size());
int mixer = RNG.randomInt(0, partners.size());
int[] crossoverPoints = new int[this.m_NumberOfCrossovers];
parents = new double[partners.size()+1][];
children = new double[partners.size()+1][];
@ -62,7 +62,7 @@ public class CrossoverESNPointDiscrete implements InterfaceCrossover, java.io.Se
System.arraycopy(((InterfaceESIndividual)result[i]).getDGenotype(), 0, children[i], 0, parents[i].length);
}
for (int i = 0; i < this.m_NumberOfCrossovers; i++) {
crossoverPoints[i] = RandomNumberGenerator.randomInt(0, length-1);
crossoverPoints[i] = RNG.randomInt(0, length-1);
}
for (int i = 0; i < length; i++) {
for (int j = 0; j < this.m_NumberOfCrossovers; j++) {

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -51,7 +51,7 @@ public class CrossoverESNPointDiscreteDislocation implements InterfaceCrossover,
if ((indy1 instanceof InterfaceESIndividual) && (partners.get(0) instanceof InterfaceESIndividual)) {
int length = ((InterfaceESIndividual)result[0]).getDGenotype().length;
int mixer = RandomNumberGenerator.randomInt(0, partners.size());
int mixer = RNG.randomInt(0, partners.size());
int[] crossoverPoints = new int[this.m_NumberOfCrossovers+1];
parents = new double[partners.size()+1][];
children = new double[partners.size()+1][];
@ -62,9 +62,9 @@ public class CrossoverESNPointDiscreteDislocation implements InterfaceCrossover,
System.arraycopy(((InterfaceESIndividual)result[i]).getDGenotype(), 0, children[i], 0, parents[i].length);
}
for (int i = 0; i < crossoverPoints.length; i++) {
crossoverPoints[i] = RandomNumberGenerator.randomInt(0, length-1);
crossoverPoints[i] = RNG.randomInt(0, length-1);
}
crossoverPoints[RandomNumberGenerator.randomInt(0,this.m_NumberOfCrossovers)] = 0;
crossoverPoints[RNG.randomInt(0,this.m_NumberOfCrossovers)] = 0;
int parIndex = 0;
int chiIndex = 0;
boolean bol;

View File

@ -10,7 +10,7 @@ import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.F1Problem;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -97,12 +97,12 @@ public class CrossoverESPCX implements InterfaceCrossover, java.io.Serializable
// first the parent and the d
for (int j = 0; j < parents[i].length; j++) {
children[i][j] = parents[i][j];
children[i][j] += RandomNumberGenerator.gaussianDouble(this.m_Zeta)*tmpD[j];
children[i][j] += RNG.gaussianDouble(this.m_Zeta)*tmpD[j];
}
// then the other parents
for (int j = 1; j < subSpace.size(); j++) {
tmpD = (double[])subSpace.get(j);
w = RandomNumberGenerator.gaussianDouble(this.m_Zeta);
w = RNG.gaussianDouble(this.m_Zeta);
children[i] = this.addVector(children[i], this.scalarMultVector(w, tmpD));
}
}
@ -162,7 +162,7 @@ public class CrossoverESPCX implements InterfaceCrossover, java.io.Serializable
private double[] randomVector(int n) {
double[] result = new double[n];
for (int i = 0; i < result.length; i++) {
result[i] = RandomNumberGenerator.gaussianDouble(1);
result[i] = RNG.gaussianDouble(1);
}
return this.getNormalizedVector(result);
}
@ -287,7 +287,7 @@ public class CrossoverESPCX implements InterfaceCrossover, java.io.Serializable
F1Problem prob = new F1Problem();
int n = 2;
//RandomNumberGenerator.setseed(1);
//RNG.setseed(1);
// init individual
indy1 = new ESIndividualDoubleData();
double[][] range = new double[n][2];

View File

@ -7,7 +7,7 @@ import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.F1Problem;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -63,7 +63,7 @@ public class CrossoverESSBX implements InterfaceCrossover, java.io.Serializable
}
for (int i = 0; i < children[0].length; i++) {
u = RandomNumberGenerator.randomDouble(0,1);
u = RNG.randomDouble(0,1);
if (u <= 0.5) {
beta = Math.pow((2*u), 1/(this.m_Eta + 1));
} else {

View File

@ -10,7 +10,7 @@ import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.F1Problem;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -89,7 +89,7 @@ public class CrossoverESSPX implements InterfaceCrossover, java.io.Serializable
C = new double[Y.length][];
C[0] = this.nullVector(parents[0].length);
for (int j = 1; j < Y.length; j++) {
r = Math.pow(RandomNumberGenerator.randomDouble(0, 1), 1/((double)j));
r = Math.pow(RNG.randomDouble(0, 1), 1/((double)j));
C[j] = this.addVector(Y[j-1], C[j-1]);
C[j] = this.subVector(C[j], Y[j]);
C[j] = this.scalarMultVector(r, C[j]);
@ -187,7 +187,7 @@ public class CrossoverESSPX implements InterfaceCrossover, java.io.Serializable
F1Problem prob = new F1Problem();
int n = 2;
RandomNumberGenerator.setRandomSeed(1);
RNG.setRandomSeed(1);
// init individual
indy1 = new ESIndividualDoubleData();
double[][] range = new double[n][2];

View File

@ -10,7 +10,7 @@ import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.F1Problem;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -83,13 +83,13 @@ public class CrossoverESUNDX implements InterfaceCrossover, java.io.Serializable
// then the given coordinates
for (int j = 0; j < givenCoordinates.size(); j++) {
tmpD = (double[])givenCoordinates.get(j);
w = RandomNumberGenerator.gaussianDouble(this.m_Zeta);
w = RNG.gaussianDouble(this.m_Zeta);
children[i] = this.addVector(children[i], this.scalarMultVector(w, tmpD));
}
// now the missing stuff
for (int j = 0; j < missingCorrdinates.size(); j++) {
tmpD = (double[])missingCorrdinates.get(j);
w = RandomNumberGenerator.gaussianDouble(this.m_Eta);
w = RNG.gaussianDouble(this.m_Eta);
children[i] = this.addVector(children[i], this.scalarMultVector(w, tmpD));
}
}
@ -162,7 +162,7 @@ public class CrossoverESUNDX implements InterfaceCrossover, java.io.Serializable
private double[] randomVector(int n) {
double[] result = new double[n];
for (int i = 0; i < result.length; i++) {
result[i] = RandomNumberGenerator.gaussianDouble(1);
result[i] = RNG.gaussianDouble(1);
}
return this.getNormalizedVector(result);
}
@ -287,7 +287,7 @@ public class CrossoverESUNDX implements InterfaceCrossover, java.io.Serializable
F1Problem prob = new F1Problem();
int n = 2;
RandomNumberGenerator.setRandomSeed(1);
RNG.setRandomSeed(1);
// init individual
indy1 = new ESIndividualDoubleData();
double[][] range = new double[n][2];

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -49,7 +49,7 @@ public class CrossoverESUniformDiscrete implements InterfaceCrossover, java.io.S
if ((indy1 instanceof InterfaceESIndividual) && (partners.get(0) instanceof InterfaceESIndividual)) {
int length = ((InterfaceESIndividual)result[0]).getDGenotype().length;
int mixer = RandomNumberGenerator.randomInt(0, partners.size());
int mixer = RNG.randomInt(0, partners.size());
parents = new double[partners.size()+1][];
children = new double[partners.size()+1][];
@ -61,7 +61,7 @@ public class CrossoverESUniformDiscrete implements InterfaceCrossover, java.io.S
}
for (int i = 0; i < length; i++) {
mixer = RandomNumberGenerator.randomInt(0, children.length-1);
mixer = RNG.randomInt(0, children.length-1);
for (int j = 0; j < children.length; j++) {
children[j][i] = parents[(j + mixer) % parents.length][i];
}

View File

@ -7,7 +7,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -64,7 +64,7 @@ public class CrossoverGABitSimulated implements InterfaceCrossover, java.io.Seri
for (int j = 0; j < tmpBitSet[0].length; j++) if (tmpBitSet[0][j].get(i)) current++;
current = current/(double)(tmpBitSet[0].length);
for (int j = 0; j < tmpBitSet[0].length; j++) {
if (RandomNumberGenerator.flipCoin(current)) tmpBitSet[1][j].set(i);
if (RNG.flipCoin(current)) tmpBitSet[1][j].set(i);
else tmpBitSet[1][j].clear(i);
}
}

View File

@ -7,7 +7,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA. User: streiche Date: 03.04.2003 Time: 10:34:17 To
@ -57,7 +57,7 @@ public class CrossoverGADefault implements InterfaceCrossover,
if ((indy1 instanceof InterfaceGAIndividual)
&& (partners.get(0) instanceof InterfaceGAIndividual)) {
// Currently we will only handle two parents
int crossoverpoint = RandomNumberGenerator.randomInt(0,
int crossoverpoint = RNG.randomInt(0,
((InterfaceGAIndividual) indy1).getGenotypeLength() - 1);
boolean tmpValue;
BitSet[] tmpBitSets = new BitSet[2];

View File

@ -7,7 +7,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -51,7 +51,7 @@ public class CrossoverGANPoint implements InterfaceCrossover, java.io.Serializab
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
if ((indy1 instanceof InterfaceGAIndividual) && (partners.get(0) instanceof InterfaceGAIndividual)) {
int length = ((InterfaceGAIndividual)indy1).getGenotypeLength();
int mixer = RandomNumberGenerator.randomInt(0, partners.size());
int mixer = RNG.randomInt(0, partners.size());
int[] crossoverPoints = new int[this.m_NumberOfCrossovers];
BitSet[][] tmpBitSet = new BitSet[2][partners.size()+1];
@ -64,7 +64,7 @@ public class CrossoverGANPoint implements InterfaceCrossover, java.io.Serializab
}
for (int i = 0; i < this.m_NumberOfCrossovers; i++) {
crossoverPoints[i] = RandomNumberGenerator.randomInt(0, length-1);
crossoverPoints[i] = RNG.randomInt(0, length-1);
//System.out.println("crpoint: "+crossoverPoints[i]);
}
for (int i = 0; i < length; i++) {

View File

@ -7,7 +7,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -48,7 +48,7 @@ public class CrossoverGAUniform implements InterfaceCrossover, java.io.Serializa
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
if ((indy1 instanceof InterfaceGAIndividual) && (partners.get(0) instanceof InterfaceGAIndividual)) {
int length = ((InterfaceGAIndividual)indy1).getGenotypeLength();
int mixer = RandomNumberGenerator.randomInt(0, partners.size());
int mixer = RNG.randomInt(0, partners.size());
BitSet[][] tmpBitSet = new BitSet[2][partners.size()+1];
tmpBitSet[0][0] = ((InterfaceGAIndividual)indy1).getBGenotype();
@ -60,7 +60,7 @@ public class CrossoverGAUniform implements InterfaceCrossover, java.io.Serializa
}
for (int i = 0; i < length; i++) {
mixer = RandomNumberGenerator.randomInt(0, partners.size());
mixer = RNG.randomInt(0, partners.size());
for (int j = 0; j < tmpBitSet[0].length; j++) {
if (tmpBitSet[0][(j + mixer) % tmpBitSet[0].length].get(i)) tmpBitSet[1][j].set(i);
else tmpBitSet[1][j].clear(i);

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGIIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -49,8 +49,8 @@ public class CrossoverGIDefault implements InterfaceCrossover, java.io.Serializa
if ((indy1 instanceof InterfaceGIIndividual) && (partners.get(0) instanceof InterfaceGIIndividual)) {
if (((InterfaceGIIndividual)indy1).getIGenotype().length <= 1) return result;
int crossoverpoint = RandomNumberGenerator.randomInt(0,((InterfaceGIIndividual)indy1).getIGenotype().length-1);
boolean switcher = RandomNumberGenerator.randomBoolean();
int crossoverpoint = RNG.randomInt(0,((InterfaceGIIndividual)indy1).getIGenotype().length-1);
boolean switcher = RNG.randomBoolean();
parents = new int[partners.size()+1][];
children = new int[partners.size()+1][];
for (int i = 0; i < result.length; i++) {

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGIIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -48,7 +48,7 @@ public class CrossoverGINPoint implements InterfaceCrossover, java.io.Serializab
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
if ((indy1 instanceof InterfaceGIIndividual) && (partners.get(0) instanceof InterfaceGIIndividual)) {
int length = ((InterfaceGIIndividual)indy1).getGenotypeLength();
int mixer = RandomNumberGenerator.randomInt(0, partners.size());
int mixer = RNG.randomInt(0, partners.size());
int[] crossoverPoints = new int[this.m_NumberOfCrossovers];
int[][][] tmpInts = new int[2][partners.size()+1][];
@ -62,7 +62,7 @@ public class CrossoverGINPoint implements InterfaceCrossover, java.io.Serializab
}
for (int i = 0; i < this.m_NumberOfCrossovers; i++) {
crossoverPoints[i] = RandomNumberGenerator.randomInt(0, length-1);
crossoverPoints[i] = RNG.randomInt(0, length-1);
//System.out.println("crpoint: "+crossoverPoints[i]);
}
for (int i = 0; i < length; i++) {

View File

@ -8,7 +8,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGIIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -52,7 +52,7 @@ public class CrossoverGINPointVL implements InterfaceCrossover, java.io.Serializ
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
if ((indy1 instanceof InterfaceGIIndividual) && (partners.get(0) instanceof InterfaceGIIndividual)) {
int[] length = new int[partners.size()+1];
int mixer = RandomNumberGenerator.randomInt(0, partners.size());
int mixer = RNG.randomInt(0, partners.size());
int[][] crossoverPoints = new int[length.length][this.m_NumberOfCrossovers];
int[][] parents = new int[partners.size()+1][];
int[][] offsprings = new int[partners.size()+1][];
@ -131,7 +131,7 @@ public class CrossoverGINPointVL implements InterfaceCrossover, java.io.Serializ
BitSet bitset = new BitSet(length);
while (bitset.cardinality() < this.m_NumberOfCrossovers) {
bitset.set(RandomNumberGenerator.randomInt(1, length-2));
bitset.set(RNG.randomInt(1, length-2));
}
int index = 0;
for (int i = 0; i < length; i++) {

View File

@ -7,7 +7,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGIIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -49,7 +49,7 @@ public class CrossoverGIUniform implements InterfaceCrossover, java.io.Serializa
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
if ((indy1 instanceof InterfaceGIIndividual) && (partners.get(0) instanceof InterfaceGIIndividual)) {
int length = ((InterfaceGIIndividual)indy1).getGenotypeLength();
int mixer = RandomNumberGenerator.randomInt(0, partners.size());
int mixer = RNG.randomInt(0, partners.size());
int[][][] tmpInts = new int[2][partners.size()+1][];
tmpInts[0][0] = ((InterfaceGIIndividual)indy1).getIGenotype();
@ -62,7 +62,7 @@ public class CrossoverGIUniform implements InterfaceCrossover, java.io.Serializa
}
for (int i = 0; i < length; i++) {
mixer = RandomNumberGenerator.randomInt(0, partners.size());
mixer = RNG.randomInt(0, partners.size());
for (int j = 0; j < tmpInts[0].length; j++) {
if ((tmpInts[0][(j + mixer) % tmpInts[0].length].length > i) &&
(tmpInts[1][j].length > i)) {

View File

@ -8,7 +8,7 @@ import eva2.server.go.individuals.InterfaceGPIndividual;
import eva2.server.go.individuals.codings.gp.AbstractGPNode;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -53,7 +53,7 @@ public class CrossoverGPDefault implements InterfaceCrossover, java.io.Serializa
for (int t = 0; t < nodes.length; t++) {
allNodes = new ArrayList();
((InterfaceGPIndividual)result[0]).getPGenotype()[t].addNodesTo(allNodes);
AbstractGPNode oldNode = (AbstractGPNode) allNodes.get(RandomNumberGenerator.randomInt(0, allNodes.size()-1));
AbstractGPNode oldNode = (AbstractGPNode) allNodes.get(RNG.randomInt(0, allNodes.size()-1));
AbstractGPNode newNode, memorizingNode = oldNode, tmpNode;
AbstractGPNode oldParent, newParent;
oldParent = oldNode.getParent();
@ -61,7 +61,7 @@ public class CrossoverGPDefault implements InterfaceCrossover, java.io.Serializa
// choose Node from i and add it to i-1
allNodes = new ArrayList();
((InterfaceGPIndividual)result[i]).getPGenotype()[t].addNodesTo(allNodes);
newNode = (AbstractGPNode) allNodes.get(RandomNumberGenerator.randomInt(0, allNodes.size()-1));
newNode = (AbstractGPNode) allNodes.get(RNG.randomInt(0, allNodes.size()-1));
tmpNode = newNode;
newParent = tmpNode.getParent();
if (oldParent == null) ((InterfaceGPIndividual)result[i-1]).SetPGenotype(newNode, t);

View File

@ -6,7 +6,7 @@ import eva2.server.go.individuals.InterfaceOBGAIndividual;
import eva2.server.go.operators.crossover.InterfaceCrossover;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* <p>Title: The JavaEvA</p>
@ -47,8 +47,8 @@ public class CrossoverOBGAPMX implements InterfaceCrossover, java.io.Serializabl
int[] perm1 = (int[])((InterfaceOBGAIndividual) result[0]).getOBGenotype()[i].clone();
int[] perm2 = (int[])((InterfaceOBGAIndividual) result[1]).getOBGenotype()[i].clone();
int begin = RandomNumberGenerator.randomInt(0,perm1.length-2);
int end = RandomNumberGenerator.randomInt(begin,perm1.length-1);
int begin = RNG.randomInt(0,perm1.length-2);
int end = RNG.randomInt(begin,perm1.length-1);
for (int pos = begin; pos <= end; pos++) {
int crosspoint = pos;
int p1inp2 = 0;

View File

@ -5,7 +5,7 @@ import eva2.server.go.individuals.InterfaceOBGAIndividual;
import eva2.server.go.operators.crossover.InterfaceCrossover;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* <p>Title: The JavaEvA</p>
@ -47,10 +47,10 @@ public class CrossoverOBGAPMXUniform implements InterfaceCrossover, java.io.Seri
int[] perm1 = (int[])((InterfaceOBGAIndividual) result[0]).getOBGenotype()[i].clone();
int[] perm2 = (int[])((InterfaceOBGAIndividual) result[1]).getOBGenotype()[i].clone();
int crossnumber = RandomNumberGenerator.randomInt(1, perm1.length);
int crossnumber = RNG.randomInt(1, perm1.length);
for (int iter = 0; iter < crossnumber; iter++) {
int crosspoint = RandomNumberGenerator.randomInt(0, perm1.length - 1);
int crosspoint = RNG.randomInt(0, perm1.length - 1);
int p1inp2 = 0;
int p2inp1 = 0;
while (perm1[p2inp1] != perm2[crosspoint]) p2inp1++;

View File

@ -5,7 +5,7 @@ import eva2.gui.Chart2DDPointIconText;
import eva2.gui.GraphPointSet;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
import wsi.ra.chart2d.DPoint;
/**
@ -109,7 +109,7 @@ public class MOSOMaxiMin implements InterfaceMOSOConverter, java.io.Serializable
tmpFit = indy.getFitness();
indy.SetData("MOFitness", tmpFit);
System.out.println("The MaxiMin MOSO can not be applied to single individuals! I default to random criteria.");
resultFit[0] = tmpFit[RandomNumberGenerator.randomInt(0, tmpFit.length)];
resultFit[0] = tmpFit[RNG.randomInt(0, tmpFit.length)];
indy.SetFitness(resultFit);
}

View File

@ -2,7 +2,7 @@ package eva2.server.go.operators.moso;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -42,7 +42,7 @@ public class MOSONoConvert implements InterfaceMOSOConverter, java.io.Serializab
tmpFit = indy.getFitness();
indy.SetData("MOFitness", tmpFit);
// resultFit[0] = tmpFit[RandomNumberGenerator.randomInt(0, tmpFit.length)];
// resultFit[0] = tmpFit[RNG.randomInt(0, tmpFit.length)];
// indy.SetFitness(resultFit);
}

View File

@ -2,7 +2,7 @@ package eva2.server.go.operators.moso;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -46,7 +46,7 @@ public class MOSORandomChoice implements InterfaceMOSOConverter, java.io.Serial
tmpFit = indy.getFitness();
indy.SetData("MOFitness", tmpFit);
resultFit[0] = tmpFit[RandomNumberGenerator.randomInt(0, tmpFit.length-1)];
resultFit[0] = tmpFit[RNG.randomInt(0, tmpFit.length-1)];
indy.SetFitness(resultFit);
}

View File

@ -3,7 +3,7 @@ package eva2.server.go.operators.moso;
import eva2.gui.PropertyDoubleArray;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -47,7 +47,7 @@ public class MOSORandomWeight implements InterfaceMOSOConverter, java.io.Seriali
indy.SetData("MOFitness", tmpFit);
tmpWeight = new double[tmpFit.length];
for (int i = 0; i < tmpWeight.length; i++) {
tmpWeight[i] = RandomNumberGenerator.randomDouble(0,1);
tmpWeight[i] = RNG.randomDouble(0,1);
sum += tmpWeight[i];
}
if (sum <= 0.0000001) {

View File

@ -3,7 +3,7 @@ package eva2.server.go.operators.moso;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.operators.archiving.ArchivingNSGAII;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.

View File

@ -6,7 +6,7 @@ import eva2.gui.GenericObjectEditor;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
@ -118,7 +118,7 @@ public class MutateEAMixer implements InterfaceMutation, java.io.Serializable {
double[] probs = this.m_Mutators.getWeights();
if (this.m_UseSelfAdaption) {
for (int i = 0; i < probs.length; i++) {
probs[i] = probs[i] * Math.exp(this.m_Tau1 * RandomNumberGenerator.gaussianDouble(1));
probs[i] = probs[i] * Math.exp(this.m_Tau1 * RNG.gaussianDouble(1));
if (probs[i] <= this.m_LowerLimitChance) probs[i] = this.m_LowerLimitChance;
if (probs[i] >= 1) probs[i] = 1;
}
@ -126,14 +126,14 @@ public class MutateEAMixer implements InterfaceMutation, java.io.Serializable {
}
InterfaceMutation[] mutators = this.m_Mutators.getSelectedMutators();
double pointer = RandomNumberGenerator.randomFloat(0, 1);
double pointer = RNG.randomFloat(0, 1);
double dum = probs[0];
int index = 0;
while ((pointer > dum) && (index < probs.length-1)) {
index++;
dum += probs[index];
}
if (index == probs.length) index = RandomNumberGenerator.randomInt(0, probs.length-1);
if (index == probs.length) index = RNG.randomInt(0, probs.length-1);
//System.out.println("Using : " + mutators[index].getStringRepresentation());
// for (int i = 0; i < probs.length; i++) {
// System.out.println(""+mutators[i].getStringRepresentation()+" : "+ probs[i]);

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -97,7 +97,7 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
// double[] x = ((InterfaceESIndividual)individual).getDGenotype();
// double[] xCopy = ((InterfaceESIndividual)individual).getDGenotype();
// double[][] range = ((InterfaceESIndividual)individual).getDoubleRange();
// double tmpR = RandomNumberGenerator.gaussianDouble(1);
// double tmpR = RNG.gaussianDouble(1);
// if (this.m_Sigmas == null) {
// // init the Sigmas
// this.m_Sigmas = new double[x.length];
@ -106,7 +106,7 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
//
// //Mutate Sigmas
// for (int i = 0; i < x.length; i++) {
// this.m_Sigmas[i] = this.m_Sigmas[i] * Math.exp(this.m_Tau1 * tmpR + this.m_Tau2 * RandomNumberGenerator.gaussianDouble(1));
// this.m_Sigmas[i] = this.m_Sigmas[i] * Math.exp(this.m_Tau1 * tmpR + this.m_Tau2 * RNG.gaussianDouble(1));
// if (this.m_Sigmas[i] < this.m_LowerLimitStepSize) this.m_Sigmas[i] = this.m_LowerLimitStepSize;
// }
//
@ -118,14 +118,14 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
//
//// //Mutate Alphas
//// for (int i = 0; i < this.m_Alphas.length; i++) {
//// this.m_Alphas[i] = this.m_Alphas[i] + RandomNumberGenerator.gaussianDouble(0.01);
//// this.m_Alphas[i] = this.m_Alphas[i] + RNG.gaussianDouble(0.01);
//// if (this.m_Alphas[i] < -m_PI/2) this.m_Alphas[i] = -m_PI/2;
//// if (this.m_Alphas[i] > m_PI/2) this.m_Alphas[i] = m_PI/2;
//// }
//
// //Generate mutationvector in unitspace modified by sigmas
// for (int i = 0; i < x.length; i++) {
// xCopy[i] = RandomNumberGenerator.gaussianDouble(this.m_Sigmas[i]);
// xCopy[i] = RNG.gaussianDouble(this.m_Sigmas[i]);
// }
//
// //modify genotype
@ -156,7 +156,7 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
double[] x = ((InterfaceESIndividual)individual).getDGenotype();
double[] xCopy = new double[x.length];
double[][] range = ((InterfaceESIndividual)individual).getDoubleRange();
double tmpR = RandomNumberGenerator.gaussianDouble(1);
double tmpR = RNG.gaussianDouble(1);
if (this.m_Sigmas == null) {
// init the Sigmas
@ -165,7 +165,7 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
}
//Mutate Sigmas
for (int i = 0; i < x.length; i++) {
this.m_Sigmas[i] = this.m_Sigmas[i] * Math.exp(this.m_Tau1 * tmpR + this.m_Tau2 * RandomNumberGenerator.gaussianDouble(1));
this.m_Sigmas[i] = this.m_Sigmas[i] * Math.exp(this.m_Tau1 * tmpR + this.m_Tau2 * RNG.gaussianDouble(1));
if (this.m_Sigmas[i] < this.m_LowerLimitStepSize) this.m_Sigmas[i] = this.m_LowerLimitStepSize;
}
@ -176,14 +176,14 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
}
//Mutate Alphas
for (int i = 0; i < this.m_Alphas.length; i++) {
this.m_Alphas[i] = this.m_Alphas[i] + RandomNumberGenerator.gaussianDouble(0.2);
this.m_Alphas[i] = this.m_Alphas[i] + RNG.gaussianDouble(0.2);
if (this.m_Alphas[i] < -Math.PI/2) this.m_Alphas[i] = -Math.PI/2;
if (this.m_Alphas[i] > Math.PI/2) this.m_Alphas[i] = Math.PI/2;
}
//Generate mutationvector in unitspace modified by sigmas
for (int i = 0; i < x.length; i++) {
xCopy[i] = RandomNumberGenerator.gaussianDouble(this.m_Sigmas[i]);
xCopy[i] = RNG.gaussianDouble(this.m_Sigmas[i]);
}
//turn mutationvector with alphas

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
import wsi.ra.math.Jama.EigenvalueDecomposition;
import wsi.ra.math.Jama.Matrix;
@ -183,7 +183,7 @@ public class MutateESCovarianceMartixAdaption implements InterfaceMutation, java
// if (Double.isNaN((x[0]))) System.out.println("treffer in cma "+ x[0]);
// if (Double.isNaN((m_C.get(0,0)))) System.out.println("treffer in cma");
// for (int i=0;i<N;i++) { // evaluate new random values
// m_Z[i] = RandomNumberGenerator.gaussianDouble(1.0);
// m_Z[i] = RNG.gaussianDouble(1.0);
// }
// m_C = (m_C.plus(m_C.transpose()).times(0.5)); // MAKE C SYMMETRIC
// EigenvalueDecomposition helper = new EigenvalueDecomposition(m_C);
@ -215,7 +215,7 @@ public class MutateESCovarianceMartixAdaption implements InterfaceMutation, java
// for (int i = 0; i < N; i++) x[i] = tmpD[i];
// conservation of mutaion direction:
double[] old = (double[]) this.m_Z.clone();
for (int i = 0; i < this.m_D; i++) this.m_Z[i] = RandomNumberGenerator.gaussianDouble(1.0);
for (int i = 0; i < this.m_D; i++) this.m_Z[i] = RNG.gaussianDouble(1.0);
this.m_C = (this.m_C.plus(this.m_C.transpose()).times(0.5)); // MAKE C SYMMETRIC
this.m_Counter++;
@ -242,7 +242,7 @@ public class MutateESCovarianceMartixAdaption implements InterfaceMutation, java
for (int i = 0; i < m_D; i++) {
if (x[i] < range[i][0] || x[i] > range[i][1]) {
for (int j = 0; j < this.m_D; j++) x[j] = x[j] - this.m_SigmaGlobal * this.Bz[j];
this.m_Z[i] = RandomNumberGenerator.gaussianDouble(1.0);
this.m_Z[i] = RNG.gaussianDouble(1.0);
constraint = false;
counter++;
break;

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -74,7 +74,7 @@ public class MutateESDerandomized implements InterfaceMutation, java.io.Serializ
else this.m_c = 1.0;
this.m_Z = new double[this.m_D];
this.m_Path = new double[this.m_D];
for (int i = 0; i < this.m_D; i++) this.m_Z[i] = RandomNumberGenerator.gaussianDouble(1.0);
for (int i = 0; i < this.m_D; i++) this.m_Z[i] = RNG.gaussianDouble(1.0);
evaluateNewObjectX(x, ranges);
}
@ -88,7 +88,7 @@ public class MutateESDerandomized implements InterfaceMutation, java.io.Serializ
double[] x = ((InterfaceESIndividual)individual).getDGenotype();
double[][] ranges = ((InterfaceESIndividual)individual).getDoubleRange();
this.adaptStrategy();
for (int i = 0; i < m_D; i++) m_Z[i] = RandomNumberGenerator.gaussianDouble(1.0);
for (int i = 0; i < m_D; i++) m_Z[i] = RNG.gaussianDouble(1.0);
this.evaluateNewObjectX(x, ranges);
for (int i = 0; i < x.length; i++) {
if (x[i] < ranges[i][0]) x[i] = ranges[i][0];

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -65,7 +65,7 @@ public class MutateESFixedStepSize implements InterfaceMutation, java.io.Seriali
double[] x = ((InterfaceESIndividual)individual).getDGenotype();
double[][] range = ((InterfaceESIndividual)individual).getDoubleRange();
for (int i = 0; i < x.length; i++) {
x[i] += ((range[i][1] -range[i][0])/2)*RandomNumberGenerator.gaussianDouble(this.m_Sigma);
x[i] += ((range[i][1] -range[i][0])/2)*RNG.gaussianDouble(this.m_Sigma);
if (range[i][0] > x[i]) x[i] = range[i][0];
if (range[i][1] < x[i]) x[i] = range[i][1];
}

View File

@ -6,7 +6,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
import eva2.tools.SelectedTag;
@ -81,10 +81,10 @@ public class MutateESGlobal implements InterfaceMutation, java.io.Serializable {
if (individual instanceof InterfaceESIndividual) {
double[] x = ((InterfaceESIndividual)individual).getDGenotype();
double[][] range = ((InterfaceESIndividual)individual).getDoubleRange();
this.m_MutationStepSize = this.m_MutationStepSize * Math.exp(this.m_Tau1 * RandomNumberGenerator.gaussianDouble(1));
this.m_MutationStepSize = this.m_MutationStepSize * Math.exp(this.m_Tau1 * RNG.gaussianDouble(1));
if (this.m_MutationStepSize < this.m_LowerLimitStepSize) this.m_MutationStepSize = this.m_LowerLimitStepSize;
for (int i = 0; i < x.length; i++) {
x[i] += ((range[i][1] -range[i][0])/2)*RandomNumberGenerator.gaussianDouble(this.m_MutationStepSize);
x[i] += ((range[i][1] -range[i][0])/2)*RNG.gaussianDouble(this.m_MutationStepSize);
if (range[i][0] > x[i]) x[i] = range[i][0];
if (range[i][1] < x[i]) x[i] = range[i][1];
}
@ -116,7 +116,7 @@ public class MutateESGlobal implements InterfaceMutation, java.io.Serializable {
break;
}
case 2 : {
this.m_MutationStepSize = list[RandomNumberGenerator.randomInt(0, list.length-1)];
this.m_MutationStepSize = list[RNG.randomInt(0, list.length-1)];
break;
}
default : {

View File

@ -8,7 +8,7 @@ import eva2.server.go.individuals.InterfaceDataTypeDouble;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
import eva2.tools.SelectedTag;
import eva2.tools.Tag;
@ -99,12 +99,12 @@ public class MutateESLocal implements InterfaceMutation, java.io.Serializable {
if (individual instanceof InterfaceESIndividual) {
double[] x = ((InterfaceESIndividual)individual).getDGenotype();
double[][] range = ((InterfaceESIndividual)individual).getDoubleRange();
double tmpR = RandomNumberGenerator.gaussianDouble(1);
double tmpR = RNG.gaussianDouble(1);
for (int i = 0; i < x.length; i++) {
this.m_Sigmas[i] = this.m_Sigmas[i] * Math.exp(this.m_Tau1 * tmpR + this.m_Tau2 * RandomNumberGenerator.gaussianDouble(1));
this.m_Sigmas[i] = this.m_Sigmas[i] * Math.exp(this.m_Tau1 * tmpR + this.m_Tau2 * RNG.gaussianDouble(1));
if (this.m_Sigmas[i] < this.m_LowerLimitStepSize) this.m_Sigmas[i] = this.m_LowerLimitStepSize;
x[i] += ((range[i][1] -range[i][0])/2)*RandomNumberGenerator.gaussianDouble(this.m_Sigmas[i]);
x[i] += ((range[i][1] -range[i][0])/2)*RNG.gaussianDouble(this.m_Sigmas[i]);
if (range[i][0] > x[i]) x[i] = range[i][0];
if (range[i][1] < x[i]) x[i] = range[i][1];
}
@ -151,10 +151,10 @@ public class MutateESLocal implements InterfaceMutation, java.io.Serializable {
break;
}
case 2 : {
int rn = RandomNumberGenerator.randomInt(0, listA.length-1);
int rn = RNG.randomInt(0, listA.length-1);
this.m_MutationStepSize = listA[rn];
for (int i = 0; i < this.m_Sigmas.length; i++) {
rn = RandomNumberGenerator.randomInt(0, listA.length-1);
rn = RNG.randomInt(0, listA.length-1);
this.m_Sigmas[i] = listB[rn][i];
}
break;

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -98,8 +98,8 @@ public class MutateESMainVectorAdaption implements InterfaceMutation, java.io.Se
this.m_main_v[i] = 0;
};
this.xi_dach = Math.sqrt(this.N - 0.5);
for (int i = 0; i < this.N; i++) this.m_Z[i] = RandomNumberGenerator.gaussianDouble(1.0);
this.Z1 = RandomNumberGenerator.gaussianDouble(1.0);
for (int i = 0; i < this.N; i++) this.m_Z[i] = RNG.gaussianDouble(1.0);
this.Z1 = RNG.gaussianDouble(1.0);
evaluateNewObjectX(x, ranges);
}
@ -113,8 +113,8 @@ public class MutateESMainVectorAdaption implements InterfaceMutation, java.io.Se
double[] x = ((InterfaceESIndividual)individual).getDGenotype();
double[][] ranges = ((InterfaceESIndividual)individual).getDoubleRange();
this.adaptStrategy();
for (int i = 0; i < N; i++) m_Z[i] = RandomNumberGenerator.gaussianDouble(1.0);
Z1 = RandomNumberGenerator.gaussianDouble(1.0);
for (int i = 0; i < N; i++) m_Z[i] = RNG.gaussianDouble(1.0);
Z1 = RNG.gaussianDouble(1.0);
evaluateNewObjectX(x, ranges);
((InterfaceESIndividual)individual).SetDGenotype(x);

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -65,13 +65,13 @@ public class MutateESMutativeStepSizeControl implements InterfaceMutation, java.
if (individual instanceof InterfaceESIndividual) {
double[] x = ((InterfaceESIndividual)individual).getDGenotype();
double[][] range = ((InterfaceESIndividual)individual).getDoubleRange();
if (RandomNumberGenerator.flipCoin(0.5))
if (RNG.flipCoin(0.5))
this.m_MutationStepSize = this.m_MutationStepSize * this.m_Alpha;
else
this.m_MutationStepSize = this.m_MutationStepSize / this.m_Alpha;
if (this.m_MutationStepSize < this.m_LowerLimitStepSize) this.m_MutationStepSize = this.m_LowerLimitStepSize;
for (int i = 0; i < x.length; i++) {
x[i] += ((range[i][1] -range[i][0])/2)*RandomNumberGenerator.gaussianDouble(this.m_MutationStepSize);
x[i] += ((range[i][1] -range[i][0])/2)*RNG.gaussianDouble(this.m_MutationStepSize);
if (range[i][0] > x[i]) x[i] = range[i][0];
if (range[i][1] < x[i]) x[i] = range[i][1];
}

View File

@ -5,7 +5,7 @@ import eva2.server.go.individuals.InterfaceDataTypeDouble;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -61,7 +61,7 @@ public class MutateESStandard implements InterfaceMutation, java.io.Serializable
double[] x = ((InterfaceESIndividual)individual).getDGenotype();
double[][] range = ((InterfaceESIndividual)individual).getDoubleRange();
for (int i = 0; i < x.length; i++) {
x[i] += ((range[i][1] -range[i][0])/2)*RandomNumberGenerator.gaussianDouble(this.m_MutationStepSize);
x[i] += ((range[i][1] -range[i][0])/2)*RNG.gaussianDouble(this.m_MutationStepSize);
if (range[i][0] > x[i]) x[i] = range[i][0];
if (range[i][1] < x[i]) x[i] = range[i][1];
}

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceESIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -70,7 +70,7 @@ public class MutateESSuccessRule implements InterfaceMutation, java.io.Serializa
double[] x = ((InterfaceESIndividual)individual).getDGenotype();
double[][] range = ((InterfaceESIndividual)individual).getDoubleRange();
for (int i = 0; i < x.length; i++) {
x[i] += ((range[i][1] -range[i][0])/2)*RandomNumberGenerator.gaussianDouble(this.m_MutationStepSize);
x[i] += ((range[i][1] -range[i][0])/2)*RNG.gaussianDouble(this.m_MutationStepSize);
if (range[i][0] > x[i]) x[i] = range[i][0];
if (range[i][1] < x[i]) x[i] = range[i][1];
}

View File

@ -7,7 +7,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* The mutation probability is adapted using a parameter tau and stored in the individual.
@ -71,10 +71,10 @@ public class MutateGAAdaptive implements InterfaceMutation, java.io.Serializable
//System.out.println("Before Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor());
if (individual instanceof InterfaceGAIndividual) {
BitSet tmpBitSet = ((InterfaceGAIndividual)individual).getBGenotype();
this.m_MutationStep = this.m_MutationStep * Math.exp(this.m_Tau1 * RandomNumberGenerator.gaussianDouble(1));
this.m_MutationStep = this.m_MutationStep * Math.exp(this.m_Tau1 * RNG.gaussianDouble(1));
if (this.m_MutationStep < this.m_LowerLimitStepSize) this.m_MutationStep = this.m_LowerLimitStepSize;
for (int i = 0; i < ((InterfaceGAIndividual)individual).getGenotypeLength(); i++) {
if (RandomNumberGenerator.flipCoin(this.m_MutationStep/((InterfaceGAIndividual)individual).getGenotypeLength())) {
if (RNG.flipCoin(this.m_MutationStep/((InterfaceGAIndividual)individual).getGenotypeLength())) {
tmpBitSet.flip(i);
}
}

View File

@ -7,7 +7,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -67,8 +67,8 @@ public class MutateGAInvertBits implements InterfaceMutation, java.io.Serializab
BitSet tmpBitSet = ((InterfaceGAIndividual)individual).getBGenotype();
int[][] mutationIndices = new int[this.m_NumberOfMutations][2];
for (int i = 0; i < mutationIndices.length; i++) {
mutationIndices[i][0] = RandomNumberGenerator.randomInt(0, ((InterfaceGAIndividual)individual).getGenotypeLength());;
mutationIndices[i][1] = RandomNumberGenerator.randomInt(0, this.m_MaxInveredBits);;
mutationIndices[i][0] = RNG.randomInt(0, ((InterfaceGAIndividual)individual).getGenotypeLength());;
mutationIndices[i][1] = RNG.randomInt(0, this.m_MaxInveredBits);;
}
// double instances of mutationIndices could be checked here... *sigh*
for (int i = 0; i < mutationIndices.length; i++) {

View File

@ -7,7 +7,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -62,7 +62,7 @@ public class MutateGAStandard implements InterfaceMutation, java.io.Serializable
if (individual instanceof InterfaceGAIndividual) {
BitSet tmpBitSet = ((InterfaceGAIndividual)individual).getBGenotype();
int[] mutationIndices = new int[this.m_NumberOfMutations];
for (int i = 0; i < mutationIndices.length; i++) mutationIndices[i] = RandomNumberGenerator.randomInt(0, ((InterfaceGAIndividual)individual).getGenotypeLength());;
for (int i = 0; i < mutationIndices.length; i++) mutationIndices[i] = RNG.randomInt(0, ((InterfaceGAIndividual)individual).getGenotypeLength());;
// double instances of mutationIndices could be checked here... *sigh*
for (int i = 0; i < mutationIndices.length; i++) {
tmpBitSet.flip(mutationIndices[i]);

View File

@ -7,7 +7,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -73,8 +73,8 @@ public class MutateGASwapBits implements InterfaceMutation, java.io.Serializable
int[][] mutationIndices = new int[this.m_NumberOfMutations][2];
boolean tmpBit;
for (int i = 0; i < mutationIndices.length; i++) {
mutationIndices[i][0] = RandomNumberGenerator.randomInt(0, ((InterfaceGAIndividual)individual).getGenotypeLength());;
mutationIndices[i][1] = RandomNumberGenerator.randomInt(0, ((InterfaceGAIndividual)individual).getGenotypeLength());;
mutationIndices[i][0] = RNG.randomInt(0, ((InterfaceGAIndividual)individual).getGenotypeLength());;
mutationIndices[i][1] = RNG.randomInt(0, ((InterfaceGAIndividual)individual).getGenotypeLength());;
}
// double instances of mutationIndices could be checked here... *sigh*
for (int i = 0; i < mutationIndices.length; i++) {

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGIIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -73,12 +73,12 @@ public class MutateGIInsertDelete implements InterfaceMutation, java.io.Serializ
int[][] newRange;
int length, position;
//this.pintInt("Before ", x);
length = RandomNumberGenerator.randomInt(1, this.m_MaxLengthOfInsDel);
boolean insert = RandomNumberGenerator.flipCoin(0.5);
length = RNG.randomInt(1, this.m_MaxLengthOfInsDel);
boolean insert = RNG.flipCoin(0.5);
if ((!insert) && (length >= x.length-1)) insert = true;
if (insert) {
// insert
position = RandomNumberGenerator.randomInt(0, x.length-1);
position = RNG.randomInt(0, x.length-1);
newX = new int[x.length + length];
newRange = new int[range.length + length][2];
for (int i = 0; i < position; i++) {
@ -86,7 +86,7 @@ public class MutateGIInsertDelete implements InterfaceMutation, java.io.Serializ
newRange[i] = range[i];
}
for (int i = position; i < position+length; i++) {
newX[i] = RandomNumberGenerator.randomInt(range[position][0], range[position][1]);
newX[i] = RNG.randomInt(range[position][0], range[position][1]);
newRange[i][0] = range[position][0];
newRange[i][1] = range[position][1];
}
@ -96,7 +96,7 @@ public class MutateGIInsertDelete implements InterfaceMutation, java.io.Serializ
}
} else {
// delete
position = RandomNumberGenerator.randomInt(0, x.length-1-length);
position = RNG.randomInt(0, x.length-1-length);
newX = new int[x.length - length];
newRange = new int[range.length - length][2];
if (newX.length <=1) return;

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGIIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -61,9 +61,9 @@ public class MutateGIInvert implements InterfaceMutation, java.io.Serializable {
int[] x = ((InterfaceGIIndividual)individual).getIGenotype();
int range, center, index = 0;
//this.pintInt("Before ", x);
range = RandomNumberGenerator.randomInt(1, this.m_MaxLengthOfInvert);
range = RNG.randomInt(1, this.m_MaxLengthOfInvert);
if (2*range >= x.length) return;
center = RandomNumberGenerator.randomInt(0+range, x.length-1-range);
center = RNG.randomInt(0+range, x.length-1-range);
//System.out.println("Range: " + range + " Center: " + center);
int[] tmp = new int[x.length];
System.arraycopy(x, 0, tmp, 0, x.length);

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGIIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -63,11 +63,11 @@ public class MutateGINominal implements InterfaceMutation, java.io.Serializable
int mutInd = 0;
for (int k = 0; k < this.m_NumberOfMutations; k++) {
try {
mutInd = RandomNumberGenerator.randomInt(0, x.length-1);
mutInd = RNG.randomInt(0, x.length-1);
} catch (java.lang.ArithmeticException e) {
System.out.println("x.length " + x.length);
}
x[mutInd] = RandomNumberGenerator.randomInt(range[mutInd][0], range[mutInd][1]);
x[mutInd] = RNG.randomInt(range[mutInd][0], range[mutInd][1]);
}
((InterfaceGIIndividual)individual).SetIGenotype(x);
}

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGIIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -66,12 +66,12 @@ public class MutateGIOrdinal implements InterfaceMutation, java.io.Serializable
int mutInd, mut;
double mutate;
for (int k = 0; k < this.m_NumberOfMutations; k++) {
mutInd = RandomNumberGenerator.randomInt(0, x.length-1);
mutate = RandomNumberGenerator.gaussianDouble(this.m_StepSize);
mutInd = RNG.randomInt(0, x.length-1);
mutate = RNG.gaussianDouble(this.m_StepSize);
mutate = mutate * (range[mutInd][1] - range[mutInd][1]);
mut = (int)Math.round(mutate);
if (mut == 0) {
if (RandomNumberGenerator.flipCoin(0.5)) mut = -1;
if (RNG.flipCoin(0.5)) mut = -1;
else mut = 1;
}
x[mutInd] += mut;

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGIIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
@ -61,10 +61,10 @@ public class MutateGITranslocate implements InterfaceMutation, java.io.Serializa
if (individual instanceof InterfaceGIIndividual) {
int[] x = ((InterfaceGIIndividual)individual).getIGenotype();
int from, to, length;
length = RandomNumberGenerator.randomInt(1, this.m_MaxLengthOfTranslocate);
length = RNG.randomInt(1, this.m_MaxLengthOfTranslocate);
if (x.length < length+2) return;
from = RandomNumberGenerator.randomInt(0, x.length - 1 - length);
to = RandomNumberGenerator.randomInt(0, x.length - 1 - length);
from = RNG.randomInt(0, x.length - 1 - length);
to = RNG.randomInt(0, x.length - 1 - length);
//this.pintInt("Before ", x);
int[] tmp = new int[x.length];
int[] without = new int[x.length - length];

View File

@ -8,7 +8,7 @@ import eva2.server.go.individuals.InterfaceGAIndividual;
import eva2.server.go.individuals.InterfaceGPIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -70,10 +70,10 @@ public class MutateGPAdaptive implements InterfaceMutation, java.io.Serializable
public void mutate(AbstractEAIndividual individual) {
//System.out.println("Before Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor());
if (individual instanceof InterfaceGPIndividual) {
this.m_MutationStep = this.m_MutationStep * Math.exp(this.m_Tau1 * RandomNumberGenerator.gaussianDouble(1) + this.m_Tau2 * RandomNumberGenerator.gaussianDouble(1));
this.m_MutationStep = this.m_MutationStep * Math.exp(this.m_Tau1 * RNG.gaussianDouble(1) + this.m_Tau2 * RNG.gaussianDouble(1));
if (this.m_MutationStep < this.m_LowerLimitStepSize) this.m_MutationStep = this.m_LowerLimitStepSize;
if (this.m_MutationStep > 1) this.m_MutationStep = 1;
if (RandomNumberGenerator.flipCoin(this.m_MutationStep)) ((InterfaceGPIndividual)individual).defaultMutate();
if (RNG.flipCoin(this.m_MutationStep)) ((InterfaceGPIndividual)individual).defaultMutate();
}
//System.out.println("After Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor());
}

View File

@ -10,7 +10,7 @@ import eva2.server.go.individuals.codings.gp.AbstractGPNode;
import eva2.server.go.individuals.codings.gp.GPArea;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
* Created by IntelliJ IDEA.
@ -58,7 +58,7 @@ public class MutateGPSingleNode implements InterfaceMutation, java.io.Serializab
GPArea[] areas = (GPArea[])((InterfaceGPIndividual)individual).getFunctionArea();
for (int i = 0; i < programs.length; i++) {
programs[i].addNodesTo(allNodes);
AbstractGPNode nodeToMutate = (AbstractGPNode) allNodes.get(RandomNumberGenerator.randomInt(0, allNodes.size()-1));
AbstractGPNode nodeToMutate = (AbstractGPNode) allNodes.get(RNG.randomInt(0, allNodes.size()-1));
int orgArity = nodeToMutate.getArity();
AbstractGPNode newNode = (AbstractGPNode)areas[i].getRandomNodeWithArity(orgArity).clone();
// System.out.println("OldNode "+ nodeToMutate.getName() + ":"+nodeToMutate.getArity() + " / NewNode "+newNode.getName() + ":"+newNode.getArity());

View File

@ -5,7 +5,7 @@ import eva2.server.go.individuals.InterfaceDataTypePermutation;
import eva2.server.go.individuals.InterfaceOBGAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
@ -54,8 +54,8 @@ public class MutateOBGAFlip implements InterfaceMutation, java.io.Serializable {
getOBGenotype();
for (int p = 0; p < perm.length; p++) {
for (int i = 0; i < times; i++) {
int p1 = RandomNumberGenerator.randomInt(0, perm[p].length - 1);
int p2 = RandomNumberGenerator.randomInt(0, perm[p].length - 1);
int p1 = RNG.randomInt(0, perm[p].length - 1);
int p2 = RNG.randomInt(0, perm[p].length - 1);
int temp = perm[p][p1];
perm[p][p1] = perm[p][p2];
perm[p][p2] = temp;

View File

@ -5,7 +5,7 @@ import eva2.server.go.individuals.InterfaceDataTypePermutation;
import eva2.server.go.individuals.InterfaceOBGAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/**
@ -52,8 +52,8 @@ public class MutateOBGAInversion implements java.io.Serializable, InterfaceMutat
int[][] permnew = (int[][]) ((InterfaceOBGAIndividual) individual). getOBGenotype().clone();
int[][] perm = ((InterfaceDataTypePermutation) individual).getPermutationData();
for (int p = 0; p < perm.length; p++) {
int p1 = RandomNumberGenerator.randomInt(0, perm[p].length - 1);
int p2 = RandomNumberGenerator.randomInt(p1, perm[p].length - 1);
int p1 = RNG.randomInt(0, perm[p].length - 1);
int p2 = RNG.randomInt(p1, perm[p].length - 1);
for (int i = 0; i <= (p2-p1); i++) {
permnew[p][p1+i] = perm[p][p2-i];
}

View File

@ -2,7 +2,7 @@ package eva2.server.go.operators.selection;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** Simple method to selecet all.
* In case of multiple fitness values the selection

View File

@ -2,7 +2,7 @@ package eva2.server.go.operators.selection;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** Select best individual multiple times if necessary.
@ -55,7 +55,7 @@ public class SelectBest implements InterfaceSelection, java.io.Serializable {
result.setPopulationSize(size);
if (this.m_ObeyDebsConstViolationPrinciple) {
for (int i = 0; i < size; i++) {
currentCriteria = RandomNumberGenerator.randomInt(0, critSize-1);
currentCriteria = RNG.randomInt(0, critSize-1);
currentBestValue = Double.POSITIVE_INFINITY;
tmpIndy = null;
for (int j = 0; j < population.size(); j++) {
@ -78,7 +78,7 @@ public class SelectBest implements InterfaceSelection, java.io.Serializable {
}
} else {
for (int i = 0; i < size; i++) {
currentCriteria = RandomNumberGenerator.randomInt(0, critSize-1);
currentCriteria = RNG.randomInt(0, critSize-1);
currentBestValue = Double.POSITIVE_INFINITY;
for (int j = 0; j < population.size(); j++) {
if (((AbstractEAIndividual)population.get(j)).getFitness(currentCriteria) < currentBestValue) {

View File

@ -5,7 +5,7 @@ import java.util.ArrayList;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** Select the best individuals.
* In case of multiple fitness values the selection
@ -64,7 +64,7 @@ public class SelectBestIndividuals implements InterfaceSelection, java.io.Serial
// now get the actual result from the tmp list
for (int i = 0; i < size; i++) {
currentCriteria = RandomNumberGenerator.randomInt(0, critSize-1);
currentCriteria = RNG.randomInt(0, critSize-1);
result.add(bestIndividuals[currentCriteria].get(0));
bestIndividuals[currentCriteria].remove(0);
}
@ -121,7 +121,7 @@ public class SelectBestIndividuals implements InterfaceSelection, java.io.Serial
}
}
if (index >= 0) return pop.get(index);
else return pop.get(RandomNumberGenerator.randomInt(0, pop.size()-1));
else return pop.get(RNG.randomInt(0, pop.size()-1));
}
} else {
for (int i = 0; i < pop.size(); i++) {
@ -140,7 +140,7 @@ public class SelectBestIndividuals implements InterfaceSelection, java.io.Serial
}
}
if (index >= 0) return pop.get(index);
else return pop.get(RandomNumberGenerator.randomInt(0, pop.size()-1));
else return pop.get(RNG.randomInt(0, pop.size()-1));
}
}

View File

@ -5,7 +5,7 @@ import java.util.ArrayList;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This method implements the multiple tournament scheme
* for EP.
@ -60,7 +60,7 @@ public class SelectEPTournaments implements InterfaceSelection, java.io.Serializ
}
// perform tournament
for (int k = 0; k < this.m_TournamentSize; k++) {
rand = RandomNumberGenerator.randomInt(0, population.size()-1);
rand = RNG.randomInt(0, population.size()-1);
tmpIndy = ((AbstractEAIndividual)population.get(rand));
for (int l = 0; l < best.length; l++) {
if (this.m_ObeyDebsConstViolationPrinciple) {
@ -102,7 +102,7 @@ public class SelectEPTournaments implements InterfaceSelection, java.io.Serializ
// now get the actual result from the tmp list
for (int i = 0; i < size; i++) {
currentCriteria = RandomNumberGenerator.randomInt(0, critSize-1);
currentCriteria = RNG.randomInt(0, critSize-1);
result.add(bestIndividuals[currentCriteria].get(0));
bestIndividuals[currentCriteria].remove(0);
}
@ -139,7 +139,7 @@ public class SelectEPTournaments implements InterfaceSelection, java.io.Serializ
}
}
if (index >= 0) return pop.get(index);
else return pop.get(RandomNumberGenerator.randomInt(0, pop.size()-1));
else return pop.get(RNG.randomInt(0, pop.size()-1));
}
/** This method allows you to select partners for a given Individual

View File

@ -6,7 +6,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.operators.distancemetric.InterfaceDistanceMetric;
import eva2.server.go.operators.distancemetric.ObjectiveSpaceMetric;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** An experimential implementation for mating restriction.
* Possibly defunct.

View File

@ -58,7 +58,9 @@ public class SelectMOMAIIDominanceCounter implements InterfaceSelection, java.io
tmpObj = tmpIndy1.getData("MOMAII");
if ((tmpObj != null) && (tmpObj instanceof MOMultipleSolutions)) {
malta = (MOMultipleSolutions)tmpObj;
for (int j = i+1; j < population.size(); i++) {
//for (int j = i+1; j < population.size(); i++) {
// MK: Im rather sure the i++ was intended to become a j++
for (int j = i+1; j < population.size(); j++) {
tmpIndy2 = (AbstractEAIndividual)population.get(j);
tmpObj = tmpIndy2.getData("MOMAII");
if ((tmpObj != null) && (tmpObj instanceof MOMultipleSolutions)) {

View File

@ -3,7 +3,7 @@ package eva2.server.go.operators.selection;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.operators.moso.MOSOMaxiMin;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** A multi-objective selection criterion based on the maximin
* method.

View File

@ -3,7 +3,7 @@ package eva2.server.go.operators.selection;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.operators.archiving.ArchivingNSGAII;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** The infamous NSGA-II selection scheme for multi-objective
* optimization based on Pareto ranks and hybergrids.
@ -73,7 +73,7 @@ public class SelectMONSGAIICrowedTournament implements InterfaceSelection, java.
try {
for (int i = 0; i < this.m_TournamentSize; i++) {
tmpIndy = (AbstractEAIndividual) population.get(RandomNumberGenerator.randomInt(0, population.size()-1));
tmpIndy = (AbstractEAIndividual) population.get(RNG.randomInt(0, population.size()-1));
tmpL = ((Integer)tmpIndy.getData("ParetoLevel")).intValue();
if (tmpL < smallestLevel) smallestLevel = tmpL;
if (tmpIndy.getConstraintViolation() > 0) infeasiblePop.add(tmpIndy);

View File

@ -2,7 +2,7 @@ package eva2.server.go.operators.selection;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** This multi-objective selection method preferrs non-dominated
* individuals over dominated ones. Actually, this fails in case
@ -47,7 +47,7 @@ public class SelectMONonDominated implements InterfaceSelection, java.io.Seriali
*/
public Population selectFrom(Population population, int size) {
Population result = new Population();
int index = RandomNumberGenerator.randomInt(0, population.size()-1);
int index = RNG.randomInt(0, population.size()-1);
if (this.m_ObeyDebsConstViolationPrinciple) {
boolean feasible = false;

View File

@ -4,7 +4,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.operators.archiving.ArchivingPESAII;
import eva2.server.go.operators.moso.MOSOMaxiMin;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** The multi-objective PESA selection method.
* Created by IntelliJ IDEA.
@ -67,9 +67,9 @@ public class SelectMOPESA implements InterfaceSelection, java.io.Serializable {
int winner, tmp;
try {
winner = RandomNumberGenerator.randomInt(0, population.size()-1);
winner = RNG.randomInt(0, population.size()-1);
for (int i = 1; i < this.m_TournamentSize; i++) {
tmp = RandomNumberGenerator.randomInt(0, population.size()-1);
tmp = RNG.randomInt(0, population.size()-1);
if (this.m_Squeeze[tmp] < this.m_Squeeze[winner]) winner = tmp;
}
resultIndy = (AbstractEAIndividual) population.get(winner);

View File

@ -8,7 +8,7 @@ import java.util.Enumeration;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.operators.archiving.ArchivingPESAII;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
/** The multi-objective PESA II selection criteria based on a n-dimensional
* grid using a squezzing factor.
@ -102,13 +102,13 @@ public class SelectMOPESAII implements InterfaceSelection, java.io.Serializable
int winner, tmp;
try {
box1 = (ArrayList)this.m_GridBoxes.get(RandomNumberGenerator.randomInt(0, this.m_GridBoxes.size()-1));
box2 = (ArrayList)this.m_GridBoxes.get(RandomNumberGenerator.randomInt(0, this.m_GridBoxes.size()-1));
box1 = (ArrayList)this.m_GridBoxes.get(RNG.randomInt(0, this.m_GridBoxes.size()-1));
box2 = (ArrayList)this.m_GridBoxes.get(RNG.randomInt(0, this.m_GridBoxes.size()-1));
if (((Integer)((AbstractEAIndividual)box1.get(0)).getData("SqueezeFactor")).intValue()
< ((Integer)((AbstractEAIndividual)box2.get(0)).getData("SqueezeFactor")).intValue()) {
resultIndy = (AbstractEAIndividual) (box1.get(RandomNumberGenerator.randomInt(0, box1.size()-1)));
resultIndy = (AbstractEAIndividual) (box1.get(RNG.randomInt(0, box1.size()-1)));
} else {
resultIndy = (AbstractEAIndividual) (box2.get(RandomNumberGenerator.randomInt(0, box2.size()-1)));
resultIndy = (AbstractEAIndividual) (box2.get(RNG.randomInt(0, box2.size()-1)));
}
} catch (java.lang.IndexOutOfBoundsException e) {
System.out.println("Tournament Selection produced IndexOutOfBoundsException!");

View File

@ -8,7 +8,7 @@ import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.operators.archiving.ArchivingNSGAII;
import eva2.server.go.operators.archiving.ArchivingSPEAII;
import eva2.server.go.populations.Population;
import eva2.server.go.tools.RandomNumberGenerator;
import wsi.ra.math.RNG;
import wsi.ra.chart2d.DPoint;
/** The SPEA II selection criteria using strength and raw fitness to determine

Some files were not shown because too many files have changed in this diff Show More