Samchon Framework for CPP  1.0.0
samchon::library::CaseGenerator Class Referenceabstract

Case generator. More...

#include <CaseGenerator.hpp>

Public Member Functions

 CaseGenerator (size_t n, size_t r)
 Construct from size of N and R. More...
 
auto size () const -> size_t
 Get size of all cases. More...
 
virtual auto operator[] (size_t) const -> std::vector< size_t >=0
 Get x'th case. More...
 
auto at (size_t index) const -> std::vector< size_t >
 
auto n () const -> size_t
 Get size of the N. More...
 
auto r () const -> size_t
 Get size of the R. More...
 
auto toMatrix () const -> std::vector< std::vector< size_t >>
 Create a matrix containing all cases. More...
 

Protected Attributes

size_t n_
 N, size of the candidates. More...
 
size_t r_
 R, size of elements of each case. More...
 
size_t size_
 Size, the number of all cases. More...
 

Detailed Description

Case generator.

An abstract case generator using like a matrix

Class Diagram

Library - Genetic Algorithm

Author
Jeongho Nam http://samchon.org

Definition at line 23 of file CaseGenerator.hpp.

Constructor & Destructor Documentation

samchon::library::CaseGenerator::CaseGenerator ( size_t  n,
size_t  r 
)
inline

Construct from size of N and R.

Parameters
nSize of candidates
rSize of elements of each case

Definition at line 51 of file CaseGenerator.hpp.

References n(), and r().

Here is the call graph for this function:

Member Function Documentation

auto samchon::library::CaseGenerator::size ( ) const -> size_t
inline

Get size of all cases.

Returns
Get a number of the all cases

Definition at line 66 of file CaseGenerator.hpp.

References operator[](), and size_.

Referenced by at(), and samchon::examples::packer::Packer::optimize().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual auto samchon::library::CaseGenerator::operator[] ( size_t  ) const -> std::vector< size_t >
pure virtual

Get x'th case.

Returns
The row of the x'th in combined permuation case

Implemented in samchon::library::PermutationGenerator, and samchon::library::CombinedPermutationGenerator.

Referenced by at(), and size().

Here is the caller graph for this function:

auto samchon::library::CaseGenerator::at ( size_t  index) const -> std::vector<size_t>
inline

CaseGenerator::operator[]()

Definition at line 81 of file CaseGenerator.hpp.

References operator[](), and size().

Here is the call graph for this function:

auto samchon::library::CaseGenerator::n ( ) const -> size_t
inline

Get size of the N.

Definition at line 92 of file CaseGenerator.hpp.

References n_.

Referenced by CaseGenerator(), and samchon::library::PermutationGenerator::PermutationGenerator().

Here is the caller graph for this function:

auto samchon::library::CaseGenerator::r ( ) const -> size_t
inline

Get size of the R.

Definition at line 100 of file CaseGenerator.hpp.

References r_.

Referenced by CaseGenerator(), and samchon::library::CombinedPermutationGenerator::CombinedPermutationGenerator().

Here is the caller graph for this function:

auto samchon::library::CaseGenerator::toMatrix ( ) const -> std::vector<std::vector<size_t>>
inline

Create a matrix containing all cases.

Warning
Size of n or r is enourmouse, then stack overflow can be occured.
Returns
A matrix containing all cases.

Definition at line 115 of file CaseGenerator.hpp.

References size_.

Member Data Documentation

size_t samchon::library::CaseGenerator::n_
protected

N, size of the candidates.

Definition at line 29 of file CaseGenerator.hpp.

Referenced by n(), and samchon::library::CombinedPermutationGenerator::operator[]().

size_t samchon::library::CaseGenerator::r_
protected
size_t samchon::library::CaseGenerator::size_
protected

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