sasoptpy.Model.tune_parameters¶
-
Model.
tune_parameters
(self, **kwargs)[source]¶ Tunes the model to find ideal solver parameters
- Parameters
- kwargs :
Keyword arguments as defined in the optimization.tuner action.
Acceptable values are:
milpParameters: Parameters for the solveMilp action, such as maxTime, heuristics, feasTol
tunerParameters: Parameters for the tuner itself, such as maxConfigs, printLevel, logFreq
tuningParameters: List of parameters to be tuned, such as cutStrategy, presolver, restarts
- Returns
- tunerResults
swat.dataframe.SASDataFrame
Tuning results as a table
- tunerResults
See also
Notes
See SAS Optimization documentation for a full list of tunable parameters.
Examples
>>> m = so.Model(name='model1') >>> ... >>> results = m.tune_parameters(tunerParameters={'maxConfigs': 10}) NOTE: Initialized model knapsack_with_tuner. NOTE: Added action set 'optimization'. NOTE: Uploading the problem DataFrame to the server. NOTE: Cloud Analytic Services made the uploaded file available as table KNAPSACK_WITH_TUNER in caslib CASUSER(casuser). NOTE: The table KNAPSACK_WITH_TUNER has been created in caslib CASUSER(casuser) from binary data uploaded to Cloud Analytic Services. NOTE: Start to tune the MILP SolveCalls Configurations BestTime Time 1 1 0.21 0.26 2 2 0.19 0.50 3 3 0.19 0.72 4 4 0.19 0.95 5 5 0.19 1.17 6 6 0.19 1.56 7 7 0.18 1.76 8 8 0.17 1.96 9 9 0.17 2.16 10 10 0.17 2.35 NOTE: Configuration limit reached. NOTE: The tuning time is 2.35 seconds. >>> print(results) Configuration conflictSearch ... Sum of Run Times Percentage Successful 0 0.0 automatic ... 0.20 100.0 1 1.0 none ... 0.17 100.0 2 2.0 none ... 0.17 100.0 3 3.0 moderate ... 0.17 100.0 4 4.0 none ... 0.18 100.0 5 5.0 none ... 0.18 100.0 6 6.0 aggressive ... 0.18 100.0 7 7.0 moderate ... 0.18 100.0 8 8.0 aggressive ... 0.19 100.0 9 9.0 automatic ... 0.36 100.0
>>> results = m.tune_parameters( milpParameters={'maxtime': 10}, tunerParameters={'maxConfigs': 20, 'logfreq': 5}, tuningParameters=[ {'option': 'presolver', 'initial': 'none', 'values': ['basic', 'aggressive', 'none']}, {'option': 'cutStrategy'}, {'option': 'strongIter', 'initial': -1, 'values': [-1, 100, 1000]} ]) NOTE: Added action set 'optimization'. NOTE: Uploading the problem DataFrame to the server. NOTE: Cloud Analytic Services made the uploaded file available as table KNAPSACK_WITH_TUNER in caslib CASUSER(casuser). NOTE: The table KNAPSACK_WITH_TUNER has been created in caslib CASUSER(casuser) from binary data uploaded to Cloud Analytic Services. NOTE: Start to tune the MILP SolveCalls Configurations BestTime Time 5 5 0.17 1.01 10 10 0.17 2.00 15 15 0.17 2.98 20 20 0.17 3.95 NOTE: Configuration limit reached. NOTE: The tuning time is 3.95 seconds. >>> print(results) Configuration conflictSearch ... Sum of Run Times Percentage Successful 0 0.0 automatic ... 0.17 100.0 1 1.0 none ... 0.16 100.0 2 2.0 none ... 0.16 100.0 3 3.0 none ... 0.16 100.0 4 4.0 none ... 0.16 100.0 5 5.0 none ... 0.17 100.0 6 6.0 none ... 0.17 100.0 7 7.0 none ... 0.17 100.0 8 8.0 none ... 0.17 100.0 9 9.0 none ... 0.17 100.0 10 10.0 none ... 0.17 100.0 11 11.0 aggressive ... 0.17 100.0 12 12.0 none ... 0.17 100.0 13 13.0 aggressive ... 0.17 100.0 14 14.0 automatic ... 0.17 100.0 15 15.0 none ... 0.17 100.0 16 16.0 none ... 0.17 100.0 17 17.0 moderate ... 0.17 100.0 18 18.0 moderate ... 0.17 100.0 19 19.0 none ... 0.17 100.0