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

The OPTMILP Procedure

Performance Information
Execution ModeDistributed
Number of Compute Nodes3
Number of Threads per Node32

Tuner Information
Target SolverMILP
Number of Tuning Options3
Number of Tuning Instances2
Tuning Option SetUSER
Performance GoalGEOMEAN
Tuner Time Limit1200
Tuner Configurations Limit2147483647

Tuner Summary
Actual Tuning Time1231.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 Configurations66
Number of Improved Configurations29

Tuner Results
ConfigurationcutCliquecutGomoryheuristicsMean of Run TimesSum of Run TimesPercentage Successful
0automaticautomaticautomatic8.6217.33100
1moderateaggressivenone8.0316.24100
2moderatenonenone8.0516.27100
3noneautomaticnone8.0516.34100
4automaticaggressivenone8.0716.32100
5nonemoderatenone8.116.43100
6nonemoderatebasic8.2716.61100
7nonenonebasic8.2816.62100
8noneautomaticbasic8.2916.63100
9moderatemoderatenone8.3416.96100
10automaticmoderatenone8.3416.97100
11moderateautomaticnone8.3516.99100
12moderateautomaticbasic8.3616.78100
13automaticmoderatebasic8.3616.78100
14automaticnonebasic8.3716.8100
15moderatenonebasic8.3916.83100
16automaticautomaticnone8.3917.05100
17nonenonemoderate8.3916.87100
18noneautomaticmoderate8.416.88100
19moderatemoderatebasic8.416.86100
20nonemoderatemoderate8.4116.91100
21automaticnonemoderate8.517.08100
22automaticautomaticmoderate8.5117.09100
23moderatenonemoderate8.5117.09100
24moderateaggressivebasic8.5117.1100
25automaticmoderatemoderate8.5117.1100
26moderateautomaticmoderate8.5317.13100
27nonemoderateautomatic8.5717.23100
28noneaggressivebasic8.5817.29100
29nonenoneautomatic8.5817.25100
30moderatemoderateautomatic8.6617.41100
31moderateautomaticautomatic8.6717.42100
32moderatenoneautomatic8.6717.41100
33automaticmoderateautomatic8.6817.43100
34automaticnoneautomatic8.6917.45100
35nonenoneaggressive9.0418.11100
36noneautomaticaggressive9.118.23100
37nonemoderateaggressive9.1118.24100
38automaticnoneaggressive9.1618.34100
39moderatenoneaggressive9.1618.34100
40moderateautomaticaggressive9.1918.4100
41automaticmoderateaggressive9.2318.5100
42moderateaggressivemoderate10.6422.3100
43automaticaggressiveautomatic10.822.61100
44automaticaggressiveaggressive11.3923.56100
45moderateaggressiveaggressive11.3923.58100
46noneaggressiveaggressive11.6724.44100
47aggressivenonenone43.83118.52100
48aggressiveautomaticnone43.95118.6100
49aggressiveaggressivenone44.01118.67100
50aggressivemoderatenone44.02119.02100
51aggressivenonebasic51.65126.51100
52aggressivemoderatebasic51.79126.32100
53aggressiveaggressivemoderate51.83126.42100
54aggressivenonemoderate51.89126.47100
55aggressiveautomaticbasic51.97126.95100
56aggressivemoderatemoderate52.07126.99100
57aggressiveautomaticmoderate52.09127.18100
58aggressiveaggressivebasic52.1127.22100
59aggressivemoderateautomatic52.15127.4100
60aggressiveautomaticautomatic52.22127.26100
61aggressiveaggressiveautomatic52.44127.51100
62aggressiveautomaticaggressive74.74231.65100
63aggressiveaggressiveaggressive74.91231.98100
64aggressivemoderateaggressive74.91232.07100
65aggressivenoneaggressive75.2232.02100


Last updated: March 04, 2026