Esempio n. 1
0
from pyage.core.stop_condition import StepLimitStopCondition
from pyage.solutions.evolution.crossover import AverageFloatCrossover
from pyage.solutions.evolution.evaluation import FloatRastriginEvaluation
from pyage.solutions.evolution.initializer import FloatInitializer
from pyage.solutions.evolution.mutation import UniformFloatMutation
from pyage.solutions.evolution.selection import TournamentSelection

logger = logging.getLogger(__name__)

agents_count = int(os.environ['AGENTS'])
logger.debug("AGGREGATE, %s agents", agents_count)

agents = generate_agents("agent", agents_count, AggregateAgent)
aggregated_agents = unnamed_agents(2, Agent)

stop_condition = lambda: StepLimitStopCondition(100)

size = 500
operators = lambda: [
    FloatRastriginEvaluation(),
    TournamentSelection(size=55, tournament_size=30),
    AverageFloatCrossover(size=size),
    UniformFloatMutation(probability=0.05, radius=1)
]
initializer = lambda: FloatInitializer(500, size, -10, 10)

address_provider = address.SequenceAddressProvider

migration = Pyro4Migration
locator = RandomLocator
Esempio n. 2
0
from pyage.core.address import SequenceAddressProvider
from pyage.core.agent.agent import unnamed_agents
from pyage.core.locator import ParentLocator
from pyage.core.stop_condition import StepLimitStopCondition
from langtons_ant.agent import NetAgent, SubAgent
from langtons_ant.layer import ColorLayer
from langtons_ant.statistics import PositionStatistics
from langtons_ant.vector import Vector
from langtons_ant.migration import CrossBorderMigration
from langtons_ant.net_agents_creation import net_agent
from math import sqrt

logger = logging.getLogger(__name__)

number_of_iterations = lambda: 1000
stop_condition = lambda: StepLimitStopCondition(number_of_iterations())
net_dimensions = lambda: Vector(100, 100)

# Distributed environment settings
number_of_hosts = lambda: 16
global_number_of_net_agents = lambda: 16  # square root must be an integer
net_agents_per_host = lambda: global_number_of_net_agents() / number_of_hosts()
net_agents_per_line = lambda: int(sqrt(global_number_of_net_agents()))
waiting_interval = lambda: 3  # frequency of checking presence of all net_agents (in seconds)
# ================================

agents_per_net = 35
layers = lambda: [ColorLayer()]

iterations_per_update = lambda: 50
overlap_size = lambda: 5