static bool _initialize_sml(Context *ctx) { sml_set_stabilization_hits(ctx->sml, 0); sml_set_read_state_callback(ctx->sml, _read_state_cb, ctx); if (ctx->sml_engine == ANN_ENGINE) sml_ann_set_initial_required_observations(ctx->sml, REQUIRED_OBS); ctx->offense1 = _create_input(ctx, "red_striker"); ctx->defense1 = _create_input(ctx, "red_goalkeeper"); ctx->offense2 = _create_input(ctx, "yellow_striker"); ctx->defense2 = _create_input(ctx, "yellow_goalkeeper"); //number of the winner team ctx->winner = sml_new_output(ctx->sml, "winner"); sml_variable_set_range(ctx->sml, ctx->winner, 0, 2); if (ctx->sml_engine == FUZZY_ENGINE) { sml_fuzzy_variable_add_term_ramp(ctx->sml, ctx->winner, "none", 0 + DISCRETE_THRESHOLD, 0, 1); sml_fuzzy_variable_add_term_triangle(ctx->sml, ctx->winner, "red_winner", WINNER1 - DISCRETE_THRESHOLD, WINNER1, WINNER1 + DISCRETE_THRESHOLD, 1); sml_fuzzy_variable_add_term_ramp(ctx->sml, ctx->winner, "yellow_winner", WINNER2 - DISCRETE_THRESHOLD, WINNER2, 1); } return true; }
static bool _initialize_sml(Context *ctx) { sml_set_stabilization_hits(ctx->sml, 0); sml_set_read_state_callback(ctx->sml, _read_state_cb, ctx); if (ctx->sml_engine == ANN_ENGINE) sml_ann_set_initial_required_observations(ctx->sml, REQUIRED_OBS); ctx->offense1 = _create_input(ctx, "red_striker"); ctx->defense1 = _create_input(ctx, "red_goalkeeper"); ctx->offense2 = _create_input(ctx, "yellow_striker"); ctx->defense2 = _create_input(ctx, "yellow_goalkeeper"); //number of the winner team ctx->winner = sml_new_output(ctx->sml, "winner"); sml_variable_set_range(ctx->sml, ctx->winner, 0, 2); sml_fuzzy_variable_set_default_term_width(ctx->sml, ctx->winner, 1); sml_fuzzy_variable_set_is_id(ctx->sml, ctx->winner, true); return true; }