Skip to content

Commit

Permalink
cross-platform
Browse files Browse the repository at this point in the history
  • Loading branch information
Arash-codedev committed Aug 28, 2018
1 parent 29c42c1 commit 465a264
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 119 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@


CXX:=g++
#CXX:=x86_64-w64-mingw32-g++
DEBUG_FLAG:= -g -O3
RELESE_FLAG:= -O3 -s -DNDEBUG
CURRENT_FLAGS:= $(RELESE_FLAG)
CURRENT_FLAGS += -std=c++11 -pthread -I./src -Wall -Wconversion -Wfatal-errors -Wextra
BIN=./bin

LIBS:= -lboost_system -lboost_thread -lboost_chrono
LIBS:= #-lboost_system -lboost_thread -lboost_chrono
G_LIBS:= -lGL -lGLU -lglut -lGLEW -lSDL -lSDL2main -lSDL2

all:
Expand Down
2 changes: 1 addition & 1 deletion examples/iga-colors/iga-colors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void calculate_IGA_total_fitness(GA_Type::thisGenerationType &g)
{


for(uint i=0;i<g.chromosomes.size();i++)
for(unsigned int i=0;i<g.chromosomes.size();i++)
{
GA_Type::thisChromosomeType &X=g.chromosomes[i];
// X.total_cost=100.0-X.middle_costs.cost_user_score;
Expand Down
8 changes: 4 additions & 4 deletions examples/mo-1/example_mo1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ std::vector<double> distribution_objective_reductions(const std::vector<double>
void MO_report_generation(
int generation_number,
const EA::GenerationType<MyGenes,MyMiddleCost> &last_generation,
const std::vector<uint>& pareto_front)
const std::vector<unsigned int>& pareto_front)
{
(void) last_generation;

std::cout<<"Generation ["<<generation_number<<"], ";
std::cout<<"Pareto-Front {";
for(uint i=0;i<pareto_front.size();i++)
for(unsigned int i=0;i<pareto_front.size();i++)
{
std::cout<<(i>0?",":"");
std::cout<<pareto_front[i];
Expand All @@ -125,8 +125,8 @@ void save_results(const GA_Type &ga_obj)
std::ofstream output_file;
output_file.open("./bin/result_mo1.txt");
output_file<<"N"<<"\t"<<"x"<<"\t"<<"y"<<"\t"<<"cost1"<<"\t"<<"cost2"<<"\n";
std::vector<uint> paretofront_indices=ga_obj.last_generation.fronts[0];
for(uint i:paretofront_indices)
std::vector<unsigned int> paretofront_indices=ga_obj.last_generation.fronts[0];
for(unsigned int i:paretofront_indices)
{
const auto &X=ga_obj.last_generation.chromosomes[i];
output_file
Expand Down
8 changes: 4 additions & 4 deletions examples/mo-dtlz2/mo-dtlz2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ std::vector<double> distribution_objective_reductions(const std::vector<double>
void MO_report_generation(
int generation_number,
const EA::GenerationType<MyGenes,MyMiddleCost> &last_generation,
const std::vector<uint>& pareto_front)
const std::vector<unsigned int>& pareto_front)
{
(void) last_generation;

std::cout<<"Generation ["<<generation_number<<"], ";
std::cout<<"Pareto-Front {";
for(uint i=0;i<pareto_front.size();i++)
for(unsigned int i=0;i<pareto_front.size();i++)
{
std::cout<<(i>0?",":"");
std::cout<<pareto_front[i];
Expand All @@ -122,8 +122,8 @@ void save_results(const GA_Type &ga_obj)
std::ofstream output_file;
output_file.open("./bin/result_mo2.txt");
output_file<<"N"<<"\t"<<"x"<<"\t"<<"y"<<"\t"<<"cost1"<<"\t"<<"cost2"<<"\n";
std::vector<uint> paretofront_indices=ga_obj.last_generation.fronts[0];
for(uint i:paretofront_indices)
std::vector<unsigned int> paretofront_indices=ga_obj.last_generation.fronts[0];
for(unsigned int i:paretofront_indices)
{
const auto &X=ga_obj.last_generation.chromosomes[i];
output_file
Expand Down
Loading

0 comments on commit 465a264

Please sign in to comment.