Pallas Solver  0.1
C++ Global Optimization Algorithms
mutation_strategy.h
1 // Pallas Solver
2 // Copyright 2015. All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 //
7 // * Redistributions of source code must retain the above copyright notice,
8 // this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright notice,
10 // this list of conditions and the following disclaimer in the documentation
11 // and/or other materials provided with the distribution.
12 //
13 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
17 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 // POSSIBILITY OF SUCH DAMAGE.
24 //
25 // Author: ryan.latture@gmail.com (Ryan Latture)
26 
27 #ifndef PALLAS_MUTATION_STRATEGY_H
28 #define PALLAS_MUTATION_STRATEGY_H
29 
30 #include "pallas/types.h"
31 
32 namespace pallas {
33  namespace internal {
34 
36  public:
37  static MutationStrategy* Create(MutationStrategyType type);
38 
39  virtual ~MutationStrategy() {};
40 
41  virtual Vector get_bprime(const std::vector<Vector> &population,
42  unsigned int candidate,
43  const int* samples,
44  double scale) = 0;
45 
46  unsigned int NumSamples() const;
47 
48  protected:
49  unsigned int num_samples_;
50  };
51 
52  class MutateBest1 : public MutationStrategy {
53  public:
54  MutateBest1();
55 
56  Vector get_bprime(const std::vector<Vector> &population,
57  unsigned int candidate,
58  const int* samples,
59  double scale);
60  };
61 
62  class MutateRand1 : public MutationStrategy {
63  public:
64  MutateRand1();
65 
66  Vector get_bprime(const std::vector<Vector> &population,
67  unsigned int candidate,
68  const int* samples,
69  double scale);
70  };
71 
73  public:
75 
76  Vector get_bprime(const std::vector<Vector> &population,
77  unsigned int candidate,
78  const int* samples,
79  double scale);
80 
81  };
82 
83  class MutateBest2 : public MutationStrategy {
84  public:
85  MutateBest2();
86 
87  Vector get_bprime(const std::vector<Vector> &population,
88  unsigned int candidate,
89  const int* samples,
90  double scale);
91 
92  };
93 
94  class MutateRand2 : public MutationStrategy {
95  public:
96  MutateRand2();
97 
98  Vector get_bprime(const std::vector<Vector> &population,
99  unsigned int candidate,
100  const int* samples,
101  double scale);
102 
103  };
104 
105  } // namespace internal
106 } // namespace pallas
107 
108 #endif // PALLAS_MUTATION_STATEGY_H
Definition: mutation_strategy.h:83
Definition: mutation_strategy.h:35
Definition: mutation_strategy.h:62
Definition: basinhopping.h:51
Definition: mutation_strategy.h:94
Definition: mutation_strategy.h:72
Definition: mutation_strategy.h:52