souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions
souffle::ast::MaxRatioSips Class Reference

Goal: prioritise max ratio of bound args. More...

#include <SipsMetric.h>

Inheritance diagram for souffle::ast::MaxRatioSips:
Inheritance graph
Collaboration diagram for souffle::ast::MaxRatioSips:
Collaboration graph

Public Member Functions

 MaxRatioSips ()=default
 
- Public Member Functions inherited from souffle::ast::SipsMetric
std::vector< unsigned int > getReordering (const Clause *clause) const
 Determines the new ordering of a clause after the SIPS is applied. More...
 
virtual ~SipsMetric ()=default
 

Protected Member Functions

std::vector< double > evaluateCosts (const std::vector< Atom * > atoms, const BindingStore &bindingStore) const override
 Evaluates the cost of choosing each atom next in the current schedule. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from souffle::ast::SipsMetric
static std::unique_ptr< SipsMetriccreate (const std::string &heuristic, const TranslationUnit &tu)
 Create a SIPS metric based on a given heuristic. More...
 

Detailed Description

Goal: prioritise max ratio of bound args.

Definition at line 104 of file SipsMetric.h.

Constructor & Destructor Documentation

◆ MaxRatioSips()

souffle::ast::MaxRatioSips::MaxRatioSips ( )
default

Member Function Documentation

◆ evaluateCosts()

std::vector< double > souffle::ast::MaxRatioSips::evaluateCosts ( const std::vector< Atom * >  atoms,
const BindingStore bindingStore 
) const
overrideprotectedvirtual

Evaluates the cost of choosing each atom next in the current schedule.

Parameters
atomsatoms to choose from; may be nullptr
bindingStorethe variables already bound to a value

Implements souffle::ast::SipsMetric.

Definition at line 178 of file SipsMetric.cpp.

184  {
185  // Always better than anything else
186  cost.push_back(0);
187  } else if (numBound == 0) {
188  // Always worse than anything else
189  cost.push_back(2);
190  } else {
191  // Between 0 and 1, decreasing as the ratio increases
192  cost.push_back(1 - numBound / arity);
193  }
194  }
195  assert(atoms.size() == cost.size() && "each atom should have exactly one cost");
196  return cost;
197 }
198 
199 std::vector<double> LeastFreeSips::evaluateCosts(
200  const std::vector<Atom*> atoms, const BindingStore& bindingStore) const {
201  // Goal: choose the atom with the least number of unbound arguments
202  std::vector<double> cost;
203  for (const auto* atom : atoms) {

The documentation for this class was generated from the following files:
souffle::ast::LeastFreeSips::evaluateCosts
std::vector< double > evaluateCosts(const std::vector< Atom * > atoms, const BindingStore &bindingStore) const override
Evaluates the cost of choosing each atom next in the current schedule.
Definition: SipsMetric.cpp:205