/** * The main routine for parsing the decision variable inputs, evaluating the * problem and printing the objectives. */ int main(int argc, char* argv[]) { if (argc <= 1) { nobjs = 2; nvars = 11; } else if (argc == 2) { nobjs = atoi(argv[1]); nvars = nobjs + 9; } else if (argc >= 3) { nobjs = atoi(argv[2]); nvars = atoi(argv[1]); } double vars[nvars]; double objs[nobjs]; #ifdef USE_SOCKET MOEA_Init_socket(nobjs, 0, NULL); #else MOEA_Init(nobjs, 0); #endif while (MOEA_Next_solution() == MOEA_SUCCESS) { MOEA_Read_doubles(nvars, vars); evaluate(vars, objs); MOEA_Write(objs, NULL); } MOEA_Terminate(); return EXIT_SUCCESS; }
void MOEA_Error_callback_default(const MOEA_Status status) { MOEA_Debug("%s\n", MOEA_Status_message(status)); MOEA_Terminate(); exit(EXIT_FAILURE); }