Esempio n. 1
0
 def test_generate_matrix_of_points_in_cube(self):
     """Test generate matrix of points in cube."""
     num_of_points = 20
     side_length = 100
     gen = generate_matrix_of_points_in_cube(center=matrix([0, 0, 0]),
                                             side_length=side_length,
                                             num_of_points=num_of_points)
     for i in range(20):
         points = next(gen)
         assert (num_of_points, 3) == points.shape
         assert (points < (side_length / 2)).all()
         assert (points > (-side_length / 2)).all()
Esempio n. 2
0
# Load parameters configuration
#   error introduced
#   inertial weight
#   cognition
#   social
#   number of particles
#   max particle velocity
#   interations per particle
# log_config = "examples/benchmark_1.config1.json"
params = data['parameters']
# Load space where happen the simulation
center = matrix(data['space']['center'])
side_length = data['space']['side_length']

base_generator = generate_matrix_of_points_in_cube(center=center,
                                                   side_length=side_length,
                                                   num_of_points=4)
point_generator = generate_matrix_of_points_in_cube(center=center,
                                                    side_length=side_length,
                                                    num_of_points=1)

base = next(base_generator)
point = next(point_generator)

random_generator = Random()

# Load logging configuration
log_config = "examples/benchmark_1.log.json"
with open(log_config) as data_file:
    data = json.load(data_file)
logging.config.dictConfig(data)
Esempio n. 3
0
# Load parameters configuration
#   error introduced
#   inertial weight
#   cognition
#   social
#   number of particles
#   max particle velocity
#   interations per particle
# log_config = "examples/benchmark_1.config1.json"
params = data['parameters']
# Load space where happen the simulation
center = matrix(data['space']['center'])
side_length = data['space']['side_length']

base_generator = generate_matrix_of_points_in_cube(
    center=center, side_length=side_length, num_of_points=4)
point_generator = generate_matrix_of_points_in_cube(
    center=center, side_length=side_length, num_of_points=1)

base = next(base_generator)
point = next(point_generator)

random_generator = Random()

# Load logging configuration
log_config = "examples/benchmark_1.log.json"
with open(log_config) as data_file:
    data = json.load(data_file)
logging.config.dictConfig(data)

logger = logging.getLogger("benchmark")