#include <Optimizer.h>
Public Member Functions | |
Optimizer (Input &i) | |
Initialize some variables. | |
virtual | ~Optimizer () |
Optimizer's destructor. | |
virtual void | Evolve ()=0 |
Searches for a optimal solution (via Genetic Algorithm, Best Fit or Split). | |
void | Output () |
Print the result to the standard output. | |
Protected Member Functions | |
virtual std::ostream & | Write (std::ostream &s) const |
Write to streams the name and parameters of the search algorithms. | |
Params::Size_t | Evaluate (const BinSet &bs) const |
Evaluate candidates. | |
Protected Attributes | |
std::vector< const SizeName * > & | m_files |
Vector of input files/sizes. | |
Params & | m_params |
Global parameters. | |
const Params::Size_t | m_total_size |
BinSet * | m_solution |
Private Member Functions | |
Optimizer (const Optimizer &) | |
Copies are not allowed. | |
Optimizer & | operator= (const Optimizer &) |
Attributions are not allowed. | |
Friends | |
std::ostream & | operator<< (std::ostream &, const Optimizer &) |
This overloaded operator prints the name and parameters of the search algorithms. |
Optimizer::Optimizer | ( | Input & | i | ) | [inline] |
Initialize some variables.
References EPSILON, Params::m_bins_theo, m_params, Params::m_target, m_total_size, Params::m_verbose, and ROUND.
virtual Optimizer::~Optimizer | ( | ) | [inline, virtual] |
Optimizer's destructor.
Optimizer::Optimizer | ( | const Optimizer & | ) | [private] |
Copies are not allowed.
virtual void Optimizer::Evolve | ( | ) | [pure virtual] |
Searches for a optimal solution (via Genetic Algorithm, Best Fit or Split).
Implemented in BestFit, GeneticAlgorithm, and Split.
Referenced by main().
void Optimizer::Output | ( | ) |
Print the result to the standard output.
Print the selected files, a brief summary (sum, diff and number of selected files).
References BinSet::begin(), SizeName::CmpName(), SizeName::CmpNameNocase(), SizeName::CmpNameRev(), SizeName::CmpNameRevNocase(), SizeName::CmpSize(), SizeName::CmpSizeRev(), BinSet::Count(), BinSet::end(), Params::m_bins_separator, Params::m_delimit_chr, Params::m_enclose, Params::m_enclose_chr, m_files, Params::m_hide_items, Params::m_hide_summary, Params::m_max_bins, Params::m_no_case, m_params, Params::m_show_size, m_solution, Params::m_sort_by_size, Params::m_sort_reverse, Params::m_split, m_total_size, Params::m_verbose, and Params::PrettySize().
Referenced by main().
virtual std::ostream& Optimizer::Write | ( | std::ostream & | s | ) | const [inline, protected, virtual] |
Write to streams the name and parameters of the search algorithms.
Reimplemented in BestFit, GeneticAlgorithm, and Split.
References Params::m_bins_theo, m_files, m_params, Params::m_target, and Params::PrettySize().
Referenced by operator<<().
Params::Size_t Optimizer::Evaluate | ( | const BinSet & | bs | ) | const [protected] |
std::ostream& operator<< | ( | std::ostream & | s, | |
const Optimizer & | optimizer | |||
) | [friend] |
This overloaded operator prints the name and parameters of the search algorithms.
std::vector<const SizeName*>& Optimizer::m_files [protected] |
Vector of input files/sizes.
Referenced by BestFit::BestFit(), Split::Evolve(), BestFit::Evolve(), GeneticAlgorithm::GeneticAlgorithm(), GeneticAlgorithm::InitPopulation(), Output(), and Write().
Params& Optimizer::m_params [protected] |
const Params::Size_t Optimizer::m_total_size [protected] |
Total size of the input items.
Referenced by Optimizer(), and Output().
BinSet* Optimizer::m_solution [protected] |
Pointer to the best solution found.
Referenced by Split::Evolve(), GeneticAlgorithm::Evolve(), BestFit::Evolve(), Output(), BestFit::~BestFit(), and Split::~Split().