File: test_warm_start.py

package info (click to toggle)
python-cmaes 0.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 408 kB
  • sloc: python: 3,115; sh: 88; makefile: 4
file content (12 lines) | stat: -rw-r--r-- 400 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
import numpy as np
from unittest import TestCase
from cmaes import CMA, get_warm_start_mgd


class TestWarmStartCMA(TestCase):
    def test_dimension(self):
        optimizer = CMA(mean=np.zeros(10), sigma=1.3)
        source_solutions = [(optimizer.ask(), 0.0) for _ in range(100)]
        ws_mean, ws_sigma, ws_cov = get_warm_start_mgd(source_solutions)

        self.assertEqual(ws_mean.size, 10)