A user can write any Python function and optimize it using CrossEntropy. Here is template code:
#objective function for CrossEntropy
def MyObjective():
error = 0.0
#do something here, e.g. call tc_getSteadyState or tc_simulateDeterministic
return error
#optimization parameters
minimize = False
maxruns = 100
numPoints = 100
title = "My Optimization Function"
#optimize
result = CrossEntropy.OptimizeParameters(FitFormula_Objective, title, maxruns, numPoints, minimize)
mu = result[0]
sigma = result[1]
paramnames = result[2]
CrossEntropy.DoPCA(mu, sigma, paramnames)
#set the optimized parameters in the model if you want
n = len(mu)
params = tc_createMatrix(n, 1)
for i in range(0,n):
tc_setMatrixValue(params, i, 0, mu[i])
tc_setRowName(params, i, paramnames[i])
tc_setParameters(params,1)
CrossEntropy.DoPCA will generate a summary file such as the one below.
No comments:
Post a Comment