Beispiel #1
0
func TestOverviewSwarm(t *testing.T) {
	maxeval := 50000
	avgeval := 7500.00
	successfrac := 1.00

	for _, fn := range bench.Basic {
		sfn := func() *optim.Solver {
			return &optim.Solver{
				Method:  swarmsolver(fn, nil, -1),
				Obj:     optim.Func(fn.Eval),
				MaxEval: maxeval,
			}
		}
		bench.Benchmark(t, fn, sfn, successfrac, avgeval)
	}
}
Beispiel #2
0
func TestBenchSwarmRastrigin(t *testing.T) {
	ndim := 20
	npar := 30
	maxeval := 30000
	avgeval := 18000.0
	successfrac := 0.50

	fn := bench.Rastrigin{ndim}
	sfn := func() *optim.Solver {
		return &optim.Solver{
			Method:  swarmsolver(fn, nil, npar),
			Obj:     optim.Func(fn.Eval),
			MaxEval: maxeval,
		}
	}
	bench.Benchmark(t, fn, sfn, successfrac, avgeval)
}
Beispiel #3
0
func TestBenchSwarmGriewank(t *testing.T) {
	ndim := 30
	npar := 30
	maxeval := 120000
	avgeval := 80000.0
	successfrac := 0.80

	fn := bench.Griewank{ndim}
	sfn := func() *optim.Solver {
		return &optim.Solver{
			Method:  swarmsolver(fn, nil, npar),
			Obj:     optim.Func(fn.Eval),
			MaxEval: maxeval,
		}
	}
	bench.Benchmark(t, fn, sfn, successfrac, avgeval)
}
Beispiel #4
0
func TestBenchPSwarmRosen(t *testing.T) {
	ndim := 30
	npar := 30
	maxeval := 300000
	avgeval := 10000.0
	successfrac := 1.0

	fn := bench.Rosenbrock{ndim}
	sfn := func() *optim.Solver {
		m, mesh := pswarmsolver(fn, nil, npar)
		return &optim.Solver{
			Method:  m,
			Obj:     optim.Func(fn.Eval),
			Mesh:    mesh,
			MaxEval: maxeval,
		}
	}
	bench.Benchmark(t, fn, sfn, successfrac, avgeval)
}
Beispiel #5
0
func TestOverviewPattern(t *testing.T) {
	maxeval := 20000
	avgeval := 15000.0
	successfrac := 0.23

	// ONLY test plain pattern search on convex functions
	for _, fn := range []bench.Func{bench.Rosenbrock{NDim: 2}} {
		sfn := func() *optim.Solver {
			m, mesh := patternsolver(fn, nil)
			return &optim.Solver{
				Method:  m,
				Obj:     optim.Func(fn.Eval),
				Mesh:    mesh,
				MaxEval: maxeval,
			}
		}
		bench.Benchmark(t, fn, sfn, successfrac, avgeval)
	}
}