forked from devosoft/Empirical
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge in master branch, fix merge conflicts in string_utils.h
- Loading branch information
Showing
24 changed files
with
652 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// This file is part of Empirical, https://github.com/devosoft/Empirical | ||
// Copyright (C) Michigan State University, 2020. | ||
// Released under the MIT Software license; see doc/LICENSE | ||
// | ||
// | ||
// Some examples code for using emp::SettingCombos | ||
|
||
#include <iostream> | ||
#include "config/SettingCombos.h" | ||
|
||
#define PRINT(X) std::cout << #X " = " << X << std::endl | ||
|
||
int main() | ||
{ | ||
emp::SettingCombos config_set; | ||
|
||
config_set.AddSetting<int>("int1") = { 1, 2, 3, 4 }; | ||
config_set.AddSetting<std::string>("string") = { "a", "b", "cde" }; | ||
config_set.AddSetting<int>("int2") = { 5 }; | ||
config_set.AddSetting<double>("double") = { 1.1, 2.2 }; | ||
|
||
do { | ||
std::cout << config_set.CurString() << std::endl; | ||
} while (config_set.Next()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// This file is part of Empirical, https://github.com/devosoft/Empirical | ||
// Copyright (C) Michigan State University, 2018-2020. | ||
// Released under the MIT Software license; see doc/LICENSE | ||
// | ||
// | ||
// Some examples code for using emp::Distribution are derived classes. | ||
|
||
#include <iostream> | ||
#include "tools/Random.h" | ||
#include "tools/Distribution.h" | ||
|
||
int main() | ||
{ | ||
emp::Random random; | ||
|
||
emp::Binomial bi1000(0.003, 1000); | ||
|
||
// Print out the first values in the distribution. | ||
for (size_t i = 0; i < 20; i++) { | ||
std::cout << "bi1000[" << i << "] = " << bi1000[i] << "\n"; | ||
} | ||
std::cout << "Total = " << bi1000.GetTotalProb() << std::endl; | ||
|
||
// Pick some random values... | ||
std::cout << "\nSome random values:"; | ||
for (size_t i = 0; i < 100; i++) { | ||
std::cout << " " << bi1000.PickRandom(random); | ||
} | ||
std::cout << std::endl; | ||
|
||
// And total some more random picks (to take a bit of time). | ||
size_t total = 0; | ||
const size_t test_count = 10000000; | ||
|
||
for (size_t i = 0; i < test_count; i++) { | ||
total += bi1000.PickRandom(random); | ||
} | ||
|
||
std::cout << "Average of " << test_count << " = " | ||
<< (((double) total) / (double) test_count) | ||
<< std::endl; | ||
|
||
|
||
//emp::NegativeBinomial nbi10(0.5, 2); | ||
emp::NegativeBinomial nbi10(0.3, 10); | ||
|
||
std::cout << "\n-- Negative Binomial--\n"; | ||
|
||
std::cout << "size = " << nbi10.GetSize() << std::endl | ||
<< "total_prob = " << nbi10.GetTotalProb() << std::endl; | ||
|
||
// for (size_t i = 0; i < 10; i++) { | ||
for (size_t i = 9; i < 40; i++) { | ||
std::cout << "nbi10[" << i << "] = " << nbi10[i] << "\n"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.