@@ -1273,13 +1273,32 @@ def convertFmu2Mo(self, fmuName): # 20
12731273
12741274 return fileName
12751275
1276- # to optimize model
1277- def optimize (self ): # 21
1278- """
1279- This method optimizes model according to the optimized options. It can be called:
1280- only without any arguments
1281- usage
1282- >>> optimize()
1276+ def optimize (self ) -> dict [str , Any ]:
1277+ """Perform model-based optimization.
1278+
1279+ Optimization options set by setOptimizationOptions() are used.
1280+
1281+ Returns:
1282+ A dict with various values is returned. One of these values is the
1283+ path to the result file.
1284+
1285+ Examples:
1286+ >>> mod.optimize()
1287+ {'messages': 'LOG_SUCCESS | info | The initialization finished successfully without homotopy method. ...'
1288+ 'resultFile': '/tmp/tmp68guvjhs/BangBang2021_res.mat',
1289+ 'simulationOptions': 'startTime = 0.0, stopTime = 1.0, numberOfIntervals = '
1290+ "1000, tolerance = 1e-8, method = 'optimization', "
1291+ "fileNamePrefix = 'BangBang2021', options = '', "
1292+ "outputFormat = 'mat', variableFilter = '.*', cflags = "
1293+ "'', simflags = '-s=\\ 'optimization\\ ' "
1294+ "-optimizerNP=\\ '1\\ ''",
1295+ 'timeBackend': 0.008684897,
1296+ 'timeCompile': 0.7546678929999999,
1297+ 'timeFrontend': 0.045438053000000006,
1298+ 'timeSimCode': 0.0018537170000000002,
1299+ 'timeSimulation': 0.266354356,
1300+ 'timeTemplates': 0.002007785,
1301+ 'timeTotal': 1.079097854}
12831302 """
12841303 cName = self ._modelName
12851304 properties = ',' .join (f"{ key } ={ val } " for key , val in self ._optimizeOptions .items ())
0 commit comments