FASILL documentation Source fasill_tuning

# Tuning

This library provides predicates for tuning FASILL programs.

Typically, a programmer has a model in mind where some parameters have a clear value. For instance, the truth value of a rule might be statistically determined and, thus, its value is easy to obtain. In other cases, though, the most appropriate values and/or connectives depend on subjective notions and, thus, programmers do not know how to obtain these values. In a typical scenario, we have an extensive set of expected computed answers (i.e., test cases), so the programmer can follow a "try and test" strategy. Unfortunately, this is a tedious and time consuming operation. Actually, it might even be impractical when the program should correctly model a large number of test cases.

For tuning a symbolic program, we don't follow an inefficient, basic method based on applying each symbolic substitution to the original symbolic program and then fully executing the resulting instantiated FASILL programs. Instead of it, we have implemented a thresholded symbolic strategy where symbolic substitutions are directly applied to sfca's (thus, only the interpretive stage is repeatedly executed) and many useless computations are prematurely disregarded by appropriately using dynamic thresholds.

#### tuning_best_substitution/2

tuning_best_substitution( ?Substitution, ?Deviation )

This predicate succeeds when Substitution is the best substitution found so far and Deviation is the deviation with respect to the set of test cases.

#### findall_symbolic_cons/1

findall_symbolic_cons( ?Symbols )

This predicate succeeds when Symbols is the set of symbolic constants contained in the FASILL rules asserted in the current environment.

#### findall_symbolic_cons/2

findall_symbolic_cons( +Expression, ?Symbols )

This predicate succeeds when Symbols is the set of symbolic constants contained in Expression.

#### symbolic_substitution/2

symbolic_substitution( +Symbols, -Substitution )

This predicate succeeds when Symbols is a set of symbolic constants and Substitution is a possible symbolic substitution for constants Symbols. This predicate can be used for generating, by reevaluation, all possible symbolic substitutions for the constants.

#### apply_symbolic_substitution/3

apply_symbolic_substitution( +ExpressionIn, +Substitution, -ExpressionOut )

This predicate succeeds when ExpressionOut is the resulting expression after applying the symbolic substitution Substitution to the expression ExpressionIn.

#### tuning_check_preconditions/2

tuning_check_preconditions( +Preconditions, +Substitution )

This predicate succeeds when the lists of goals Preconditions is satisfied for the symbolic substitution Substitution.

#### testcases_disjoint_sets/1

testcases_disjoint_sets( ?Sets )

This predicate succeeds when ?Sets is the list of disjoint sets of test cases loaded into the current environment, in form of pairs Symbols-SFCAs.

#### testcases_join_symbols/3

testcases_join_symbols( +UnionFindIn, +ListSymbols, ?UnionFindOut )

This predicate succeeds when ?UnionFindOut is the resulting union-find structure of join all the sets in the list of symbols ListSymbols, starting with the union-find structure UnionFindIn.

#### zip_symbols_testcases/3

zip_symbols_testcases( +ItemsBySymbolsIn, +ItemsBySymbols, ?ItemsBySymbolsOut )

This predicate adds the items of the list ItemsBySymbols to the ItemsBySymbolsIn list, producing the ItemsBySymbolsOut list. Items are pairs of the form Symbols-Object, and are classified by Symbols.

This predicate adds the item ItemBySymbols to the ItemsBySymbolsIn list, producing the ItemsBySymbolsOut list. Item is a pair of the form Symbols-Object, and is classified by Symbols.

#### tuning_thresholded/2

tuning_thresholded( ?Substitution, ?Deviation )

This predicate succeeds when Substitution is the best symbolic substitution for the set of test cases loaded into the current environment, with deviation Deviation.

#### tuning_thresholded/3

tuning_thresholded( +Cut, ?Substitution, ?Deviation )

This predicate succeeds when Substitution is the a symbolic substitution for the set of test cases loaded into the current environment, with deviation Deviation less than or equal to Cut. If Cut is set to 0.0, Substitution is the best symbolic substitution.

#### tuning_thresholded/7

tuning_thresholded( +Cut, +Tests, +Preconditions, -Substitutions, -Deviations, +Initial, -Cumulative )

This predicate succeeds when Substitutions is the list of best symbolic substitutions for the sets of test cases Test, with deviations Deviations.

#### tuning_thresholded_do/3

tuning_thresholded_do( +Tests, +Substitution, ?Error )

This predicate succeeds when Substitution is the best symbolic substitution for the set of test cases loaded into the current environment, with deviation Deviation. Tests is the set of test cases with goal partially executed.

#### fasill_print_symbolic_substitution/1

fasill_print_symbolic_substitution( +Substitution )

This predicate writes a FASILL symbolic substitution Substitution for the standard output.