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

Results from optimization.tuner

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

Tuner Information
Target SolverMILP
Number of Tuning Options12
Number of Tuning Instances1
Tuning Option SetAUTOMATIC
Performance GoalGEOMEAN
Tuner Time Limit1.797693E308
Tuner Configurations Limit30

Tuner Summary
Actual Tuning Time172.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 Configurations30
Number of Improved Configurations2

Tuner Results
ConfigurationconflictSearchcutGomorycutMiLiftedcutStrategycutZeroHalfheuristicsnodelSelpresolverproberestartssymmetryvarSelMean of Run TimesSum of Run TimesPercentage Successful
0automaticautomaticautomaticautomaticautomaticautomaticautomaticautomaticautomaticautomaticautomaticautomatic17.9717.97100
1automaticautomaticautomaticautomaticautomaticautomaticautomaticautomaticautomaticautomaticnoneautomatic11.4411.44100
2moderateaggressivemoderatemoderateaggressivemoderatebestBoundaggressivebasicmoderatenonepseudo11.8211.82100
3aggressivenoneaggressivenonemoderateautomaticbestBoundmoderateautomaticnonemoderateryanFoster25.9325.93100
4moderatenoneautomaticautomaticnoneautomaticautomaticnonenonebasicautomaticpseudo29.7829.78100
5moderatemoderatemoderatemoderateaggressivemoderatebestBoundbasicbasicmoderatenonepseudo30.1730.17100
6moderateaggressivemoderatemoderateaggressivemoderatebestBoundbasicbasicmoderatemoderatepseudo30.5630.56100
7moderateaggressivemoderatemoderateaggressivemoderateautomaticbasicbasicmoderatenonepseudo32.0132.01100
8moderateaggressivemoderatemoderateautomaticmoderatebestBoundbasicbasicmoderatenonepseudo33.7933.79100
9moderateaggressivemoderatemoderateaggressivemoderatebestBoundbasicbasicmoderatenoneautomatic34.2734.27100
10aggressiveaggressivemoderatemoderateaggressivemoderatebestBoundbasicbasicmoderatenonepseudo35.6735.67100
11moderateaggressivemoderatemoderateaggressivemoderatedepthbasicbasicmoderatenonepseudo36.736.7100
12moderateautomaticmoderatemoderateaggressivemoderatebestBoundbasicbasicmoderatenonepseudo36.7736.77100
13moderateaggressivemoderatemoderateaggressivemoderatebestBoundmoderatebasicmoderatenonepseudo42.5642.56100
14moderateaggressivemoderatenoneaggressivemoderatebestBoundbasicbasicmoderatenonepseudo50.9750.97100
15automaticaggressivemoderatemoderateaggressivemoderatebestBoundbasicbasicmoderatenonepseudo51.7751.77100
16moderateaggressivemoderatemoderateaggressiveautomaticbestBoundbasicbasicmoderatenonepseudo55.7355.73100
17moderateaggressivemoderatemoderateaggressivemoderatebestBoundbasicnonemoderatenonepseudo59.759.7100
18moderatenoneautomaticmoderateaggressivenonebestBoundmoderateautomaticnoneautomaticryanFoster65.9465.94100
19moderateaggressivemoderatemoderateaggressivemoderatebestBoundbasicbasicnonenonepseudo66.2366.23100
20moderateaggressivemoderatemoderateaggressivemoderatebestBoundbasicbasicmoderatenonepseudo66.7366.73100
21moderateaggressivemoderatemoderatemoderatemoderatebestBoundbasicbasicmoderatenonepseudo68.9268.92100
22moderateaggressiveaggressivemoderateaggressivemoderatebestBoundbasicbasicmoderatenonepseudo69.7469.74100
23moderateaggressivemoderatemoderateaggressivemoderatebestBoundbasicbasicmoderateaggressivepseudo71.6471.64100
24moderateaggressivemoderatemoderateaggressivemoderatebestBoundbasicbasicbasicnonepseudo72.8372.83100
25nonenonemoderateaggressivenoneautomaticbestEstimatedepthmoderatenonebasicnoneautomatic100.85100.850
26moderateaggressivemoderatemoderateaggressivemoderatebestBoundbasicbasicmoderatenonemaxInfeas103.35103.350
27automaticnonenonemoderatemoderateautomaticautomaticnoneautomaticnonebasicminInfeas100.43100.430
28nonemoderatemoderatenoneaggressivenonedepthautomaticautomaticautomaticnoneminInfeas100.06100.060
29aggressivenonenoneaggressivemoderatenonedepthautomaticautomaticnoneaggressiveminInfeas100.72100.720


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.

Last updated: April 22, 2022