The OPTMILP Option Tuner
Using CAS Sessions and CAS Engine Librefs
SAS Cloud Analytic Services (CAS) is the analytic server and associated cloud services in SAS Viya. This section describes how to create a CAS session and set up a CAS engine libref that you can use to connect to the CAS session. It assumes that you have a CAS server already available; contact your system administrator if you need help starting and terminating a server. This CAS server is identified by specifying the host on which it runs and the port on which it listens for communications. To simplify your interactions with this CAS server, the host information and port information for the server are stored as SAS option values that are retrieved automatically whenever this CAS server needs to be accessed. You can examine the host and port values for the server at your site by using the following statements:
proc options option=(CASHOST CASPORT);
run;
In addition to starting a CAS server, your system administrator might also have created a CAS session and a CAS engine libref for your use. You can define your own sessions and CAS engine librefs that connect to the CAS server as shown in the following statements:
cas mysess;
libname mycas cas sessref=mysess;
The CAS statement creates the CAS session named mysess, and the LIBNAME statement creates the mycas CAS engine libref that you use to connect to this session. It is not necessary to explicitly name the CASHOST and CASPORT of the CAS server in the CAS statement, because these values are retrieved from the corresponding SAS option values.
If you have created the mysess session, you can terminate it by using the TERMINATE option in the CAS statement as follows:
cas mysess terminate;
For more information about the CAS and LIBNAME statements, see the section Introduction to CAS in Chapter 3, Shared Concepts.
To make the two data sets available in the CAS server, you need to upload them by using the following statements. At the same time, you also need to add an _id_ column to ensure that the MPS reader can read the file in the correct order even if it is distributed across several machines and hence loses the original ordering.
data mylib.air04;
set a.air04;
_id_ = _n_
;
data mylib.air05;
set a.air05;
_id_ = _n_
;
The following DATA step generates the data table mylib.probs, which contains the list of problems to be solved, and the data table mylib.optvals, which contains the list of options to be tuned:
data mylib.probs;
input name $1-8;
datalines;
air04
air05
;
data mylib.optvals;
input option $1-10;
datalines;
cutclique
cutgomory
heuristics
;
The following statements call the OPTMILP procedure and enable the option tuner:
proc optmilp maxtime=300;
tuner maxtime=1200 problems=mylib.probs optionvalues=mylib.optvals
tunerout=mylib.out;
run;
The MAXTIME= option in the PROC OPTMILP statement sets the maximum run time that the procedure can use to solve one problem for each option configuration. The MAXTIME= option in the TUNER statement sets a limit on the total time that the option tuner can use to solve the problems on the list by using the generated sequence of configurations. The PROBLEMS= option specifies the name of the data table that contains the list of problems to be solved. The OPTIONVALUES= option specifies the name of the data table that contains the list of options to be tuned. The TUNEROUT= option specifies the name of the data table that contains detailed results of the tuning process. The ODS OUTPUT statement creates an output data table from the TunerResults table. For more information about the options available in the PROC OPTMILP statement, see the section PROC OPTMILP Statement.
Figure 1 shows a selection of tuning results that include the initial option configuration, the best option configurations, and the worst option configurations.
Figure 1: PROC OPTMILP Output
| Performance Information | |
|---|---|
| Execution Mode | Distributed |
| Number of Compute Nodes | 3 |
| Number of Threads per Node | 32 |
| Tuner Information | |
|---|---|
| Target Solver | MILP |
| Number of Tuning Options | 3 |
| Number of Tuning Instances | 2 |
| Tuning Option Set | USER |
| Performance Goal | GEOMEAN |
| Tuner Time Limit | 1200 |
| Tuner Configurations Limit | 2147483647 |
| Tuner Summary | |
|---|---|
| Actual Tuning Time | 1231.1 |
| Initial Run Time (geomean) | 8.62 |
| Initial Run Time (sum) | 17.33 |
| Best Run Time (geomean) | 8.03 |
| Best Run Time (sum) | 16.24 |
| Number of Tested Configurations | 66 |
| Number of Improved Configurations | 29 |
| Tuner Results | ||||||
|---|---|---|---|---|---|---|
| Configuration | cutClique | cutGomory | heuristics | Mean of Run Times | Sum of Run Times | Percentage Successful |
| 0 | automatic | automatic | automatic | 8.62 | 17.33 | 100 |
| 1 | moderate | aggressive | none | 8.03 | 16.24 | 100 |
| 2 | moderate | none | none | 8.05 | 16.27 | 100 |
| 3 | none | automatic | none | 8.05 | 16.34 | 100 |
| 4 | automatic | aggressive | none | 8.07 | 16.32 | 100 |
| 5 | none | moderate | none | 8.1 | 16.43 | 100 |
| 6 | none | moderate | basic | 8.27 | 16.61 | 100 |
| 7 | none | none | basic | 8.28 | 16.62 | 100 |
| 8 | none | automatic | basic | 8.29 | 16.63 | 100 |
| 9 | moderate | moderate | none | 8.34 | 16.96 | 100 |
| 10 | automatic | moderate | none | 8.34 | 16.97 | 100 |
| 11 | moderate | automatic | none | 8.35 | 16.99 | 100 |
| 12 | moderate | automatic | basic | 8.36 | 16.78 | 100 |
| 13 | automatic | moderate | basic | 8.36 | 16.78 | 100 |
| 14 | automatic | none | basic | 8.37 | 16.8 | 100 |
| 15 | moderate | none | basic | 8.39 | 16.83 | 100 |
| 16 | automatic | automatic | none | 8.39 | 17.05 | 100 |
| 17 | none | none | moderate | 8.39 | 16.87 | 100 |
| 18 | none | automatic | moderate | 8.4 | 16.88 | 100 |
| 19 | moderate | moderate | basic | 8.4 | 16.86 | 100 |
| 20 | none | moderate | moderate | 8.41 | 16.91 | 100 |
| 21 | automatic | none | moderate | 8.5 | 17.08 | 100 |
| 22 | automatic | automatic | moderate | 8.51 | 17.09 | 100 |
| 23 | moderate | none | moderate | 8.51 | 17.09 | 100 |
| 24 | moderate | aggressive | basic | 8.51 | 17.1 | 100 |
| 25 | automatic | moderate | moderate | 8.51 | 17.1 | 100 |
| 26 | moderate | automatic | moderate | 8.53 | 17.13 | 100 |
| 27 | none | moderate | automatic | 8.57 | 17.23 | 100 |
| 28 | none | aggressive | basic | 8.58 | 17.29 | 100 |
| 29 | none | none | automatic | 8.58 | 17.25 | 100 |
| 30 | moderate | moderate | automatic | 8.66 | 17.41 | 100 |
| 31 | moderate | automatic | automatic | 8.67 | 17.42 | 100 |
| 32 | moderate | none | automatic | 8.67 | 17.41 | 100 |
| 33 | automatic | moderate | automatic | 8.68 | 17.43 | 100 |
| 34 | automatic | none | automatic | 8.69 | 17.45 | 100 |
| 35 | none | none | aggressive | 9.04 | 18.11 | 100 |
| 36 | none | automatic | aggressive | 9.1 | 18.23 | 100 |
| 37 | none | moderate | aggressive | 9.11 | 18.24 | 100 |
| 38 | automatic | none | aggressive | 9.16 | 18.34 | 100 |
| 39 | moderate | none | aggressive | 9.16 | 18.34 | 100 |
| 40 | moderate | automatic | aggressive | 9.19 | 18.4 | 100 |
| 41 | automatic | moderate | aggressive | 9.23 | 18.5 | 100 |
| 42 | moderate | aggressive | moderate | 10.64 | 22.3 | 100 |
| 43 | automatic | aggressive | automatic | 10.8 | 22.61 | 100 |
| 44 | automatic | aggressive | aggressive | 11.39 | 23.56 | 100 |
| 45 | moderate | aggressive | aggressive | 11.39 | 23.58 | 100 |
| 46 | none | aggressive | aggressive | 11.67 | 24.44 | 100 |
| 47 | aggressive | none | none | 43.83 | 118.52 | 100 |
| 48 | aggressive | automatic | none | 43.95 | 118.6 | 100 |
| 49 | aggressive | aggressive | none | 44.01 | 118.67 | 100 |
| 50 | aggressive | moderate | none | 44.02 | 119.02 | 100 |
| 51 | aggressive | none | basic | 51.65 | 126.51 | 100 |
| 52 | aggressive | moderate | basic | 51.79 | 126.32 | 100 |
| 53 | aggressive | aggressive | moderate | 51.83 | 126.42 | 100 |
| 54 | aggressive | none | moderate | 51.89 | 126.47 | 100 |
| 55 | aggressive | automatic | basic | 51.97 | 126.95 | 100 |
| 56 | aggressive | moderate | moderate | 52.07 | 126.99 | 100 |
| 57 | aggressive | automatic | moderate | 52.09 | 127.18 | 100 |
| 58 | aggressive | aggressive | basic | 52.1 | 127.22 | 100 |
| 59 | aggressive | moderate | automatic | 52.15 | 127.4 | 100 |
| 60 | aggressive | automatic | automatic | 52.22 | 127.26 | 100 |
| 61 | aggressive | aggressive | automatic | 52.44 | 127.51 | 100 |
| 62 | aggressive | automatic | aggressive | 74.74 | 231.65 | 100 |
| 63 | aggressive | aggressive | aggressive | 74.91 | 231.98 | 100 |
| 64 | aggressive | moderate | aggressive | 74.91 | 232.07 | 100 |
| 65 | aggressive | none | aggressive | 75.2 | 232.02 | 100 |