Exemple #1
0
def create_emas_params(agents_count, agent_population, time_matrix, stages):
    JOBS_COUNT = len(time_matrix[0])
    return {
        "agents": unnamed_agents(agents_count, AggregateAgent),
        "aggregated_agents": lambda: flowshop_agents_initializer(agent_population, JOBS_COUNT, agents_count),
        "emas": EmasService,

        "minimal_energy": lambda: 0,
        "reproduction_minimum": lambda: 90,
        "migration_minimum": lambda: 120,
        "newborn_energy": lambda: 100,
        "transferred_energy": lambda: 40,

        "initializer": lambda: PermutationInitializer(JOBS_COUNT),
        "evaluation": lambda: FlowShopEvaluation(time_matrix),
        "crossover": lambda: FirstHalfSwapsCrossover(),
        "mutation": lambda: PermutationMutation(2) if stages == 0 else MemeticPermutationMutation(stages, 8, 2),

        "migration": ParentMigration
    }
Exemple #2
0
from pyage.core.migration import Pyro4Migration
from pyage.core.statistics import TimeStatistics
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
Exemple #3
0
from pyage.core.stats.statistics import  TimeStatistics
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

ns_hostname = lambda: os.environ['NS_HOSTNAME']
pyro_daemon = Pyro4.Daemon()
Exemple #4
0
from pyage.core.emas import EmasService
from pyage.core.locator import TorusLocator
from pyage.core.migration import ParentMigration
from pyage.core.stats.gnuplot import StepStatistics
from pyage.core.stop_condition import StepLimitStopCondition
from pyage.solutions.evolution.crossover import SinglePointCrossover
from pyage.solutions.evolution.evaluation import FloatRastriginEvaluation
from pyage.solutions.evolution.initializer import float_emas_initializer
from pyage.solutions.evolution.mutation import NormalMutation


logger = logging.getLogger(__name__)

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

stop_condition = lambda: StepLimitStopCondition(1000)

aggregated_agents = lambda: float_emas_initializer(40, energy=100, size=50, lowerbound=-10, upperbound=10)

emas = EmasService

minimal_energy = lambda: 0
reproduction_minimum = lambda: 90
migration_minimum = lambda: 120
newborn_energy = lambda: 100
transferred_energy = lambda: 40

evaluation = FloatRastriginEvaluation
crossover = SinglePointCrossover
Exemple #5
0
from pyage.core.emas import EmasService
from pyage.core.locator import TorusLocator
from pyage.core.migration import Pyro4Migration
from pyage.core.stats.statistics import NoStatistics
from pyage.core.stop_condition import StepLimitStopCondition
from pyage.solutions.evolution.crossover import SinglePointCrossover
from pyage.solutions.evolution.evaluation import FloatRastriginEvaluation
from pyage.solutions.evolution.initializer import float_emas_initializer
from pyage.solutions.evolution.mutation import NormalMutation


logger = logging.getLogger(__name__)

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

stop_condition = lambda: StepLimitStopCondition(100)

aggregated_agents = lambda: float_emas_initializer(40, energy=100, size=50, lowerbound=-10, upperbound=10)

emas = EmasService

minimal_energy = lambda: 0
reproduction_minimum = lambda: 90
migration_minimum = lambda: 120
newborn_energy = lambda: 100
transferred_energy = lambda: 40

evaluation = FloatRastriginEvaluation
crossover = SinglePointCrossover
Exemple #6
0
# 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
simulate_in_overlaps = lambda: True
overlap_simulation_agent_turnaround = lambda: True

ns_hostname = lambda: os.environ['NS_HOSTNAME']

agents = net_agent(NetAgent, net_agents_per_host, net_agents_per_line,
                   ns_hostname)
sub_agents = unnamed_agents(agents_per_net, SubAgent)

address_provider = SequenceAddressProvider
migration = CrossBorderMigration

locator = ParentLocator
pyro_daemon = Pyro4.Daemon()
daemon = lambda: pyro_daemon

stats = lambda: PositionStatistics(
    "../positions/langtons_ant_positions_%05d.txt")