-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoeTest.py
45 lines (38 loc) · 1.16 KB
/
doeTest.py
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
import numpy as np
from scipy.interpolate import Rbf, InterpolatedUnivariateSpline
# import matplotlib
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pyDOE2 as DOE
def genDoe(nDV, doeMethod):
if doeMethod == 'lhs':
doeTable = DOE.lhs(nDV, samples = nDV*10)
elif doeMethod == 'pbdesign':
doeTable = DOE.pbdesign(nDV)
elif doeMethod == 'bbdesign':
doeTable = DOE.bbdesign(nDV, center=1)
else:
print("Error, You have to check a parameter")
return doeTable
def conDOE(doeTable, dvUb, dvLb, dvCu):
nRun = len(doeTable)
nDV = len(np.transpose(doeTable))
rDoeTable = np.zeros((nRun, nDV))
for i in range(nRun):
for j in range(nDV):
if doeTable[i, j] == 1:
rDoeTable[i,j] = dvUb[j]
elif doeTable[i, j] == -1:
rDoeTable[i,j] = dvLb[j]
elif doeTable[i, j] == 0:
rDoeTable[i,j] = dvCu[j]
else:
print("Error, You have to check a parameter")
return rDoeTable
kk = genDoe(3,'bbdesign')
print(len(kk))
# ub = [1,2,3]
# lb = [5,6,7]
# cu = [0,0,0]
# dd = conDOE(kk,cu,ub,lb)
# print(dd)