Open and09 opened 7 years ago
I've added example input.txt It contains set of points
nice, meybe add Makefile for linux?
Sorry, but I don't write for linux and I don't create makefiles itself
I have many errors
If you are work on linux try to change "void main" by "int main(int argc, char* argv[])" and add "return 1;" to the end of main function
on mac.
$ g++ main.cpp Genetic.cpp In file included from main.cpp:2: ./Genetic.h:23:20: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] int MaxIterations = 100; ^ ./Genetic.h:24:20: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] int MaxPopulation = 100; ^ ./Genetic.h:29:26: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] bool DoubleCrossingover = false; ^ main.cpp:5:1: error: 'main' must return 'int' void main() ^~~~ int main.cpp:16:37: error: expected expression sort(solves.begin(), solves.end(), [](Polynom &a, Polynom &b) -> bool {return a... ^ main.cpp:24:8: error: call to 'abs' is ambiguous if (abs(solves[c].Coefficients[i]) > 0.01) ^~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/stdlib.h:129:6: note: candidate function int abs(int) pure2; ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstdlib:167:44: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(x);} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstdlib:169:44: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} ^ 3 warnings and 3 errors generated. In file included from Genetic.cpp:1: ./Genetic.h:23:20: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] int MaxIterations = 100; ^ ./Genetic.h:24:20: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] int MaxPopulation = 100; ^ ./Genetic.h:29:26: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] bool DoubleCrossingover = false; ^ Genetic.cpp:50:7: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions] for (auto data : InputData) ^ Genetic.cpp:50:17: warning: range-based for loop is a C++11 extension [-Wc++11-extensions] for (auto data : InputData) ^ Genetic.cpp:61:25: error: use of undeclared identifier 'sqrt' p->StandardDeviation = sqrt(deviation / InputData.size()); ^ Genetic.cpp:72:8: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions] for (auto data : InputData) ^ Genetic.cpp:72:18: warning: range-based for loop is a C++11 extension [-Wc++11-extensions] for (auto data : InputData) ^ Genetic.cpp:83:36: error: use of undeclared identifier 'sqrt' Specimens[j].StandardDeviation = sqrt(deviation / InputData.size()); ^ Genetic.cpp:85:43: error: expected expression sort(Specimens.begin(), Specimens.end(), [](Polynom &a, Polynom &b) -> bool {re... ^ Genetic.cpp:161:44: error: expected expression sort(mutated_p.begin(), mutated_p.end(), [](Polynom &a, Polynom &b) -> ... ^ Genetic.cpp:238:44: error: expected expression sort(Specimens.begin(), Specimens.end(), [](Polynom &a, Polynom &b) -> ... ^ Genetic.cpp:245:62: error: expected expression Specimens.erase(unique(Specimens.begin(), Specimens.end(), [](Polynom &... ^ 7 warnings and 6 errors generated.
Makefile is simple 2 line file:
gen: main.cpp Genetic.cpp Genetic.h
[tab][tab]g++ main.cpp Genetic.cpp
next type make
meybe add example files?