This commit is contained in:
David Anderson 2010-08-02 11:55:59 -07:00
Родитель 69f2ff9480
Коммит ebf7376256
3 изменённых файлов: 18 добавлений и 53 удалений

Просмотреть файл

@ -33,7 +33,7 @@ class UCT:
self.maxNodes = self.numPlayouts * 20
self.loops = loops
self.enableLoops = enableLoops
self.maturityThreshold = 50
self.maturityThreshold = 20
self.originalBest = bestTime
self.bestTime = bestTime
self.bias = 20
@ -76,7 +76,7 @@ class UCT:
return self.zobrist[zash]
self.bm.generateBanList(self.loops, queue)
result = self.bm.treeSearchRun(self.fd, ['-m', '-j'], 2)
result = self.bm.treeSearchRun(self.fd, ['-m', '-j'], 3)
self.zobrist[zash] = result
return result
@ -113,7 +113,7 @@ class UCT:
if int(origScore) < int(self.bestTime):
print('New best score: {0:f}ms'.format(origScore))
self.combos = []
self.combos = [history]
self.bestTime = origScore
elif int(origScore) == int(self.bestTime):
self.combos.append(history)
@ -128,7 +128,16 @@ class UCT:
self.step(loopList)
# Build the expected combination vector.
print('Best time: {0:f}ms'.format(self.bestTime))
combos = [ ]
for combo in self.combos:
vec = [ ]
for i in range(0, len(self.loops)):
vec.append(int(self.enableLoops))
for node in combo:
vec[node.loop] = int(not self.enableLoops)
combos.append(vec)
return [self.bestTime, combos]
class Benchmark:
def __init__(self, JS, fname):
@ -261,8 +270,8 @@ class Benchmark:
enableLoops = False
uct = UCT(self, combinedTime, enableLoops, counters[:], fd, 100000)
result = uct.run()
uct = UCT(self, combinedTime, enableLoops, counters[:], fd, 50000)
return uct.run()
def treeSearch(self):
fd, counters = self.ppForTreeSearch()
@ -286,7 +295,7 @@ class Benchmark:
else:
upperBound = int(upperBound / 1000)
delta = datetime.timedelta(seconds = upperBound)
if upperBound <= 18:
if upperBound < 180:
print('Estimating {0:d}s to test, so picking exhaustive '.format(int(upperBound)))
else:
print('Estimating {0:s} to test, so picking tree search '.format(str(delta)))
@ -306,7 +315,7 @@ class Benchmark:
print('Tracing JIT: {0:d}ms'.format(int(tracerTime)))
print('Combined: {0:d}ms'.format(int(combinedTime)))
if treeSearch:
if 1 and treeSearch:
results = self.internalTreeSearch(params)
else:
results = self.internalExhaustiveSearch(params)

Просмотреть файл

@ -201,7 +201,7 @@ BenchmarkSuite.prototype.NotifyError = function(error) {
BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark) {
var elapsed = 0;
var start = new Date();
for (var n = 0; elapsed < 50; n++) {
for (var n = 0; elapsed < 200; n++) {
benchmark.run();
elapsed = new Date() - start;
}

Просмотреть файл

@ -1,44 +0,0 @@
// Copyright 2008 Google Inc. All Rights Reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load('base.js');
load('deltablue.js');
function PrintResult(name, result) {
print(name + ': ' + result);
}
function PrintScore(score) {
print('----');
print('Score: ' + score);
}
BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
NotifyScore: PrintScore });