Commit 7715504f authored by Mahesh Tripunitara's avatar Mahesh Tripunitara
Browse files

TimingManager.time --> .timeR. Other cosmetic fixes to remove warnings. And tweaks to test input.

parent 8cd09a42
......@@ -249,7 +249,7 @@ public class RunSolverCNFSAT implements RunSolver {
timing = VagabondSettings.getInstance().timing;
}
/*TIMING*/ timing.toggleTime("RunSolverCNFSAT::run");
/*TIMING*/ timing.toggleTimer("RunSolverCNFSAT::run");
// Get CNF-SAT instance from ReduceTo argument to load().
// Run the solver. Get raw string result. Then invoke
......@@ -291,27 +291,27 @@ public class RunSolverCNFSAT implements RunSolver {
List<String> cnfcert = null;
// certificate from cnf-sat
// Binary search
/*TIMING*/ timing.toggleTime("RunSolverCNFSAT::run::binarySearch");
/*TIMING*/ timing.toggleTimer("RunSolverCNFSAT::run::binarySearch");
for (int mid = hi; hi >= lo; mid = (hi + lo) / 2) {
/*TIMING*/ timing.toggleTime("RunSolverCNFSAT::run::binarySearch::loopVal=" + mid);
/*TIMING*/ timing.toggleTimer("RunSolverCNFSAT::run::binarySearch::loopVal=" + mid);
// System.out.println("mid = "+mid); System.out.flush();
try {
constraintInfoLeakUb(c, le, s, nclientpairs, mid);
/*TIMING*/ timing.toggleTime("RunSolverCNFSAT::run::binarySearch::cnfSatToFile " + mid);
/*TIMING*/ timing.toggleTimer("RunSolverCNFSAT::run::binarySearch::cnfSatToFile " + mid);
// Now convert to cnf, invoke solver and adjust mid as needed.
CircuitUtils.cnfSatToFile(c, cnfloc);
/*TIMING*/ timing.toggleTime("RunSolverCNFSAT::run::binarySearch::cnfSatToFile " + mid);
/*TIMING*/ timing.toggleTimer("RunSolverCNFSAT::run::binarySearch::cnfSatToFile " + mid);
/*TIMING*/ timing.writeOutSingle(fw, "RunSolverCNFSAT::run::binarySearch::cnfSatToFile " + mid);
/*TIMING*/ timing.toggleTime("RunSolverCNFSAT::run::binarySearch::exec " + mid);
/*TIMING*/ timing.toggleTimer("RunSolverCNFSAT::run::binarySearch::exec " + mid);
Process p = Runtime.getRuntime().exec(solverloc + " " + cnfloc);
// Activate the following 'if,' if we want to put in a time-limit for every decision instance.
if(mid < hi && EACH_DECISION_INSTANCE_TIMEOUT > 0 && !p.waitFor(EACH_DECISION_INSTANCE_TIMEOUT, TimeUnit.SECONDS)) {
// Treat this as unsat
lo = mid+1;
/*TIMING*/ timing.toggleTime("RunSolverCNFSAT::run::binarySearch::exec " + mid);
/*TIMING*/ timing.toggleTimer("RunSolverCNFSAT::run::binarySearch::exec " + mid);
/*TIMING*/ timing.writeOutSingle(fw,"RunSolverCNFSAT::run::binarySearch::exec " + mid);
continue;
}
......@@ -337,7 +337,7 @@ public class RunSolverCNFSAT implements RunSolver {
recordlines = true;
}
}
/*TIMING*/ timing.toggleTime("RunSolverCNFSAT::run::binarySearch::exec " + mid);
/*TIMING*/ timing.toggleTimer("RunSolverCNFSAT::run::binarySearch::exec " + mid);
/*TIMING*/ timing.writeOutSingle(fw,"RunSolverCNFSAT::run::binarySearch::exec " + mid);
if(!recordlines) lo = mid + 1; // unsat
......@@ -358,9 +358,9 @@ public class RunSolverCNFSAT implements RunSolver {
/*TIMING*/ timing.cancelTimer("RunSolverCNFSAT::run");
return null;
}
/*TIMING*/ timing.toggleTime("RunSolverCNFSAT::run::binarySearch::loopVal=" + mid);
/*TIMING*/ timing.toggleTimer("RunSolverCNFSAT::run::binarySearch::loopVal=" + mid);
}
/*TIMING*/ timing.toggleTime("RunSolverCNFSAT::run::binarySearch");
/*TIMING*/ timing.toggleTimer("RunSolverCNFSAT::run::binarySearch");
// Build an epochhistory data structure as required by this function's signature
if (cnfcert == null) {
......@@ -370,7 +370,7 @@ public class RunSolverCNFSAT implements RunSolver {
EpochHistory ret = new EpochHistory(1);
ret.add(PlacementMapFromCNFSATSolver.getPlacementMap(_r, cnfcert));
/*TIMING*/ timing.toggleTime("RunSolverCNFSAT::run");
/*TIMING*/ timing.toggleTimer("RunSolverCNFSAT::run");
/*TIMING*/ timing.writeOutSingle(fw,"RunSolverCNFSAT::run");
return ret;
......
......@@ -57,7 +57,7 @@ public class CNFEverythingTests {
@Test
public void equalSpreadBiggerTest() throws Exception {
int testparam = 12;
int migbudget = 144;
int migbudget = 4;
VagabondSettings vs = VagabondSettings.getInstance();
vs.migrationBudget = new Integer(migbudget);
vs.numberOfClients = new Integer(testparam);
......
......@@ -20,8 +20,7 @@ public class MultCircTest {
* @throws Exception bad things may happen
*/
public static void main(String[] args) throws Exception {
RunSolverCNFSAT r = new RunSolverCNFSAT();
Circuit c = r.multCirc(4, 6);
Circuit c = RunSolverCNFSAT.multCirc(4, 6);
List<Boolean> bl = new LinkedList<Boolean>();
bl.clear();
......@@ -56,7 +55,7 @@ public class MultCircTest {
res = c.evaluate(bl);
System.out.println(res);
c = r.multCirc(5, 4);
c = RunSolverCNFSAT.multCirc(5, 4);
bl.clear();
bl.add(new Boolean(true));
bl.add(new Boolean(true));
......
......@@ -23,7 +23,6 @@ import vagabond.circuit.LessEquals;
import vagabond.circuit.Sum;
import vagabond.pieces.EpochHistory;
import vagabond.pieces.Machine;
import vagabond.pieces.PlacementMap;
import vagabond.reduction.cnfsat.PlacementMapFromCNFSATSolver;
import vagabond.reduction.cnfsat.ReduceToCNFSAT;
import vagabond.reduction.cnfsat.RunSolverCNFSAT;
......
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