2016-10-18 21:45:07 +04:00
|
|
|
import numpy as np
|
2016-11-08 20:08:06 +04:00
|
|
|
import math
|
2016-10-18 21:45:07 +04:00
|
|
|
from pyFTS import *
|
|
|
|
|
|
|
|
#print(common.__dict__)
|
|
|
|
|
|
|
|
def GridPartitionerTrimf(data,npart,names = None,prefix = "A"):
|
|
|
|
sets = []
|
|
|
|
dmax = max(data)
|
2016-11-01 23:39:13 +04:00
|
|
|
dmax = dmax + dmax*0.10
|
2016-10-18 21:45:07 +04:00
|
|
|
dmin = min(data)
|
2016-11-01 23:39:13 +04:00
|
|
|
dmin = dmin - dmin*0.10
|
2016-10-18 21:45:07 +04:00
|
|
|
dlen = dmax - dmin
|
2016-11-08 20:08:06 +04:00
|
|
|
partlen = math.ceil(dlen / npart)
|
|
|
|
partition = math.ceil(dmin)
|
2016-10-18 21:45:07 +04:00
|
|
|
for c in range(npart):
|
2016-11-08 20:08:06 +04:00
|
|
|
sets.append(common.FuzzySet(prefix+str(c),common.trimf,[round(partition-partlen,3), partition, partition+partlen], partition ) )
|
2016-10-18 21:45:07 +04:00
|
|
|
partition = partition + partlen
|
|
|
|
|
|
|
|
return sets
|