2

I am doing an optimization for designing a seismic resistant structural system using Abaqus. I am intending to use Gekko for this purpose. But it seems that I am making a mistakes in writing down the suitable syntax concerning this task. "Objective" is the name of the subroutine that is responsible for creating the numerical model of Abaqus, analyzing the model, processing results and calculating the penalty function. "Objective" returns the values of the cost of the building summed up with the penalty function to be minimized. this is the message of error:

@error: Insufficient Data CSV Read Error : number of data rows must be >= 2 for dynamic problems Data Points Identified: 1 STOPPING. . .

Traceback (most recent call last): File "C:\temp\AK\24-Gekko\opti1.10.3.0.py", line 721, in m.solve() File "C:\Users\amjad\AppData\Roaming\Python\Python38\site-packages\gekko\gekko.py", line 2140, in solve raise Exception(apm_error) Exception: @error: Insufficient Data CSV Read Error : number of data rows must be >= 2 for dynamic problems Data Points Identified: 1 STOPPING. . .

this is the main code of the optimization process: ''' m = GEKKO(remote=False)

Alfa1  = m.Const(1.25)
Alfa2  = m.Const(0.3)
Alfa3  = m.Const(1.25)
UCS    = m.Const(1000.)    #   $/Ton of steel
UCC    = m.Const(67.)      #   $/m3 of concrete
UCCF   = m.Const(20.)      #   $/m2 of column wood framework
UCBF   = m.Const(28.)      #   $/m2 of beam wood framework
UCWF   = m.Const(20.)      #   $/m2 of wall wood framework
GammaS = m.Const(7850)
GammaC = m.Const(2500)
cover  = m.Const(10.)
f_c    = m.Const(30.)
fy     = m.Const(400.)
Est    = m.Const(200000.)
eu_c   = m.Const(0.003)
bw     = m.Const(700.)
fai    = 6.
#defining material parameters
Mats = {
    "CDP30.0" :("mm",GammaC.value*1.e-12,0.18,0.,[f_c.value,0.0015,0.4,100],[f_c.value/10., 0.001 , 1.0],35,0.1,1.12,0.667,0.1,1.0,0.0),
    "C30.0" :("mm",GammaC.value*1.e-12,0.18,0.,f_c.value),
    "S400.0":("mm",GammaS.value*1.e-12,0.3,0.,fy.value),
    }

#defining section's locations within building members and lengths of members
Sections = {
    "C11":[[("A0-A1","A1-A2","D0-D1","D1-D2"),750.],[],[],[]],
    "C22":[[("A2-A3","A3-A4","A4-A5","D2-D3","D3-D4","D4-D5"),750.],[],[],[]],
    "C33":[[("B0-B1","C0-C1","B1-B2","C1-C2","B2-B3","C2-C3","B3-B4","C3-C4","B4-B5","C4-C5",),750.],[],[],[]],
    "BB1":[[("A1-B1","C1-D1","A2-B2","C2-D2","A3-B3","C3-D3","A4-B4","C4-D4","A5-B5","C5-D5",),700.],[],[]],
    "WW1":[[("B0-C1","B1-C2","B2-C3","B3-C4","B4-C5",),750.],[],[]],
    }
#creating materials of the model
MatText = []
for i in Mats:
    if   i[1:3]=="DP":CDPs(i,Mats[i][0],Mats[i][1],Mats[i][2],Mats[i][3],Mats[i][4],Mats[i][5],Mats[i][6],Mats[i][7],Mats[i][8],Mats[i][9],Mats[i][10],Mats[i][11],Mats[i][12])
    elif i[0]  =="C" :EPPs(i,Mats[i][0],Mats[i][1],Mats[i][2],Mats[i][3],Mats[i][4])
    elif i[0]  =="S" :EPPs(i,Mats[i][0],Mats[i][1],Mats[i][2],Mats[i][3],Mats[i][4])
#objective function initializing
FX = 0.
Vars = []
for i in [x for x in Sections if x[0]=="C"]:
    a      = m.Var(value=125,lb=100,ub=250,integer = False)
    b      = m.Var(value=125,lb=100,ub=250,integer = False)
    Us     = m.Var(value=0.02,lb=0.01,ub=0.045,integer = False)
    rebarS = rectRC(a.value,b.value,Us.value,cover.value,fai,"C")
    Sections[i][1] = [a.value,b.value,Us.value,rebarS]
    As = np.pi*fai**2./4*(4+2*rebarS[1][0]+2*rebarS[2][0])
    #calculating the cost of a Column section
    Sections[i][2] = m.Intermediate(Alfa1*As/(1000**3)*GammaS*UCS+a*b/(1000*1000)*UCC+2*(a+b)/(1000)*UCCF)
    Sections[i][3] = PMinteraction(eu_c.value,cover.value,a.value,b.value,f_c.value,fy.value,Est.value,(2+rebarS[1][0])*np.pi*fai**2/4,(2+rebarS[1][0])*np.pi*fai**2/4)
    FX += len(Sections[i][0][0])*Sections[i][0][1]/1000*Sections[i][2]
    Vars.append((i,Sections[i][1][:3]))

for i in [x for x in Sections if x[0]=="B"]:
    a      = m.Var(value=125,lb=100,ub=250,integer = False)
    b      = m.Var(value=125,lb=100,ub=250,integer = False)
    Us     = m.Var(value=0.02,lb=0.01,ub=0.045)
    rebarS = rectRC(a.value,b.value,Us.value,cover.value,fai,"B")
    Sections[i][1] = [a.value,b.value,Us.value,rebarS]
    As = np.pi*fai**2./4*(4+2*rebarS[1][0]+2*rebarS[2][0])
    #calculating the cost of a Beam section
    Sections[i][2] = m.Intermediate((2*Alfa2*As/(1000**3)+(1-2*Alfa2)*As/(1000**3))*GammaS*UCS+a*b/(1000*1000)*UCC+(a+2*b)/(1000)*UCBF)
    print (Sections[i][2])
    FX += len(Sections[i][0][0])*Sections[i][0][1]/1000*Sections[i][2]
    Vars.append((i,Sections[i][1][:3]))

for i in [x for x in Sections if x[0]=="W"]:
    a      = m.Var(value=125,lb=100,ub=250,integer = False)
    b      = bw.value
    Us     = m.Var(value=0.009,lb=0.007,ub=0.01)
    rebarS = rectRC(a.value,b.value,Us.value,cover.value,fai,"W")
    Sections[i][1] = [a.value,b.value,Us.value,rebarS]
    As = np.pi*fai**2./4*(4+2*rebarS[1][0]+2*rebarS[2][0])
    #calculating the cost of a Wall section
    Sections[i][2] = m.Intermediate(Alfa3*As/(1000**3)*GammaS*UCS+a*b/(1000*1000)*UCC+2*b/(1000)*UCWF)
    print (Sections[i][2])
    FX += len(Sections[i][0][0])*Sections[i][0][1]/1000*Sections[i][2]
    Vars.append((i,Sections[i][1][:3]))

#modifying object function by a reference value
FX = FX/ReferenceFX * 1.

m.Minimize(Objective(Vars))

m.options.SOLVER = 1
m.options.IMODE = 6
m.solve()

'''

1 Answers1

0

Gekko solution modes are described in more detail in the documentation. The current mode is IMODE=6 that should have differential and algebraic equations. In this mode, it is required to define the time points for the solution such as:

m.time=[0,0.1,0.2,0.5,1.0,1.5,2.0]

If it is a steady state solution (no differential equations) then it should be IMODE=3 for steady state optimization.

m.options.IMODE=3

There is currently no definition for PMinteraction. If this is an Abaqus model call then it will need to be replaced by a suitable model approximation that Gekko can compile into byte-code. Some options are cspline (1D), bspline (2D), or machine learning models (higher dimension functions).

John Hedengren
  • 12,068
  • 1
  • 21
  • 25