spot  2.16
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
spot::random_psl Class Reference

Generate random PSL formulas. More...

#include <spot/tl/randomltl.hh>

Inheritance diagram for spot::random_psl:
Collaboration diagram for spot::random_psl:

Public Member Functions

 random_psl (const atomic_prop_set *ap)
 
const atomic_prop_setap () const
 Return the set of atomic proposition used to build formulas. More...
 
const atomic_prop_setoutput_ap () const
 Return the set of atomic proposition used to build formulas. More...
 
std::function< bool(formula)> is_output_fun () const
 Return the predicate that classifies propositions as output. More...
 
const atomic_prop_setpatterns () const
 Return the set of patterns (sub-formulas) used to build formulas. More...
 
bool draw_literals () const
 Check whether relabeling APs should use literals. More...
 
void draw_literals (bool lit)
 Set whether relabeling APs should use literals. More...
 
formula generate (int n) const
 Generate a formula of size n. More...
 
std::ostream & dump_priorities (std::ostream &os) const
 Print the priorities of each operator, constants, and atomic propositions. More...
 
const char * parse_options (const char *options)
 Update the priorities used to generate the formulas. More...
 
bool has_unary_ops () const
 whether we can use unary operators More...
 

Public Attributes

random_sere rs
 The SERE generator used to generate SERE subformulas. More...
 

Protected Member Functions

void setup_proba_ (const atomic_prop_set *patterns)
 Initialize the probability table, optionally using patterns as atoms. More...
 
void update_sums ()
 Recompute running probability sums after priorities have changed. More...
 

Protected Attributes

unsigned proba_size_
 Number of entries in the operator table. More...
 
op_probaproba_
 Operator probability table. More...
 
double total_1_
 Total weight of unary operators. More...
 
op_probaproba_2_
 Pointer to binary operators in the table. More...
 
double total_2_
 Total weight of binary operators. More...
 
op_probaproba_2_or_more_
 
double total_2_and_more_
 Total weight of operators needing two or more children. More...
 
const atomic_prop_setap_
 
const atomic_prop_setoutput_ap_ = nullptr
 Output atomic propositions (may be null if not used). More...
 
const atomic_prop_setpatterns_ = nullptr
 Sub-formula patterns used as atoms (may be null). More...
 
std::function< bool(formula)> is_output_ = nullptr
 Predicate classifying a proposition as an output (may be null). More...
 
bool draw_literals_
 Whether relabeling APs should use literals. More...
 

Detailed Description

Generate random PSL formulas.

This class recursively constructs PSL formulas of a given size. The formulas will use atomic propositions from the set of propositions passed to the constructor, in addition to the constant and all PSL operators supported by Spot.

Constructor & Destructor Documentation

◆ random_psl()

spot::random_psl::random_psl ( const atomic_prop_set ap)

Create a random PSL generator using atomic propositions from ap.

PSL formulas are built by combining LTL operators, plus three operators (EConcat, UConcat, Closure) taking a SERE as parameter.

The default priorities are defined as follows:

ap      n
false   1
true    1
not     1
F       1
G       1
X       1
Closure 1
equiv   1
implies 1
xor     1
R       1
U       1
W       1
M       1
and     1
or      1
EConcat 1
UConcat 1

Where n is the number of atomic propositions in the set passed to the constructor.

This means that each operator has equal chance to be selected. Also, each atomic proposition has as much chance as each constant (i.e., true and false) to be picked.

These priorities can be changed using the parse_options method.

In addition, you can set the properties of the SERE generator used to build SERE subformulas using the parse_options method of the rs attribute.

Member Function Documentation

◆ ap()

const atomic_prop_set* spot::random_formula::ap ( ) const
inlineinherited

Return the set of atomic proposition used to build formulas.

◆ draw_literals() [1/2]

bool spot::random_formula::draw_literals ( ) const
inlineinherited

Check whether relabeling APs should use literals.

◆ draw_literals() [2/2]

void spot::random_formula::draw_literals ( bool  lit)
inlineinherited

Set whether relabeling APs should use literals.

◆ dump_priorities()

std::ostream& spot::random_formula::dump_priorities ( std::ostream &  os) const
inherited

Print the priorities of each operator, constants, and atomic propositions.

◆ generate()

formula spot::random_formula::generate ( int  n) const
inherited

Generate a formula of size n.

It is possible to obtain formulas that are smaller than n, because some simple simplifications are performed by the AST. (For instance the formula a | a is automatically reduced to a by spot::multop.)

◆ has_unary_ops()

bool spot::random_formula::has_unary_ops ( ) const
inlineinherited

whether we can use unary operators

◆ is_output_fun()

std::function<bool(formula)> spot::random_formula::is_output_fun ( ) const
inlineinherited

Return the predicate that classifies propositions as output.

◆ output_ap()

const atomic_prop_set* spot::random_formula::output_ap ( ) const
inlineinherited

Return the set of atomic proposition used to build formulas.

◆ parse_options()

const char* spot::random_formula::parse_options ( const char *  options)
inherited

Update the priorities used to generate the formulas.

options should be comma-separated list of KEY=VALUE assignments, using keys from the above list. For instance "xor=0, F=3" will prevent xor from being used, and will raise the relative probability of occurrences of the F operator.

The input string is not modified.

◆ patterns()

const atomic_prop_set* spot::random_formula::patterns ( ) const
inlineinherited

Return the set of patterns (sub-formulas) used to build formulas.

◆ setup_proba_()

void spot::random_ltl::setup_proba_ ( const atomic_prop_set patterns)
protectedinherited

Initialize the probability table, optionally using patterns as atoms.

◆ update_sums()

void spot::random_formula::update_sums ( )
protectedinherited

Recompute running probability sums after priorities have changed.

Member Data Documentation

◆ ap_

const atomic_prop_set* spot::random_formula::ap_
protectedinherited

Atomic propositions used to build formulas.

◆ draw_literals_

bool spot::random_formula::draw_literals_
protectedinherited

Whether relabeling APs should use literals.

◆ is_output_

std::function<bool(formula)> spot::random_formula::is_output_ = nullptr
protectedinherited

Predicate classifying a proposition as an output (may be null).

◆ output_ap_

const atomic_prop_set* spot::random_formula::output_ap_ = nullptr
protectedinherited

Output atomic propositions (may be null if not used).

◆ patterns_

const atomic_prop_set* spot::random_formula::patterns_ = nullptr
protectedinherited

Sub-formula patterns used as atoms (may be null).

◆ proba_

op_proba* spot::random_formula::proba_
protectedinherited

Operator probability table.

◆ proba_2_

op_proba* spot::random_formula::proba_2_
protectedinherited

Pointer to binary operators in the table.

◆ proba_2_or_more_

op_proba* spot::random_formula::proba_2_or_more_
protectedinherited

Pointer to operators needing ≥2 children.

◆ proba_size_

unsigned spot::random_formula::proba_size_
protectedinherited

Number of entries in the operator table.

◆ rs

random_sere spot::random_psl::rs

The SERE generator used to generate SERE subformulas.

◆ total_1_

double spot::random_formula::total_1_
protectedinherited

Total weight of unary operators.

◆ total_2_

double spot::random_formula::total_2_
protectedinherited

Total weight of binary operators.

◆ total_2_and_more_

double spot::random_formula::total_2_and_more_
protectedinherited

Total weight of operators needing two or more children.


The documentation for this class was generated from the following file:

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.9.1