Beispiel #1
0
"""
State consists of (in order):
machine params:
	pending jobs in last epoch
	machine age
last epoch params:
	free labour
next epoch demand:
	avg due after
delay penalty

reward = objfun, cost

"""
env = IndustrySim(machines=[machine1,machine2, machine3, machine4, machine5, machine6], epoch_length=epoch_length, max_labor=max_labor,
					wages=wages, job_demand=job_demand, delay_penalty=delay_penalty, state_size=state_size)
start = time.time()
env.reset()
res = EpochResult(None, None, None)

nn = NN(dim_input=state_size, dim_hidden_layers=nn_arch, dim_output=action_size, do_dropout=True)

states = np.zeros((max_epochs, state_size))
actions = np.zeros((max_epochs, action_size))
rewards = np.zeros(max_epochs)
state = np.zeros(state_size)

# hyper params
e = 0.2
training_passes = 20000
start = time.time()
Beispiel #2
0
from entities import Policy, Machine, MaintenanceTask, EpochResult, PeriodicPolicy
from engine import IndustrySim
from tools import e_greedy, NN
import numpy as np
import time
from industry import epoch_length, max_epochs, max_labor, wages, num_machines, job_demand
from industry import delay_penalty, mt_fixed_cost, mt_RF, mt_ttr, mt_labor, beta, age
from industry import compatible_jobs, machine_names, mt_task1, mt_task2, mt_task3
from industry import machine1, machine2, machine3

env = IndustrySim(machines=[machine1, machine2, machine3],
                  epoch_length=epoch_length,
                  max_labor=max_labor,
                  wages=wages,
                  job_demand=job_demand,
                  delay_penalty=delay_penalty)
start = time.time()
env.reset()
res = EpochResult(None, None, None)

experiments = 300
start = time.time()
avg_obj = 0
high_jobs = {'FnC1': 0, 'Lathe': 0, 'Milling': 0}
low_jobs = {'FnC1': 0, 'Lathe': 0, 'Milling': 0}
for exp in range(experiments):
    pp = PeriodicPolicy(machine_names=machine_names, epoch_interval=5)
    for i in range(max_epochs):
        epoch_result = env.run_epoch(pp.get_policy())
    res = env.get_result()
    print(res)