A fuzzy logic C++ library
|
Visual FIS evaluating. More...
Classes | |
struct | DATA |
A structure needed to keep access to all the data in the mouse callback (only used in try-fis.cpp). More... | |
Functions | |
void | Mouse_CB (int event, int x, int, int, void *param) |
Mouse callback for fuzzy-set windows. | |
void | Mouse_CB_rb_2D (int event, int x, int y, int, void *) |
Mouse callback for rule-base window. | |
void | Mouse_CB_rb_text (int event, int x, int y, int, void *) |
Mouse callback for text rule-base window. | |
void | Process (int x, int idx) |
Process mouse event in given window idx . | |
void | Show () |
int | main (int argc, char *argv[]) |
See file try-fis.cpp. | |
Variables | |
DATA | data |
bool | g_ViewIntermediateMf = false |
Show itermediate output function (composed of the different triggered membership functions) |
Visual FIS evaluating.
This app is to be associated to .fis files
Arguments : a SLIFIS file (.fis) OR "-h". This latter shows some build information.
This is a graphical app so one can evaluate output membership function and output value, given input values using mouse. If FIS has 'n' inputs, then n+2 windows will be opened, one for the output membership function, one showing the complete output set of functions, and one per input.
If loaded rulebase has 2 inputs, then it also shows a table representation of rule base, and user can edit this rulebase using the mouse. The modified FIS can also be saved, if needed.
Editing rule base:
What you can NOT do:
This app also supports a single flag: '-h' When called, it will print out build/version information and quit.
Tech: this app outputs some info on stdout. It is designed to be associated with .fis file using the GUI. On Linux desktops, the system WILL NOT open a terminal (unlike what happens using Windows), so all stdout info is lost. Here, a special trick is achieved to re-run the app inside an gnome-terminal (see beggining of main() code).
This trick is from: http://stackoverflow.com/questions/10668958/opening-a-console-from-app
void Mouse_CB | ( | int | event, |
int | x, | ||
int | y, | ||
int | flags, | ||
void * | param | ||
) |
Mouse callback for fuzzy-set windows.
Mouse CallBack.
Common mouse callback.
References __IN__, __OUT__, GAPI_EVENT_LBUTTONDOWN, GAPI_EVENT_MOUSEMOVE, Process(), and Show().
Referenced by main().
void Mouse_CB_rb_2D | ( | int | event, |
int | x, | ||
int | y, | ||
int | flags, | ||
void * | param | ||
) |
Mouse callback for rule-base window.
References __IN__, __OUT__, slifis::RULE_BASE::AddRule(), slifis::RULE_IDX::AddTerm(), slifis_plot::PLOT_RB_2D::BoxIsSelected(), data, slifis::RULE_BASE::DeleteRule(), DATA::fis, GAPI_EVENT_LBUTTONDOWN, GAPI_EVENT_MOUSEMOVE, slifis_plot::PLOT_RB::GetIndexCoordinates(), slifis::FUZZY_ROOT::GetNbMf(), slifis::RULE_BASE::GetNbRules(), slifis::RULE_IDX::GetOutMfIndex(), slifis::SLIFIS::GetOutputSet(), slifis::RULE_BASE::GetRule(), slifis::SLIFIS::GetRuleBase(), slifis::RULE_BASE::GetRuleIndex(), slifis_plot::PLOT_RB_2D::GetSelected(), DATA::plot_rb, DATA::plot_rbt, slifis_plot::PLOT_RB_2D::SelectBox(), slifis::RULE_IDX::SetOutMfIndex(), Show(), slifis_plot::PLOT_RB_2D::Unselect(), and slifis_plot::PLOT_RB_TEXT::Unselect().
Referenced by main().
void Mouse_CB_rb_text | ( | int | event, |
int | x, | ||
int | y, | ||
int | flags, | ||
void * | param | ||
) |
Mouse callback for text rule-base window.
References __IN__, __OUT__, slifis_plot::POSITION_INFO::_idx_row, slifis_plot::POSITION_INFO::_pos_type, slifis_plot::POSITION_INFO::_rt_input_idx, slifis::RULE_BASE::AddRule(), slifis::RULE_IDX::AddTerm(), data, slifis::RULE_BASE::DeleteRule(), DATA::fis, GAPI_EVENT_LBUTTONDOWN, GAPI_EVENT_MOUSEMOVE, slifis::SLIFIS::GetInputSet(), slifis::FUZZY_ROOT::GetNbMf(), slifis::RULE_BASE::GetNbRules(), slifis::RULE_IDX::GetNbTerms(), slifis::ROOT_RULE::GetOpType(), slifis::RULE_IDX::GetOutMfIndex(), slifis::SLIFIS::GetOutputSet(), slifis_plot::PLOT_RB_TEXT::GetPositionInfo(), slifis::RULE_BASE::GetRule(), slifis::SLIFIS::GetRuleBase(), slifis_plot::PLOT_RB_TEXT::GetSelectionType(), slifis::RULE_IDX::GetTerms(), slifis_plot::NO_SELECTION, slifis::OPR_AND, slifis::OPR_OR, DATA::plot_rb, DATA::plot_rbt, slifis_plot::RBT_POS_INPUT_NAME, slifis_plot::RBT_POS_INPUT_VALUE, slifis_plot::RBT_POS_INVALID, slifis_plot::RBT_POS_NEW_ROW, slifis_plot::RBT_POS_OUTPUT_VALUE, slifis_plot::RBT_POS_ROW, slifis_plot::RBT_POS_RULE_OP, slifis::RULE_IDX::RemoveTermForInput(), slifis_plot::SELECT_NEW_ROW, slifis_plot::SELECT_OUTPUT, slifis_plot::SELECT_ROW, slifis_plot::SELECT_RULE_OP, slifis_plot::SELECT_TERM_INPUT, slifis_plot::SELECT_TERM_VALUE, slifis_plot::PLOT_RB_TEXT::SelectInput(), slifis_plot::PLOT_RB_TEXT::SelectInputValue(), slifis_plot::PLOT_RB_TEXT::SelectNewRule(), slifis_plot::PLOT_RB_TEXT::SelectOutput(), slifis_plot::PLOT_RB_TEXT::SelectRule(), slifis_plot::PLOT_RB_TEXT::SelectRuleOp(), slifis::ROOT_RULE::SetOpType(), slifis::RULE_IDX::SetOutMfIndex(), Show(), slifis_plot::PLOT_RB_2D::Unselect(), slifis_plot::PLOT_RB_TEXT::Unselect(), and slifis::RULE_IDX::UsesInput().
Referenced by main().
void Process | ( | int | x, |
int | idx | ||
) |
Process mouse event in given window idx
.
References __IN__, __OUT__, slifis::FUZZY_ROOT::AddMf(), data, slifis_plot::PLOT_FUZZY::Draw(), slifis_plot::PLOT_FS::DrawValue(), DATA::fis, g_ViewIntermediateMf, slifis_plot::GAPI_BuildColor(), slifis_plot::GAPI_CreateWindow(), slifis_plot::GAPI_DestroyWindow(), slifis_plot::GAPI_ShowImage(), slifis_plot::GAPI_WindowIsOpen(), slifis::SLIFIS::GetOutMfVector(), slifis_plot::PLOT::GetPlotImage(), DATA::in_vals, DATA::NbInputs, DATA::plot_i, slifis::SLIFIS::SetInputValue(), slifis_plot::PLOT_FUZZY::TransformCoordS2R(), and DATA::WndName_IMF.
Referenced by main(), and Mouse_CB().
void Show | ( | ) |
References __IN__, __OUT__, data, slifis_plot::PLOT_RB_2D::Draw(), slifis_plot::PLOT_FUZZY::Draw(), slifis_plot::PLOT_RB_TEXT::Draw(), slifis_plot::PLOT_MF::DrawValue(), DATA::fis, slifis_plot::GAPI_ShowImage(), slifis::SLIFIS::GetInputName(), slifis::SLIFIS::GetNbInputs(), slifis::SLIFIS::GetOutputMf(), slifis_plot::PLOT::GetPlotImage(), DATA::NbInputs, DATA::plot_i, DATA::plot_o, DATA::plot_rb, DATA::plot_rbt, slifis_plot::PLOT_FUZZY::SetCaption(), DATA::WndName_OutMf, DATA::WndName_OutSet, DATA::WndName_RuleBase, and DATA::WndName_RuleBase_2D.
Referenced by main(), Mouse_CB(), Mouse_CB_rb_2D(), and Mouse_CB_rb_text().
int main | ( | int | argc, |
char * | argv[] | ||
) |
See file try-fis.cpp.
References APP_MSG, APP_NAME, APP_REGULAR_END, slifis_plot::PLOT_FS::AssignSet(), slifis::AUTO_EXT_ON, data, DATA::fis, g_ViewIntermediateMf, slifis_plot::GAPI_AssignCallback(), slifis_plot::GAPI_CreateWindow(), slifis_plot::GAPI_MoveWindow(), slifis_plot::GAPI_WaitKey(), slifis::SLIFIS::GetInputName(), slifis::SLIFIS::GetInputSet(), slifis::SLIFIS::GetNbInputs(), slifis::SLIFIS::GetOutputSet(), slifis::SLIFIS::GetRuleBase(), slifis::SLIFIS::GetVersion_String(), DATA::in_vals, Mouse_CB(), Mouse_CB_rb_2D(), Mouse_CB_rb_text(), DATA::NbInputs, DATA::plot_i, DATA::plot_o, DATA::plot_rb, DATA::plot_rbt, slifis::PrintBuildInfo(), slifis::SLIFIS::Read(), REOPEN_STDERR, slifis_plot::PLOT_FUZZY::Resize(), slifis_plot::PLOT_FUZZY::Set_NbDec(), Show(), DATA::WndName_OutMf, DATA::WndName_OutSet, DATA::WndName_RuleBase, DATA::WndName_RuleBase_2D, DATA::WndNames, and slifis::SLIFIS::Write().
Referenced by main(), Mouse_CB_rb_2D(), Mouse_CB_rb_text(), Process(), and Show().
bool g_ViewIntermediateMf = false |