C'est le code pour visualiser la courbe de Maxy Silverstone avec python. Il a été confirmé qu'il fonctionne avec JupyterNotebook. Les paramètres actuellement inclus sont très appropriés, veuillez donc les modifier et les utiliser vous-même.
fix_cost_simulator
import pandas as pd
import numpy as np
import math
import matplotlib.pyplot as plt
%matplotlib inline
# set investigation cost
PLANT_COST = 9_999_999_999 # set plant cost [!]
LINE_COST = 99_999_999 # set line cost [!]
TOOLING_COST = 69_999_999 # set tooling cost [!]
# set how much lines a plant will have [!]
PLANNED_NUM_OF_LINE = 8
# set each condition of the capacity. (pcs/yr = pcs/day * day/mo * mo/yr)
LINE_DAILY_CAPA = 999 # set daily line production capacity [!]
TOOLING_DAILY_CAPA = 599 # set daily tooling production capacity [!]
DAYS_PER_MONTH = 22 # set working days [!]
MONTHS_PER_YEAR = 12 # how many months in a year
LINE_CAPA = LINE_DAILY_CAPA * DAYS_PER_MONTH * MONTHS_PER_YEAR # calc line capacity per year
TOOLING_CAPA = TOOLING_DAILY_CAPA * DAYS_PER_MONTH * MONTHS_PER_YEAR # calc tooling capacity per year
# set the condition for this simulation
START_QTY = 100_000 # starting point(production number) for this simulation
PLOT_WIDTH = 1_000 # plotting width
MARGIN_RATIO = 0.9 # set safety margin (consider a risk of sales) [!]
PLANT_DEP_YEAR = 9 # set plant depreciation year [!]
LINE_DEP_YEAR = 9 # set line depreciation year [!]
TOOLING_DEP_YEAR = 2.2 # set tooling depreciation year [!]
END_QTY = PLANNED_NUM_OF_LINE * LINE_CAPA # calc the end of this simulation
# initialize number of line/tooling
line_num = math.ceil(START_QTY / LINE_CAPA) # initialize number of line
tooling_num = math.ceil(START_QTY / TOOLING_CAPA) # initialize number of tooling
plant_dep_qty = END_QTY * PLANT_DEP_YEAR * MARGIN_RATIO # calc plant depreciation quantity
# generate data for simulation
x_range = np.arange(START_QTY, END_QTY, PLOT_WIDTH)
Y = []
p_line_capa = line_num * LINE_CAPA # calc initial line production capacity
p_tooling_capa = tooling_num * TOOLING_CAPA # calc initial tooling production capacity
for x in x_range:
if x > p_line_capa: # if production qty is over line capa, add a new line
line_num += 1
p_line_capa = line_num * LINE_CAPA
if x > p_tooling_capa: # if production qty is over tooling capa, add a new tooling
tooling_num += 1
p_tooling_capa = tooling_num * TOOLING_CAPA
plant_alloc = PLANT_COST / plant_dep_qty # calc allocated cost of plant building cost
line_alloc = line_num * LINE_COST / x / LINE_DEP_YEAR # calc allocated cost of line cost
tooling_alloc = tooling_num * TOOLING_COST / x / TOOLING_DEP_YEAR # calc allocated cost of tooling cost
all_alloc = plant_alloc + line_alloc + tooling_alloc
if line_num > PLANNED_NUM_OF_LINE: # if line_num is over planned num of line, cause error.
print('Error: line_num is over PLANNED_NUM_OF_LINE.')
break
Y.append(all_alloc)
# show the precondition of this simulation
precondition_dict = {}
precondition_dict['plant_building_cost [Coût de construction d'usine]'] = f'{PLANT_COST:,}'
precondition_dict['line_building_cost [Coût de pose de la ligne]'] = f'{LINE_COST:,}'
precondition_dict['tooling_cost [Coût du moule]'] = f'{TOOLING_COST:,}'
precondition_dict['max_line_num_per_a_plant [Nombre maximum de traits de conception de mise en page de ligne par usine(pcs/day)]'] = PLANNED_NUM_OF_LINE
precondition_dict['max_production_daily_capa [Capacité de production en ligne par jour(pcs/day)]'] = LINE_DAILY_CAPA
precondition_dict['max_tooling_daily_capa [Capacité de production de moules par jour]'] = TOOLING_DAILY_CAPA
precondition_dict['plant_depreciation_year [Nombre d'années d'amortissement du bâtiment d'usine]'] = PLANT_DEP_YEAR
precondition_dict['line_depreciation_year [Amortissement de ligne défini années]'] = LINE_DEP_YEAR
precondition_dict['tooling_depreciation_year [Années de réglage de l'amortissement du moule]'] = TOOLING_DEP_YEAR
precondition_dict['max_line_num [Nombre maximum de lignes posées]'] = line_num
precondition_dict['max_tooling_num [Nombre maximum de moules]'] = tooling_num
precondition_dict['plant_production_capa [Capacité de production en usine(pcs/yr)]'] = f'{END_QTY:,}'
df = pd.DataFrame(precondition_dict.values(), index=precondition_dict.keys(), columns=['precondition [Conditions préalables]'])
display(df)
# set your plan
yourX = 1_000_000 # set your sales plan [!]
yourY = 999_999_999
for x, y in zip(x_range, Y):
if x > yourX:
yourY = y
break
# show simulation result
plt.rcParams["font.size"] = 15
fig, ax = plt.subplots(1, 1, facecolor='#F5FBFF', figsize=(15,10))
ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda x, loc: f'{int(x):,}'))
ax.yaxis.set_major_formatter(plt.FuncFormatter(lambda x, loc: f'{int(x):,}'))
ax.plot(x_range, Y, c='green')
ax.vlines(x=yourX, ymin=min(Y), ymax=max(Y), color='red')
ax.text(x=yourX*1.03, y=max(Y)*0.995, s=f'{yourY:,.2f} @ ( line_num:{np.ceil(yourX/LINE_CAPA):.0f}, tooling_num:{np.ceil(yourX/TOOLING_CAPA):.0f} )', color='red', fontsize=20)
fig.savefig('./data/img/FixedCostSim.png')
plt.show()
«Lorsque vous recherchez sur Google avec« Maxcy et al. [1965] silver stone », Stratégie financière d'une entreprise de construction automobile utilisant Toyota comme matériau- J'ai été attrapé. Intéressant. «En 1965, bien sûr, il n'y avait pas d'EXCEL. M. Maxy l'a probablement tracé à la main. Je suis vraiment reconnaissant que Python puisse dessiner si facilement.
banana_sim
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
def make_and_plot_data(p1, p2, b):
X = np.arange(p1, p2, 1)
Y = []
for x in X:
Y.append(b)
ax.plot(X,Y,c='green')
X0 = 0
X1 = 50 # [!]
X2 = 100 # [!]
X3 = 200 # [!]
C0 = 2000 #Montant d'achat X0 ou plus, prix de vente inférieur à X1[!]
C1 = 1000 #Montant d'achat X1 ou plus, prix de vente inférieur à X2[!]
C2 = 500 #Montant d'achat X2 ou plus, prix de vente inférieur à X3[!]
yourX = 120 # [!]
yourY = 500 # [!]
plt.rcParams["font.size"] = 15
fig = plt.figure(facecolor='#F5FBFF', figsize=(15,10))
ax = fig.subplots(1,1)
make_and_plot_data(X0, X1, C0)
make_and_plot_data(X1, X2, C1)
make_and_plot_data(X2, X3, C2)
ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda x, loc: f'{int(x):,}'))
ax.yaxis.set_major_formatter(plt.FuncFormatter(lambda x, loc: f'{int(x):,}'))
ax.vlines(x=yourX, ymin=0, ymax=C0, color='red')
ax.text(x=yourX*1.03, y=yourY*1.1, s=f'{yourY} @ {yourX:,}', color='red', fontsize=20)
fig.savefig('./data/img/bananaCostSim.png')
plt.show()
Recommended Posts