Commit 7e026948 authored by Alan White's avatar Alan White

Autorun test

parent 28c38c8e
Pipeline #2365553 skipped
File added
echo "Start run for 7 - 10" >> testRun.log
echo "Start run for 3, 4, 6, 8, 100" >> testRun.log
rm mmas-*.log*
rm planner/*.pddl
rm planner/*.SOL
rm replanTest.mas2j
python createExperimentConfig.py replan-template.mas2j replanTest paperWorld1 nrisk3 ndebil075 7
python createExperimentConfig.py replan-template.mas2j replanTest paperWorld2 nrisk2 ndebil0 3
java -jar campBDI.jar replanTest.mas2j
echo "Completed run for 7" >> testRun.log
echo "Completed run for 3" >> testRun.log
rm mmas-*.log*
rm planner/*.pddl
rm planner/*.SOL
rm replanTest.mas2j
python createExperimentConfig.py replan-template.mas2j replanTest paperWorld1 nrisk3 ndebil075 8
python createExperimentConfig.py replan-template.mas2j replanTest paperWorld2 nrisk2 ndebil0 4
java -jar campBDI.jar replanTest.mas2j
echo "Completed run for 8" >> testRun.log
echo "Completed run for 4" >> testRun.log
rm mmas-*.log*
rm planner/*.pddl
rm planner/*.SOL
rm replanTest.mas2j
python createExperimentConfig.py replan-template.mas2j replanTest paperWorld1 nrisk3 ndebil075 9
python createExperimentConfig.py replan-template.mas2j replanTest paperWorld2 nrisk2 ndebil0 6
java -jar campBDI.jar replanTest.mas2j
echo "Completed run for 9" >> testRun.log
echo "Completed run for 6" >> testRun.log
rm mmas-*.log*
rm planner/*.pddl
rm planner/*.SOL
rm replanTest.mas2j
python createExperimentConfig.py replan-template.mas2j replanTest paperWorld2 nrisk2 ndebil0 8
java -jar campBDI.jar replanTest.mas2j
echo "Completed run for 8" >> testRun.log
rm mmas-*.log*
rm planner/*.pddl
rm planner/*.SOL
rm replanTest.mas2j
python createExperimentConfig.py replan-template.mas2j replanTest paperWorld1 nrisk3 ndebil075 10
python createExperimentConfig.py replan-template.mas2j replanTest paperWorld2 nrisk2 ndebil0 10
java -jar campBDI.jar replanTest.mas2j
echo "Completed run for 10" >> testRun.log
\ No newline at end of file
......@@ -10,6 +10,7 @@ import static truckworld.env.Percepts.TOXIC;
import static truckworld.env.Percepts.TOXIC_ROAD;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
......@@ -487,86 +488,96 @@ public class WorldBeliefBase extends DefaultBeliefBase {
public synchronized BeliefBase clone(){
return geoCopy(new WorldBeliefBase());
}
private WorldBeliefBase geoCopy(final WorldBeliefBase bb) {
return geoCopy(bb, 1);
}
/**
* Used for world BB clone operations, so we can move it outside the clone() method and extend
* clone() elsewhere without having to rewrite this bit...
* @param bb
* @return
*/
protected WorldBeliefBase geoCopy(WorldBeliefBase bb) {
synchronized(this) {
long start = System.nanoTime();
//now setup the roads... copy roads, copy junctions...
private WorldBeliefBase geoCopy(final WorldBeliefBase bb, final int count) {
try {
//first, setup a new junction map...
Map<String, JunctionInf> jCopy =
new ConcurrentHashMap<String, JunctionInf>();
for(String key: getJunctions().keySet()){
jCopy.put(key, (JunctionInf)getJunctions().get(key).clone());
}
synchronized (this) {
long start = System.nanoTime();
// now setup the roads... copy roads, copy junctions...
try {
// first, setup a new junction map...
Map<String, JunctionInf> jCopy = new ConcurrentHashMap<String, JunctionInf>();
for (String key : getJunctions().keySet()) {
jCopy.put(key, (JunctionInf) getJunctions().get(key).clone());
}
//then, setup a new road map using jCopy
Map<String, RoadInf> rCopy =
new ConcurrentHashMap<String, RoadInf>();
for(String key: getRoads().keySet()) {
rCopy.put(key, (RoadInf)getRoads().get(key).clone());
}
// then, setup a new road map using jCopy
Map<String, RoadInf> rCopy = new ConcurrentHashMap<String, RoadInf>();
for (String key : getRoads().keySet()) {
rCopy.put(key, (RoadInf) getRoads().get(key).clone());
}
//copy id mapping
Map<String, String> ridCopy =
new ConcurrentHashMap<String, String>();
for(String key: roadIds.keySet()) {
ridCopy.put(key, roadIds.get(key));
}
// copy id mapping
Map<String, String> ridCopy = new ConcurrentHashMap<String, String>();
for (String key : roadIds.keySet()) {
ridCopy.put(key, roadIds.get(key));
}
//copy refuel, etc...
Collection<String> citiesCopy = new Vector<String>();
Collection<String> villagesCopy = new Vector<String>();
Collection<String> airportsCopy = new Vector<String>();
Collection<String> seaportsCopy = new Vector<String>();
Collection<String> refuelStationsCopy = new Vector<String>();
Collection<String> repairStationsCopy = new Vector<String>();
citiesCopy.addAll(this.cities);
villagesCopy.addAll(this.villages);
airportsCopy.addAll(this.airports);
seaportsCopy.addAll(this.seaports);
refuelStationsCopy.addAll(this.refuelStations);
repairStationsCopy.addAll(this.repairStations);
//finally, set!
bb.setJunctions(junctions);
bb.setRoadIds(ridCopy);
bb.setRoads(rCopy);
bb.setAirports(airportsCopy);
bb.setSeaports(seaportsCopy);
bb.setRefuelStations(refuelStationsCopy);
bb.setRepairStations(repairStationsCopy);
bb.setVillages(villagesCopy);
bb.setCities(citiesCopy);
for(String dz: getDangerZones()) {
bb.customAdd(ASSyntax.createLiteral("dangerZone", ASSyntax.createString(dz)));
}
} catch (CloneNotSupportedException e) {
logger.severe(e.toString());
e.printStackTrace();
}
// copy refuel, etc...
Collection<String> citiesCopy = new Vector<String>();
Collection<String> villagesCopy = new Vector<String>();
Collection<String> airportsCopy = new Vector<String>();
Collection<String> seaportsCopy = new Vector<String>();
Collection<String> refuelStationsCopy = new Vector<String>();
Collection<String> repairStationsCopy = new Vector<String>();
citiesCopy.addAll(this.cities);
villagesCopy.addAll(this.villages);
airportsCopy.addAll(this.airports);
seaportsCopy.addAll(this.seaports);
refuelStationsCopy.addAll(this.refuelStations);
repairStationsCopy.addAll(this.repairStations);
// finally, set!
bb.setJunctions(junctions);
bb.setRoadIds(ridCopy);
bb.setRoads(rCopy);
bb.setAirports(airportsCopy);
bb.setSeaports(seaportsCopy);
bb.setRefuelStations(refuelStationsCopy);
bb.setRepairStations(repairStationsCopy);
bb.setVillages(villagesCopy);
bb.setCities(citiesCopy);
for (String dz : getDangerZones()) {
bb.customAdd(ASSyntax.createLiteral("dangerZone", ASSyntax.createString(dz)));
}
} catch (CloneNotSupportedException e) {
logger.severe(e.toString());
e.printStackTrace();
}
long cloneLit = System.nanoTime();
Iterator<Literal> all = iterator();
while(all.hasNext()) {
Literal b = all.next();
Literal bCopy = b.copy();
if(b.hasAnnot()) {
for(Term annot: b.getAnnots()) { bCopy.addAnnot(annot.clone()); }
long cloneLit = System.nanoTime();
Iterator<Literal> all = iterator();
while (all.hasNext()) {
Literal b = all.next();
Literal bCopy = b.copy();
if (b.hasAnnot()) {
for (Term annot : b.getAnnots()) {
bCopy.addAnnot(annot.clone());
}
}
bb.addForClone(bCopy);
}
bb.addForClone(bCopy);
long nanoTime = System.nanoTime();
Analytics.getInstance().logTime(AnalyticsOperations.cloneBBLiterals, nanoTime - cloneLit);
Analytics.getInstance().logTime(AnalyticsOperations.cloneBeliefBase, nanoTime - start);
return bb;
}
long nanoTime = System.nanoTime();
Analytics.getInstance().logTime(AnalyticsOperations.cloneBBLiterals, nanoTime-cloneLit);
Analytics.getInstance().logTime(AnalyticsOperations.cloneBeliefBase, nanoTime-start);
return bb;
}
} catch (ConcurrentModificationException e) {
if (count < 4) {
return this.geoCopy(bb, count + 1);
} else {
throw new RuntimeException(e);
}
}
}
//get/set methods intended for cloning...
......
fail, dependencyCancel, confirmContractWithObligant, obligantAccept, succeed, obligantRefuse, do, updatedContract
8, 39, 1037, 1037, 1014, 16, 1022, 30
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
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