You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cpp_code.cpp 5.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. else if (option.first == "random-inits") {
  2. try {
  3. num_random_inits_ = std::stoul(option.second);
  4. desired_num_random_inits_ = num_random_inits_;
  5. }
  6. catch (...) {
  7. throw Error(std::string("Invalid argument \"") + option.second + "\" for option random-inits. Usage: options = \"[--random-inits <convertible to int greater 0>]\"");
  8. }
  9. if (num_random_inits_ <= 0) {
  10. throw Error(std::string("Invalid argument \"") + option.second + "\" for option random-inits. Usage: options = \"[--random-inits <convertible to int greater 0>]\"");
  11. }
  12. }
  13. else if (option.first == "randomness") {
  14. if (option.second == "PSEUDO") {
  15. use_real_randomness_ = false;
  16. }
  17. else if (option.second == "REAL") {
  18. use_real_randomness_ = true;
  19. }
  20. else {
  21. throw Error(std::string("Invalid argument \"") + option.second + "\" for option randomness. Usage: options = \"[--randomness REAL|PSEUDO] [...]\"");
  22. }
  23. }
  24. else if (option.first == "stdout") {
  25. if (option.second == "0") {
  26. print_to_stdout_ = 0;
  27. }
  28. else if (option.second == "1") {
  29. print_to_stdout_ = 1;
  30. }
  31. else if (option.second == "2") {
  32. print_to_stdout_ = 2;
  33. }
  34. else {
  35. throw Error(std::string("Invalid argument \"") + option.second + "\" for option stdout. Usage: options = \"[--stdout 0|1|2] [...]\"");
  36. }
  37. }
  38. else if (option.first == "refine") {
  39. if (option.second == "TRUE") {
  40. refine_ = true;
  41. }
  42. else if (option.second == "FALSE") {
  43. refine_ = false;
  44. }
  45. else {
  46. throw Error(std::string("Invalid argument \"") + option.second + "\" for option refine. Usage: options = \"[--refine TRUE|FALSE] [...]\"");
  47. }
  48. }
  49. else if (option.first == "time-limit") {
  50. try {
  51. time_limit_in_sec_ = std::stod(option.second);
  52. }
  53. catch (...) {
  54. throw Error(std::string("Invalid argument \"") + option.second + "\" for option time-limit. Usage: options = \"[--time-limit <convertible to double>] [...]");
  55. }
  56. }
  57. else if (option.first == "max-itrs") {
  58. try {
  59. max_itrs_ = std::stoi(option.second);
  60. }
  61. catch (...) {
  62. throw Error(std::string("Invalid argument \"") + option.second + "\" for option max-itrs. Usage: options = \"[--max-itrs <convertible to int>] [...]");
  63. }
  64. }
  65. else if (option.first == "max-itrs-without-update") {
  66. try {
  67. max_itrs_without_update_ = std::stoi(option.second);
  68. }
  69. catch (...) {
  70. throw Error(std::string("Invalid argument \"") + option.second + "\" for option max-itrs-without-update. Usage: options = \"[--max-itrs-without-update <convertible to int>] [...]");
  71. }
  72. }
  73. else if (option.first == "seed") {
  74. try {
  75. seed_ = std::stoul(option.second);
  76. }
  77. catch (...) {
  78. throw Error(std::string("Invalid argument \"") + option.second + "\" for option seed. Usage: options = \"[--seed <convertible to int greater equal 0>] [...]");
  79. }
  80. }
  81. else if (option.first == "epsilon") {
  82. try {
  83. epsilon_ = std::stod(option.second);
  84. }
  85. catch (...) {
  86. throw Error(std::string("Invalid argument \"") + option.second + "\" for option epsilon. Usage: options = \"[--epsilon <convertible to double greater 0>] [...]");
  87. }
  88. if (epsilon_ <= 0) {
  89. throw Error(std::string("Invalid argument \"") + option.second + "\" for option epsilon. Usage: options = \"[--epsilon <convertible to double greater 0>] [...]");
  90. }
  91. }
  92. else if (option.first == "inits-increase-order") {
  93. try {
  94. num_inits_increase_order_ = std::stoul(option.second);
  95. }
  96. catch (...) {
  97. throw Error(std::string("Invalid argument \"") + option.second + "\" for option inits-increase-order. Usage: options = \"[--inits-increase-order <convertible to int greater 0>]\"");
  98. }
  99. if (num_inits_increase_order_ <= 0) {
  100. throw Error(std::string("Invalid argument \"") + option.second + "\" for option inits-increase-order. Usage: options = \"[--inits-increase-order <convertible to int greater 0>]\"");
  101. }
  102. }
  103. else if (option.first == "init-type-increase-order") {
  104. init_type_increase_order_ = option.second;
  105. if (option.second != "CLUSTERS" and option.second != "K-MEANS++") {
  106. throw ged::Error(std::string("Invalid argument ") + option.second + " for option init-type-increase-order. Usage: options = \"[--init-type-increase-order CLUSTERS|K-MEANS++] [...]\"");
  107. }
  108. }
  109. else if (option.first == "max-itrs-increase-order") {
  110. try {
  111. max_itrs_increase_order_ = std::stoi(option.second);
  112. }
  113. catch (...) {
  114. throw Error(std::string("Invalid argument \"") + option.second + "\" for option max-itrs-increase-order. Usage: options = \"[--max-itrs-increase-order <convertible to int>] [...]");
  115. }
  116. }
  117. else {
  118. std::string valid_options("[--init-type <arg>] [--random-inits <arg>] [--randomness <arg>] [--seed <arg>] [--stdout <arg>] ");
  119. valid_options += "[--time-limit <arg>] [--max-itrs <arg>] [--epsilon <arg>] ";
  120. valid_options += "[--inits-increase-order <arg>] [--init-type-increase-order <arg>] [--max-itrs-increase-order <arg>]";
  121. throw Error(std::string("Invalid option \"") + option.first + "\". Usage: options = \"" + valid_options + "\"");
  122. }

A Python package for graph kernels, graph edit distances and graph pre-image problem.