import skfuzzy as fuzz from skfuzzy import control as crt import numpy as np import matplotlib.pyplot as plt import matplotlib as ml import streamlit as st import math from mpl_toolkits.mplot3d import Axes3D st.title('Schematic Design') tanasobat=crt.Antecedent(np.arange(0,3.05,0.05),'c') jahat=crt.Antecedent(np.arange(0,25.1,0.1),'a') jerm_hararati=crt.Antecedent(np.arange(0,4185.1,0.1),'b') feshordegi=crt.Antecedent(np.arange(0,1,0.01),'d') ertefa=crt.Antecedent(np.arange(2.3,10.001,0.001),'e') WWR=crt.Antecedent(np.arange(0,1.001,0.001),'f') emtiaz_HH=crt.Consequent(np.arange(-4,24.01,0.01),'score') g1=st.sidebar.radio('climate',['hot and humid','hot and dry','cold','moderate and humid']) jahat['low']=fuzz.trimf(jahat.universe,[0,5,12]) jahat['medium']=fuzz.trimf(jahat.universe,[5,12,17.5]) jahat['re_hight']=fuzz.trimf(jahat.universe,[12,17.5,25]) jahat['high']=fuzz.trimf(jahat.universe,[17.5,25,25]) jerm_hararati['low']=fuzz.trapmf(jerm_hararati.universe,[0,0,1500,1600]) jerm_hararati['medium']=fuzz.trapmf(jerm_hararati.universe,[1500,2000,3000,3500]) jerm_hararati['high']=fuzz.trapmf(jerm_hararati.universe,[3000,3500,4185,4185]) tanasobat['low']=fuzz.trapmf(tanasobat.universe,[0,1.1,1.3,1.4]) tanasobat['medium']=fuzz.trapmf(tanasobat.universe,[1.2,1.4,1.6,1.7]) tanasobat['high']=fuzz.trapmf(tanasobat.universe,[1.6,1.7,3,3]) feshordegi['low']=fuzz.trapmf(feshordegi.universe,[0,0.2,0.5,0.6]) feshordegi['medium']=fuzz.trapmf(feshordegi.universe,[0.5,0.6,0.8,0.85]) feshordegi['high']=fuzz.trapmf(feshordegi.universe,[0.8,0.85,1,1]) ertefa['low']=fuzz.gbellmf(ertefa.universe,0.3,6,2.4) ertefa['medium']=fuzz.gbellmf(ertefa.universe,0.2,6,3) ertefa['high']=fuzz.smf(ertefa.universe,3.2,3.6) WWR['low']=fuzz.gbellmf(WWR.universe,0.05,4,0.15) #WWR['medium']=fuzz.gbellmf(WWR.universe,0.05,6,0.25) WWR['RE_high']=fuzz.gbellmf(WWR.universe,0.05,4,0.30) WWR['high']=fuzz.smf(WWR.universe,0.35,0.45) emtiaz_HH['awful']=fuzz.gaussmf(emtiaz_HH.universe,0,1) emtiaz_HH['bad']=fuzz.gaussmf(emtiaz_HH.universe,4,1) emtiaz_HH['not_bad']=fuzz.gaussmf(emtiaz_HH.universe,8,1) emtiaz_HH['good']=fuzz.gaussmf(emtiaz_HH.universe,12,1) emtiaz_HH['very_good']=fuzz.gaussmf(emtiaz_HH.universe,16,1) emtiaz_HH['excelent']=fuzz.gaussmf(emtiaz_HH.universe,20,1) r1=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['excelent']) r2=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['very_good']) r3=crt.Rule(jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['very_good']) r4=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['very_good']) r5=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['very_good']) r6=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['very_good']) r7=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['very_good']) r8=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['good']) r9=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['good']) r10=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['good']) r11=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['good']) r12=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['good']) r13=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['good']) r14=crt.Rule(jahat['low']&~jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['good']) r15=crt.Rule(jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['good']) r16=crt.Rule(jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['good']) r17=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['good']) r18=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['good']) r19=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['good']) r20=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['good']) r21=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['good']) r22=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['good']) r23=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad']) r24=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad']) r25=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad']) r26=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad']) r27=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad']) r28=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad']) r29=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad']) r30=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad']) r31=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad']) r32=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad']) r33=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad']) r34=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad']) r35=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad']) r36=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad']) r37=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad']) r38=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad']) r39=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad']) r40=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['bad']) r41=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['bad']) r42=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad']) r43=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['bad']) r44=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad']) r45=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad']) r46=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['bad']) r47=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad']) r48=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad']) r49=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['bad']) r50=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad']) r51=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad']) r52=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad']) r53=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad']) r53=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['awful']) r54=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['awful']) r55=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['awful']) r56=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['awful']) r57=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['awful']) r58=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['awful']) r59=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['awful']) cs=crt.ControlSystem([r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, r20, r21, r22, r23, r24, r25, r26, r27, r28, r29, r30, r31, r32, r33, r34, r35, r36, r37, r38, r39, r40, r41, r42, r43, r44, r45, r46, r47, r48, r49, r50, r51, r52, r53,r54,r55,r56,r57,r58,r59]) cs1=crt.ControlSystemSimulation(cs) c1=cs1.input['c']=st.sidebar.slider("tanasobat",min_value=0.1,max_value=4.0,step=0.1,value=1.0) a1=cs1.input['a']=st.sidebar.slider("jahat",min_value=0.00,max_value=40.00,step=0.1,value=0.0) b1=cs1.input['b']=st.sidebar.slider("jerm_hararati",min_value=0.00,max_value=4180.00,step=0.1,value=0.0) d1=cs1.input['d']=st.sidebar.slider("feshordegi",min_value=0.00,max_value=1.0,step=0.01,value=0.1) e1=cs1.input['e']=st.sidebar.slider("ertefa",min_value=2.3,max_value=5.00,step=0.01,value=3.31) f1=cs1.input['f']=st.sidebar.slider("wwr",min_value=0.00,max_value=1.00,step=0.01,value=0.20) cs1.compute() g11=cs1.output['score'] # Create axis axes = [int(c1*10),10,int(e1)] # Create Data data = np.ones(axes, dtype=np.bool) # Control Transparency alpha = 0.9 # Control colour colors = np.empty(axes + [4], dtype=np.float32) colors[:] = [1, 0, 0, alpha] # red # Plot figure fig = plt.figure() ax = fig.add_subplot(111, projection='3d') # Voxels is used to customizations of the # sizes, positions and colors. ax.voxels(data, facecolors=colors) ax.set_xlim([0,40]) ax.set_zlim([0,6]) ax.axis('off') st.header('your score is :') st.header(g11) st.set_option('deprecation.showPyplotGlobalUse', False) st.pyplot()