File size: 2,779 Bytes
d4c7aae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import pandas as pd
import numpy as np
import importlib
import sys

# fmt:off
sys.path.append('../matrix_generator')

import cost_matrix_generator as cmg
importlib.reload(cmg)
# fmt:on

# Import Data
process_df = pd.read_csv('example/generated_process_data.csv')
employee_usage = pd.read_csv("example/generated_employee_usage.csv")
material_usage = pd.read_csv("example/generated_material_usage.csv")
capital_cost_usage = pd.read_csv("example/generated_captial_cost.csv")

# Data Extract and Shaping (Pre Processing)


def generate_data():
    # Material
    material_cost_matrix, material_amount_matrix = cmg.generate_material_usage_cost_matrix(
        process_df, material_usage)
    material_cost_matrix = material_cost_matrix.values
    material_amount_matrix = material_amount_matrix.values

    row, col = material_cost_matrix.shape
    material_cost_matrix = material_cost_matrix.reshape(row, 1, col)
    material_amount_matrix = material_amount_matrix.reshape(row, 1, col)

    # Employee
    monthy_employee_cost_matrix, daily_employee_cost_matrix = cmg.generate_employee_usage_cost_matrix(
        process_df, employee_usage)
    monthy_employee_cost_matrix = monthy_employee_cost_matrix.values
    daily_employee_cost_matrix = daily_employee_cost_matrix.values

    row, col = monthy_employee_cost_matrix.shape
    monthy_employee_cost_matrix = monthy_employee_cost_matrix.reshape(
        row, 1, col)
    row, col = daily_employee_cost_matrix.shape
    daily_employee_cost_matrix = daily_employee_cost_matrix.reshape(
        row, 1, col)
    print(
        f'Monthy Employee Cost matrix shape {monthy_employee_cost_matrix.shape} & Daily Employee Cost Matrix Shape {daily_employee_cost_matrix.shape}')

    # Capital Cost
    unit_cost_matrix, machine_hour_matrix, life_time_matrix = cmg.generate_capital_cost_matrix(
        process_df, capital_cost_df=capital_cost_usage)

    capital_cost_matrix = unit_cost_matrix.values

    machine_hour_matrix = machine_hour_matrix.values

    life_time_matrix = life_time_matrix.values

    row, col = capital_cost_matrix.shape

    capital_cost_matrix = capital_cost_matrix.reshape(row, 1, col)

    row, col = machine_hour_matrix.shape

    machine_hour_matrix = machine_hour_matrix.reshape(row, 1, col)

    row, col = life_time_matrix.shape

    life_time_matrix = life_time_matrix.reshape(row, 1, col)

    # Time Usage
    duration_matrix = cmg.generate_duration_matrix(
        process_df=process_df, use_3d=True)

    result_matrix = cmg.generate_price_matrix(
        process_df=process_df, use_3d=True
    )

    return material_cost_matrix, material_amount_matrix, monthy_employee_cost_matrix, daily_employee_cost_matrix, capital_cost_matrix, machine_hour_matrix, life_time_matrix, duration_matrix, result_matrix