Commit 1d1f7490 authored by Kerstin Bach's avatar Kerstin Bach
Browse files

Removed observer notification to increase performance of the retrieval

parent a49d2c4d
<?xml version = "1.0" encoding = "utf-8"?>
<project name = "myCBR jar" default = "build" basedir = ".">
<property name = "mycbr_bin" value = "${user.dir}/bin"/>
<property name = "mycbr_src" value = "${user.dir}/src"/>
<property name = "mycbr_dist" value = "${user.dir}/dist"/>
<property name = "mycbr_doc" value = "${user.dir}/doc"/>
<property name = "targetVM" value = "1.5"/>
<property name = "version" value = "3.0.0BETA"/>
<property name = "jarName" value = "myCBR${version}.jar"/>
<property name = "zipName" value = "myCBR${version}.zip"/>
<!-- generates a jar file -->
<!-- =================================================================== -->
<target name = "generate_jar">
<mkdir dir="${mycbr_bin}"/>
<delete file="../de.dfki.mycbr.gui/lib/mycbr.jar" />
<jar destfile="../de.dfki.mycbr.gui/lib/mycbr.jar" >
<fileset dir="${mycbr_bin}">
<exclude name="**/junittest/**" />
</fileset>
</jar>
<mkdir dir="${mycbr_dist}"/>
<delete file="${mycbr_dist}/${jarName}" />
<jar destfile="${mycbr_dist}/${jarName}" >
<fileset dir="${mycbr_bin}">
<exclude name="**/junittest/**" />
</fileset>
</jar>
</target>
<!-- =================================================================== -->
<target name = "zip_sources">
<delete file="${mycbr_dist}/${zipName}" />
<zip destfile="${mycbr_dist}/${zipName}">
<fileset dir="${mycbr_src}">
<exclude name="**/junittest/**" />
</fileset>
</zip>
</target>
<target name="javadoc">
<mkdir dir="${mycbr_doc}"/>
<javadoc destdir="${mycbr_doc}" access="public">
<fileset dir="${mycbr_src}">
<exclude name="**/junittest/**" />
</fileset>
</javadoc>
</target>
<target name = "build" depends = "generate_jar,zip_sources" />
</project>
<?xml version = "1.0" encoding = "utf-8"?>
<project name = "myCBR jar" default = "build" basedir = ".">
<property name = "mycbr_bin" value = "${user.dir}/bin"/>
<property name = "mycbr_src" value = "${user.dir}/src"/>
<property name = "mycbr_dist" value = "${user.dir}/dist"/>
<property name = "mycbr_doc" value = "${user.dir}/doc"/>
<property name = "targetVM" value = "1.7"/>
<property name = "version" value = "3.2-BETA"/>
<property name = "jarName" value = "myCBR${version}.jar"/>
<property name = "zipName" value = "myCBR${version}.zip"/>
<!-- generates a jar file -->
<!-- =================================================================== -->
<target name = "generate_jar">
<mkdir dir="${mycbr_bin}"/>
<delete file="../de.dfki.mycbr.gui/lib/mycbr.jar" />
<jar destfile="../de.dfki.mycbr.gui/lib/mycbr.jar" >
<fileset dir="${mycbr_bin}">
<exclude name="**/junittest/**" />
</fileset>
</jar>
<mkdir dir="${mycbr_dist}"/>
<delete file="${mycbr_dist}/${jarName}" />
<jar destfile="${mycbr_dist}/${jarName}" >
<fileset dir="${mycbr_bin}">
<exclude name="**/junittest/**" />
</fileset>
</jar>
</target>
<!-- =================================================================== -->
<target name = "zip_sources">
<delete file="${mycbr_dist}/${zipName}" />
<zip destfile="${mycbr_dist}/${zipName}">
<fileset dir="${mycbr_src}">
<exclude name="**/junittest/**" />
</fileset>
</zip>
</target>
<target name="javadoc">
<mkdir dir="${mycbr_doc}"/>
<javadoc destdir="${mycbr_doc}" access="public">
<fileset dir="${mycbr_src}">
<exclude name="**/junittest/**" />
</fileset>
</javadoc>
</target>
<target name = "build" depends = "generate_jar,zip_sources" />
</project>
......@@ -690,7 +690,8 @@ public class Concept extends Observable implements IExplainable, Observer {
i = range.getInstance(name);
setChanged();
}
notifyObservers();
// TODO: check whether this is necessary
//notifyObservers();
return i;
}
......@@ -723,7 +724,8 @@ public class Concept extends Observable implements IExplainable, Observer {
boolean added = range.add(i);
if (added) {
setChanged();
notifyObservers();
// TODO: check whether this is necessary
//notifyObservers();
}
return added;
}
......
This diff is collapsed.
......@@ -128,4 +128,96 @@ public class StressTestsRetrieval {
e.printStackTrace();
}
}
@Test
public void testRetievalIncreasingCasesSymbols (){
int noAtts = 20;
int cases = 1;
int noCaseStep = 1000;
int maxNoCases = 11000;
long duration = 0L;
SimpleDateFormat dateFormat = new SimpleDateFormat();
dateFormat.applyPattern("h:mm:ss");
FileWriter fw = null;
try {
fw = new FileWriter(System.getProperty("user.dir") + "/src/test/projects/StressTest/testRetievalSymbolIncreasingCasesAndAttributes"+maxNoCases+".csv");
PrintWriter pw = new PrintWriter(fw);
pw.print("noAtts");
pw.print(",");
pw.print("noCases");
pw.print(",");
pw.print("duration");
pw.print("\n");
StressTestFramework stf = new StressTestFramework();
String projectPath = stf.initSymbolTestFramework(noAtts, cases, 4, 4);
Project p = new Project(projectPath);
while (p.isImporting()){
Thread.sleep(1);
}
cases++;
Concept mainDesc = p.getConceptByID("main");
DefaultCaseBase cb = (DefaultCaseBase) p.getCaseBases().get("casebase");
// create query
Retrieval r = new Retrieval(mainDesc, cb);
Instance query = r.getQueryInstance();
do{
// add Case
String caseName = "case" + String.valueOf(cases);
Instance instance = mainDesc.addInstance(caseName);
for (String attName : mainDesc.getAttributeDescs().keySet()){
instance.addAttribute(mainDesc.getAttributeDesc(attName), (int) (Math.random() * 100));
}
cb.addCase(instance);
for (String attName : mainDesc.getAttributeDescs().keySet()){
query.addAttribute(mainDesc.getAttributeDesc(attName), (int) (Math.random() * 100));
}
if (cases%1000 == 0){
// do retrieval
Date start = new Date();
r.setRetrievalMethod(Retrieval.RetrievalMethod.RETRIEVE_SORTED);
r.start();
Date end = new Date();
duration = end.getTime() - start.getTime();
System.out.println("end: "+ end.toString());
// adding results to writer
double dur = ((double) duration) / 1000;
DecimalFormat decFormat = new DecimalFormat("###,###,##0.000");
decFormat.format(dur);
pw.print(noAtts);
pw.print(",");
pw.print(r.getResult().size());
pw.print(",");
pw.print(dur);
pw.print("\n");
}
// counting
cases++;
} while (cases < maxNoCases);
pw.flush();
pw.close();
fw.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
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