Commit e957762f authored by ISWB Prasetya's avatar ISWB Prasetya
Browse files

small tweak for the evo-like engine of the G2 generator.

parent 617fd057
......@@ -72,6 +72,15 @@
<zip basedir="${dist}" destfile="${build}/${VERSION}_dist.zip" />
</target>
<!-- for jarring T3 and support tools for SBST unit testing tool competition -->
<target name="jarT3SBST" depends="jar" description="Jarring all T3 classes.">
<jar destfile="${build}/T3G2_SBST2016.jar" >
<zipfileset src="${build}/${RELEASEname}.jar" includes="**/*.class"/>
<zipfileset src="${build}/../t3static/T3static_v0.jar" includes="**/*.class"/>
<zipfileset src="${build}/../t3tools/CPscanner.jar" includes="**/*.class"/>
</jar>
</target>
<target name="clean" description="Cleaning.">
<echo>Cleaning... </echo>
<delete dir="${build}" />
......
......@@ -55,8 +55,8 @@ public class EvoSingleTarget extends SingleTarget{
}
protected SUITE generateFreshSuite() {
if (numberOfIterations()>=3 && getImprovement(2) <= 0.0) {
// we get too little improvementin the last two rounds, flip the mode
if (numberOfIterations()>=10 && getImprovement(4) <= 0.0) {
// we get too little improvementin the last n rounds, flip the mode
flipMode() ;
// if the mode is switch back to random, throw away the evolved population
if (isInRandomMode()) evolvedPopulation = null ;
......
......@@ -142,7 +142,20 @@ public class StaticInfo {
private void registerConstants(Pair<String,List<String>> constants, String type) {
//System.out.println(">> " + constants.snd);
for (String c : constants.snd) registerConstant(constants.fst,c,type) ;
for (String c : constants.snd) {
registerConstant(constants.fst,c,type) ;
// for integer constant, also register c-1 and c+1 border values:
if (type == "numeric") {
try {
int i = Integer.parseInt(c.substring(1,c.length()-1)) ;
int iplus = i+1 ;
int imin = i-1 ;
registerConstant(constants.fst, "<" + iplus + ">" , type) ;
registerConstant(constants.fst, "<" + imin + ">" , type) ;
}
catch(Exception e) { }
}
}
}
private void registerConstant(String mname, String constant, String type) {
......
......@@ -74,6 +74,17 @@
<target name="compileAll" description="Compiling all tools..." depends="compileT3daikon,compileCPscanner,compileStandingen,compileT3configure">
</target>
<!-- for jarring CPscanner only (along with all its dependencies). Run clean first! -->
<target name="CPscannerJar" description="Jarring CPscanner..." depends="compileCPscanner">
<echo>Jarring all T3 support tools classes... </echo>
<jar basedir="${build}/classes" destfile="${build}/CPscanner.jar" >
<zipfileset src="./cpscanner/libs/guava-14.0.1.jar" includes="**/*.class"/>
<zipfileset src="./cpscanner/libs/reflections-0.9.9-RC1-uberjar.jar" includes="**/*.class"/>
<zipfileset src="./cpscanner/libs/javassist.jar" includes="**/*.class"/>
</jar>
</target>
<!-- for jarring T3daikon only. Run clean first! -->
<target name="T3daikonJar" description="Jarring T3daikon ..." depends="compileT3daikon">
<echo>Jarring the T3daikon tool... </echo>
......
......@@ -14,14 +14,15 @@ public class IncomeTax {
public IncomeTax(int salary, String location) {
if (! (location.equals("INSIDE") || location.equals("OUTSIDE"))) throw new IllegalArgumentException() ;
//if (! (location.equals("INSIDE") || location.equals("OUTSIDE"))) throw new IllegalArgumentException() ;
if (salary<0) throw new IllegalArgumentException() ;
//System.out.println(">> IncomeTax(" + salary + "," + location + ")") ;
this.salary = salary ;
this.location = location ;
}
public int getTax() {
//System.out.println(">>getTax") ;
//System.out.println(">>getTax on salary " + salary) ;
if (location.equals("OUTSIDE")) return 0 ;
double salary_ = (double) salary ;
double tax = 0 ;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment