|
15 | 15 | import com.mzlabs.count.op.impl.ThreadedSum; |
16 | 16 | import com.mzlabs.count.op.iter.OrderStepperTot; |
17 | 17 | import com.mzlabs.count.util.IntVec; |
| 18 | +import com.mzlabs.count.util.LinearFitter; |
18 | 19 | import com.mzlabs.count.zeroone.ZeroOneCounter; |
19 | 20 |
|
20 | 21 |
|
@@ -219,17 +220,35 @@ public static BigInteger debugConfirmSqTables(final int rowsCols, final int tota |
219 | 220 | } |
220 | 221 |
|
221 | 222 | public static void main(final String[] args) { |
222 | | - System.out.println("n" + "\t" + "total" + "\t" + "count" + "\t" + "date" + "\t" + "cacheSizes"); |
223 | | - for(int n=1;n<=10;++n) { |
| 223 | + System.out.println("n" + "\t" + "total" + "\t" + "target" + "\t" + "count" + "\t" + "date" + "\t" + "cacheSizes" + "\t" + "tableFinishTimeEst"); |
| 224 | + for(int n=8;n<=10;++n) { |
224 | 225 | final CTab ctab = new CTab(n,true); |
225 | | - for(int total=0;total<=(n*n-3*n+2)/2;++total) { |
| 226 | + final LinearFitter lf = new LinearFitter(1); |
| 227 | + final int tLast = (n*n-3*n+2)/2; |
| 228 | + for(int total=0;total<=tLast;++total) { |
| 229 | + final Date startTime = new Date(); |
226 | 230 | final BigInteger count = ctab.countSqTables(n,total); |
227 | 231 | final String cacheSizes = ctab.cacheSizesString(); |
228 | | - ctab.clearCaches(); |
229 | | - System.out.println("" + n + "\t" + total + "\t" + count + "\t" + new Date() + "\t" + cacheSizes); |
| 232 | + final Date curTime = new Date(); |
| 233 | + long remainingTimeEstMS = 10000; |
| 234 | + if(total>0) { |
| 235 | + // simplistic model: log(time) ~ a + b*size |
| 236 | + final double[] x = { total }; |
| 237 | + final double y = 10000.0+curTime.getTime() - startTime.getTime(); |
| 238 | + lf.addObservation(x, Math.log(y), y); |
| 239 | + final double[] beta = lf.solve(); |
| 240 | + double timeEstMS = 0.0; |
| 241 | + for(int j=total+1;j<=tLast;++j) { |
| 242 | + final double predict = LinearFitter.predict(beta,new double[] {j}); |
| 243 | + timeEstMS += Math.exp(predict); |
| 244 | + } |
| 245 | + remainingTimeEstMS = (long)Math.ceil(timeEstMS); |
| 246 | + } |
| 247 | + final Date finishTimeEst = new Date(curTime.getTime()+remainingTimeEstMS); |
| 248 | + System.out.println("" + n + "\t" + total + "\t" + tLast + "\t" + count + "\t" + curTime + "\t" + cacheSizes + "\t" + finishTimeEst); |
230 | 249 | } |
| 250 | + ctab.clearCaches(); |
231 | 251 | } |
232 | | - //System.out.println("total evals: " + SolnCache.totalEvals); |
233 | 252 | } |
234 | 253 |
|
235 | 254 | } |
0 commit comments