svmranker:usage
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
svmranker:usage [2020/11/17 21:03] – merlin | svmranker:usage [2020/11/17 22:57] – merlin | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | **[[svmranker: | ||
====== Usage ====== | ====== Usage ====== | ||
In the following, we assume that current directory is SVMRanker. | In the following, we assume that current directory is SVMRanker. | ||
Line 8: | Line 9: | ||
Usage: CLIMain.py [OPTIONS] COMMAND [ARGS]... | Usage: CLIMain.py [OPTIONS] COMMAND [ARGS]... | ||
" | " | ||
- | | + | |
Options: | Options: | ||
--help | --help | ||
- | | + | |
Commands: | Commands: | ||
lmulti | lmulti | ||
lnested | lnested | ||
- | | + | parseboogie |
- | parsectoboogie | + | |
- | parsectopy | + | |
- | As we can see, SVMRanker provides five commands. The first two commands allow for proving termination of a given program while the remaining three can be used for parsing the input file and translate it to a different format. In the remaining part of the section we focus on the details for the use of the lmulti and lnested commands. | + | As we can see, SVMRanker provides five commands. The first two commands allow for proving termination of a given program while the remaining three can be used for parsing the input file and translate it to a different format. In the remaining part of the section we focus on the details for the use of the **lmulti** and **lnested** commands. |
- | lmulti, short for learning multiphase ranking function, instructs SVMRanker to learn a multiphase ranking function for the given program. To get the detailed usage information for this command, one can use the following command. | + | **lmulti**, short for learning multiphase ranking function, instructs SVMRanker to learn a multiphase ranking function for the given program. To get the detailed usage information for this command, one can use the following command. |
+ | python3 ./ | ||
+ | |||
+ | The output is the following. | ||
+ | |||
+ | < | ||
+ | SVMRanker --- Version 1.0 | ||
+ | Usage: CLIMain.py lmulti [OPTIONS] SOURCE | ||
+ | |||
+ | Options: | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | num not enough default set to ENLARGE | ||
+ | |||
+ | | ||
+ | use f(x) < b to cut | ||
+ | | ||
+ | | ||
+ | | ||
+ | default set to MINI | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | or combination of all variables | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | </ | ||
+ | |||
+ | As the help shows, there are several options available to tune the execution of lmulti; we present their usage by means of a couple of examples. \\ | ||
+ | |||
+ | <code c Example1.c> | ||
+ | int main() { | ||
+ | int x, y; | ||
+ | | ||
+ | x = x + y - 1; | ||
+ | y = y - 1; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | The is the first C program we consider here; see the file src/ | ||
+ | python3 ./ | ||
+ | SVMRanker completes the analysis by returning a 2-multiphase ranking function for the **Example1.c** program, as shown below. | ||
+ | < | ||
+ | SVMRanker --- Version 1.0 | ||
+ | example/ | ||
+ | --------------------LEARNING MULTIPHASE SUMMARY------------------- | ||
+ | MULTIPHASE DEPTH: | ||
+ | LEARNING RESULT: | ||
+ | -----------RANKING FUNCTIONS---------- | ||
+ | 5.0 * 1 + 1.0 * y^1 + 5.0 * 1 | ||
+ | 0.0796 * x^1 + 0.482 * 1 + 0.482 * 1 | ||
+ | </ | ||
+ | Notice that we used the option **--filetype** to specify the type of the input program, given that SVMRanker supports both Boogie programs and C programs as input file, with the former being the default format. Furthermore, | ||
+ | |||
+ | <code c Example2.c> | ||
+ | int main() { | ||
+ | int x, y; | ||
+ | | ||
+ | x = x + y; | ||
+ | y = y + z; | ||
+ | z = z - 1; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | If we run SVMRanker on **Example2.c** with the default value of 2 for **--depth_bound**, | ||
+ | | ||
+ | With the help of **--depth_bound**, | ||
+ | < | ||
+ | SVMRanker --- Version 1.0 | ||
+ | example/ | ||
+ | --------------------LEARNING MULTIPHASE SUMMARY------------------- | ||
+ | MULTIPHASE DEPTH: | ||
+ | LEARNING RESULT: | ||
+ | -----------RANKING FUNCTIONS---------- | ||
+ | 2.0 * 1 + 2.0 * 1 + 1.0 * z^1 + 2.0 * 1 | ||
+ | 1.0 * 1 + 0.2154 * y^1 + 1.0 * 1 + 1.0 * 1 | ||
+ | 0.0911 * x^1 + 0.3226 * 1 + 0.3226 * 1 + 0.3226 * 1 | ||
+ | </ | ||
+ | We now present the other options that let SVMRanker use different strategies in the process of learning a multiphase ranking function; different strategies regarding how program data points are sampled, how the state space is cut, and what templates are used, influence the running time of SVMRanker and possibly the final result. | ||
+ | |||
+ | * - -sample_strategy This option controls the strategy SVMRanker uses to sample program data points. Possible values are CONSTRAINT and ENLARGE (the default): CONSTRAINT samples randomly the points satisfying the loop condition/ | ||
+ | |||
+ | * - -cutting_strategy This option controls the bound $b$ of the constraint f(x) < b that is used to cut the program state space in two parts for the current phase' | ||
+ | |||
+ | * - -template_strategy This option controls what templates are used in the learning procedure. Possible values are FULL and SINGLEFULL (the default): FULL uses as templates the linear combinations of all program variables; SINGLEFULL extends FULL with templates using only one variable at a time. | ||
+ | |||
+ | * - -print_level This option controls the verbosity of the SVMRanker output. | ||
+ | |||
+ | The SVMRanker command **lnested**, | ||
+ | python3 ./ | ||
+ | The output is the following. | ||
+ | < | ||
+ | SVMRanker --- Version 1.0 | ||
+ | Usage: CLIMain.py **lnested** [OPTIONS] SOURCE | ||
+ | |||
+ | Options: | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | if sample num not enough default set to ENLARGE | ||
+ | |||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | </ | ||
+ | As we can see, the options of ****lnested**** are also the ones of lmulti; also the use of **lnested** is similar to the one of **lmulti**, just the outcome can be different. | ||
+ | |||
+ | For instance, we can prove termination of ****Example2.c**** by means of a learned nested ranking function by running SVMRanker as follows. | ||
+ | python3 ./ | ||
+ | The output is shown below. | ||
+ | < | ||
+ | SVMRanker --- Version 1.0 | ||
+ | example/ | ||
+ | --------------------LEARNING NESTED SUMMARY------------------- | ||
+ | NESTED DEPTH: | ||
+ | LEARNING RESULT: | ||
+ | -----------RANKING FUNCTIONS---------- | ||
+ | 1.0 * z^1.0 + 0.9 * 1; 1.0 * y^1.0 + 0.9 * 1; 1.0 * x^1.0 + 0.7 * 1 | ||
+ | </ |