Пример #1
0
func BenchmarkEvaluateMany(b *testing.B) {
	const (
		ni = 2
		no = 1000
	)

	fixture := &fixture{
		rule:   "closed",
		target: many(ni, no),
		surrogate: &algorithm.Surrogate{
			Inputs:  ni,
			Outputs: no,
		},
	}
	fixture.initialize()

	algorithm, strategy := prepare(fixture)
	surrogate := algorithm.Compute(fixture.target, strategy)
	points := generate(surrogate)

	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		algorithm.Evaluate(surrogate, points)
	}
}
Пример #2
0
func BenchmarkComputeHat(b *testing.B) {
	fixture := &fixtureHat
	algorithm, strategy := prepare(fixture)

	for i := 0; i < b.N; i++ {
		algorithm.Compute(fixture.target, strategy)
	}
}
Пример #3
0
func BenchmarkComputeBox(b *testing.B) {
	fixture := &fixtureBox
	algorithm, strategy := prepare(fixture)
	strategy.(*Strategy).lmax = 9

	for i := 0; i < b.N; i++ {
		algorithm.Compute(fixture.target, strategy)
	}
}
Пример #4
0
func BenchmarkEvaluateHat(b *testing.B) {
	fixture := &fixtureHat
	algorithm, strategy := prepare(fixture)
	surrogate := algorithm.Compute(fixture.target, strategy)
	points := generate(surrogate)

	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		algorithm.Evaluate(surrogate, points)
	}
}
Пример #5
0
func BenchmarkComputeMany(b *testing.B) {
	const (
		ni = 2
		no = 1000
	)

	fixture := &fixture{
		rule:   "closed",
		target: many(ni, no),
		surrogate: &algorithm.Surrogate{
			Inputs:  ni,
			Outputs: no,
		},
	}
	fixture.initialize()

	algorithm, strategy := prepare(fixture)

	for i := 0; i < b.N; i++ {
		algorithm.Compute(fixture.target, strategy)
	}
}