Optimization Action Set
Tuning a Single Problem by Using the Default Set of Parameters
This section contains PROC CAS code.
Note: Input data must be accessible in your CAS session, either as a CAS table or as a transient-scope table. A CAS table has a two-level name: the first level is your CAS engine libref, and the second level is the table name. You refer to this table in the CAS procedure by specifying only the second level. For more information about two-level names, see Chapter 3, Shared Concepts (SAS Optimization: Mathematical Optimization Procedures). A transient-scope table is called directly from the action and exists in memory for the duration of the action. For more information about accessing data, see SAS Viya: System Programming Guide. For more information about PROC CAS and programming in CASL, see SAS Cloud Analytic Services: CASL Programmer’s Guide and SAS Cloud Analytic Services: CASL Reference.
This example illustrates how to use the tuner action. The standard set of MILP benchmark cases is called MIPLIB and can be found at http://miplib.zib.de/. Suppose you want to tune the solveMilp action’s parameters on the problem air05 from this set by using the tuner action’s default set of tuning parameters. The %mps2sasd macro in this example converts the air05.mps file stored in the current directory on your local machine to a CAS table, air05, that is accessible in your CAS session. In the %mps2sasd macro function, you need to specify both the path and the MPS filename. For more information about loading an MPS data set onto a CAS server, see Getting Started: OPTMILP Procedure, Getting Started: OPTMILP Procedure (SAS Optimization: Mathematical Optimization Procedures).
The following code calls the tuner action to tune the data table air05 by using the default tuning parameter set:
libname caslib cas;
filename air05 "path-to-air05.mps file";
%mps2sasd(mpsfile=air05, outdata=caslib.air05);
proc cas;
loadactionset 'optimization';
tuner /
instances={{data='air05'}}
milpParameters={maxtime=100, seed=73737}
tunerParameters={maxconfigs=30, nthreads=4, logfreq=5}
;
run;
quit;
The maxtime subparameter in the milpparameters parameter sets the maximum run time that the action can use to solve one problem for each parameter configuration. This subparameter is required.
The maxconfigs subparameter in the tunerparameters parameter sets a limit on the maximum number of parameter configurations that the tuner action processes to solve the problems on the list. You can also use the maxtime subparameter in the tunerparameters parameter to set the tuner action’s maximum run time. The user must specify at least one of these two subparameters in the tunerparameters parameter.
The nthreads subparameter in the tunerparameters parameter specifies the number of threads that the tuner action can use for tuning. Each thread solves an independent MILP problem.
Output 2.15.1 shows the tuner’s iteration log. The first column shows the number of solved problems. The second column shows the number of parameter configurations tested. The third column shows the best run time found so far. The last column shows the tuner action’s run time. You can use the loglevel or logfreq subparameter in the tunerparameters parameter to control the printing or print frequency.
Output 2.15.1: Tuner Action Log
| NOTE: Active Session now MYSESS. |
| NOTE: Added action set 'optimization'. |
| NOTE: Start to tune the MILP |
| SolveCalls Configurations BestTime Time |
| 0 0 . 0.00 |
| 5 5 17.98 36.78 |
| 10 10 17.98 77.69 |
| 15 15 11.83 100.44 |
| 20 20 11.83 112.06 |
| 25 25 11.45 131.01 |
| 30 30 11.45 172.39 |
| NOTE: The tuning time is 172.39 seconds. |
Output 2.15.2 shows standard ODS output tables that are created by the tuner action, which include the performance information table, tuner information table, tuner summary table, and tuner results table.
Output 2.15.2: Tuner Action Output
| Performance Information | |
|---|---|
| Execution Mode | Distributed |
| Number of Compute Nodes | 3 |
| Number of Threads per Node | 4 |
| Tuner Information | |
|---|---|
| Target Solver | MILP |
| Number of Tuning Options | 12 |
| Number of Tuning Instances | 1 |
| Tuning Option Set | AUTOMATIC |
| Performance Goal | GEOMEAN |
| Tuner Time Limit | 1.797693E308 |
| Tuner Configurations Limit | 30 |
| Tuner Summary | |
|---|---|
| Actual Tuning Time | 172.38 |
| Initial Run Time (geomean) | 17.97 |
| Initial Run Time (sum) | 17.97 |
| Best Run Time (geomean) | 11.44 |
| Best Run Time (sum) | 11.44 |
| Number of Tested Configurations | 30 |
| Number of Improved Configurations | 2 |
| Tuner Results | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Configuration | conflictSearch | cutGomory | cutMiLifted | cutStrategy | cutZeroHalf | heuristics | nodelSel | presolver | probe | restarts | symmetry | varSel | Mean of Run Times | Sum of Run Times | Percentage Successful |
| 0 | automatic | automatic | automatic | automatic | automatic | automatic | automatic | automatic | automatic | automatic | automatic | automatic | 17.97 | 17.97 | 100 |
| 1 | automatic | automatic | automatic | automatic | automatic | automatic | automatic | automatic | automatic | automatic | none | automatic | 11.44 | 11.44 | 100 |
| 2 | moderate | aggressive | moderate | moderate | aggressive | moderate | bestBound | aggressive | basic | moderate | none | pseudo | 11.82 | 11.82 | 100 |
| 3 | aggressive | none | aggressive | none | moderate | automatic | bestBound | moderate | automatic | none | moderate | ryanFoster | 25.93 | 25.93 | 100 |
| 4 | moderate | none | automatic | automatic | none | automatic | automatic | none | none | basic | automatic | pseudo | 29.78 | 29.78 | 100 |
| 5 | moderate | moderate | moderate | moderate | aggressive | moderate | bestBound | basic | basic | moderate | none | pseudo | 30.17 | 30.17 | 100 |
| 6 | moderate | aggressive | moderate | moderate | aggressive | moderate | bestBound | basic | basic | moderate | moderate | pseudo | 30.56 | 30.56 | 100 |
| 7 | moderate | aggressive | moderate | moderate | aggressive | moderate | automatic | basic | basic | moderate | none | pseudo | 32.01 | 32.01 | 100 |
| 8 | moderate | aggressive | moderate | moderate | automatic | moderate | bestBound | basic | basic | moderate | none | pseudo | 33.79 | 33.79 | 100 |
| 9 | moderate | aggressive | moderate | moderate | aggressive | moderate | bestBound | basic | basic | moderate | none | automatic | 34.27 | 34.27 | 100 |
| 10 | aggressive | aggressive | moderate | moderate | aggressive | moderate | bestBound | basic | basic | moderate | none | pseudo | 35.67 | 35.67 | 100 |
| 11 | moderate | aggressive | moderate | moderate | aggressive | moderate | depth | basic | basic | moderate | none | pseudo | 36.7 | 36.7 | 100 |
| 12 | moderate | automatic | moderate | moderate | aggressive | moderate | bestBound | basic | basic | moderate | none | pseudo | 36.77 | 36.77 | 100 |
| 13 | moderate | aggressive | moderate | moderate | aggressive | moderate | bestBound | moderate | basic | moderate | none | pseudo | 42.56 | 42.56 | 100 |
| 14 | moderate | aggressive | moderate | none | aggressive | moderate | bestBound | basic | basic | moderate | none | pseudo | 50.97 | 50.97 | 100 |
| 15 | automatic | aggressive | moderate | moderate | aggressive | moderate | bestBound | basic | basic | moderate | none | pseudo | 51.77 | 51.77 | 100 |
| 16 | moderate | aggressive | moderate | moderate | aggressive | automatic | bestBound | basic | basic | moderate | none | pseudo | 55.73 | 55.73 | 100 |
| 17 | moderate | aggressive | moderate | moderate | aggressive | moderate | bestBound | basic | none | moderate | none | pseudo | 59.7 | 59.7 | 100 |
| 18 | moderate | none | automatic | moderate | aggressive | none | bestBound | moderate | automatic | none | automatic | ryanFoster | 65.94 | 65.94 | 100 |
| 19 | moderate | aggressive | moderate | moderate | aggressive | moderate | bestBound | basic | basic | none | none | pseudo | 66.23 | 66.23 | 100 |
| 20 | moderate | aggressive | moderate | moderate | aggressive | moderate | bestBound | basic | basic | moderate | none | pseudo | 66.73 | 66.73 | 100 |
| 21 | moderate | aggressive | moderate | moderate | moderate | moderate | bestBound | basic | basic | moderate | none | pseudo | 68.92 | 68.92 | 100 |
| 22 | moderate | aggressive | aggressive | moderate | aggressive | moderate | bestBound | basic | basic | moderate | none | pseudo | 69.74 | 69.74 | 100 |
| 23 | moderate | aggressive | moderate | moderate | aggressive | moderate | bestBound | basic | basic | moderate | aggressive | pseudo | 71.64 | 71.64 | 100 |
| 24 | moderate | aggressive | moderate | moderate | aggressive | moderate | bestBound | basic | basic | basic | none | pseudo | 72.83 | 72.83 | 100 |
| 25 | none | none | moderate | aggressive | none | automatic | bestEstimatedepth | moderate | none | basic | none | automatic | 100.85 | 100.85 | 0 |
| 26 | moderate | aggressive | moderate | moderate | aggressive | moderate | bestBound | basic | basic | moderate | none | maxInfeas | 103.35 | 103.35 | 0 |
| 27 | automatic | none | none | moderate | moderate | automatic | automatic | none | automatic | none | basic | minInfeas | 100.43 | 100.43 | 0 |
| 28 | none | moderate | moderate | none | aggressive | none | depth | automatic | automatic | automatic | none | minInfeas | 100.06 | 100.06 | 0 |
| 29 | aggressive | none | none | aggressive | moderate | none | depth | automatic | automatic | none | aggressive | minInfeas | 100.72 | 100.72 | 0 |
Tuning a Single Problem by Using the Default Set of Parameters
This section contains Lua code for the analysis in the CASL version of this example, which contains details about the results.
Note: In order to run this code, the data that are described in the CASL version need to be loaded into CAS. One way to do this is to convert the example data to the comma-separated-value (CSV) file air05.csv and then use the following code to load the CSV file into CAS:
s:loadtable{casLib="casuser", path="air05.csv"}
For more information about coding in Lua, see Getting Started with SAS Viya for Lua and SAS Viya: System Programming Guide.
The following code calls the tuner action to tune the data table air05 by using the default tuning parameter set:
s:optimization_tuner{
instances={{data={name="air05"}}},
milpParameters={maxTime=30},
tunerParameters={maxConfigs=30, nThreads=4, logFreq=5}
}
Tuning a Single Problem by Using the Default Set of Parameters
This section contains Python code for the analysis in the CASL version of this example, which contains details about the results.
Note: In order to run this code, the data that are described in the CASL version need to be loaded into CAS. One way to do this is to convert the example data to the comma-separated-value (CSV) file air05.csv and then use the following code to load the CSV file:
s.upload('air05.csv')
For more information about coding in Python, see Getting Started with SAS Viya for Python and SAS Viya: System Programming Guide.
The following code calls the tuner action to tune the data table air05 by using the default tuning parameter set:
s.optimization.tuner(
instances=[{'data':{'name':'air05'}}],
milpparameters={'maxtime':100},
tunerparameters={'maxconfigs':30,'nthreads':4,'logfreq':5}
)
Tuning a Single Problem by Using the Default Set of Parameters
This example is not available for the R programming language.