コード例 #1
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)
コード例 #2
0
ファイル: 6machine.py プロジェクト: kartikeya1994/industrysim
"""
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()
コード例 #3
0
ファイル: example.py プロジェクト: kartikeya1994/industrysim
		'sigma':1
	}
}
mt_labor = {
	'cm':[1,2,2],
	'high':[1,1,2],
	'low':[0,1,1]
}

eta = 1000.0
beta = 2.0
age = 0.0

name = 'FnC1'
compatible_jobs = {'A', 'B'}
pm_plan={'FnC1':'HIGH'}

mt_task = MaintenanceTask(eta=eta, beta=beta, age=age, fixed_cost=mt_fixed_cost, 
							RF=mt_RF, labor_req=mt_labor, ttr=mt_ttr)
machine = Machine(name=name, compatible_jobs=compatible_jobs, maintenance_task=mt_task, epoch_length=epoch_length)

policy = Policy('SJF', pm_plan)

env = IndustrySim(machines=[machine], epoch_length=epoch_length, max_labor=max_labor,
					wages=wages, job_demand=job_demand, delay_penalty=delay_penalty)

#begin simulation
for i in range(max_epochs):
	epoch_result = env.run_epoch(policy=policy)
	print(str(epoch_result))
	print('')