コード例 #1
0
        public static void MakeReady(Fuzzifier fuzzifier)
        {
            fuzzifier.m_MembershipFunctions.Clear();

            string line;

            char[]   separator = { ' ', '\t', '\n' };
            string[] tokens;
            string[] s = MemberFunctionGrapper.GetFunctions();
            for (int i = 0; i < s.Length; i++)
            {
                line = s[i].Trim();
                if (line.Length > 0 && line[0] != ';')
                {
                    tokens = line.Split(separator);
                    MfInterface memberFunc = new MembershipFunction(tokens[0], tokens[1], double.Parse(tokens[2]), double.Parse(tokens[3]), double.Parse(tokens[4]));

                    if (tokens.Length > 5 && tokens[5].Equals("*"))
                    {
                        memberFunc.Lock(true);
                    }

                    fuzzifier.AddMembershipFunction(memberFunc);
                }
            }
        }
コード例 #2
0
        public static void LoadMemberFunctions(Fuzzifier fuzzifier, string file)
        {
            try
            {
                if (File.Exists(file))
                {
                    fuzzifier.m_MembershipFunctions.Clear();

                    StreamReader reader = new StreamReader(file);
                    string       line;
                    char[]       separator = { ' ', '\t', '\n' };
                    string[]     tokens;
                    while ((line = reader.ReadLine()) != null)
                    {
                        line = line.Trim();
                        if (line.Length > 0 && line[0] != ';')
                        {
                            tokens = line.Split(separator);
                            MfInterface memberFunc = new MembershipFunction(tokens[0], tokens[1], double.Parse(tokens[2]), double.Parse(tokens[3]), double.Parse(tokens[4]));

                            if (tokens.Length > 5 && tokens[5].Equals("*"))
                            {
                                memberFunc.Lock(true);
                            }

                            fuzzifier.AddMembershipFunction(memberFunc);
                        }
                    }
                    reader.Close();
                }
            }
            catch (Exception e)
            {
                LogWriter.Write(e.ToString());
            }
        }
コード例 #3
0
ファイル: Fuzzifier.cs プロジェクト: prezz/Fuzzy-Gammon
        public static void MakeReady( Fuzzifier fuzzifier )
        {
            fuzzifier.m_MembershipFunctions.Clear();

            string line;
            char[] separator = {' ', '\t', '\n'};
            string[] tokens;
            string[] s = MemberFunctionGrapper.GetFunctions();
            for ( int i = 0; i < s.Length; i++ )
            {
                line = s[i].Trim();
                if ( line.Length > 0 && line[0] != ';' )
                {
                    tokens = line.Split( separator );
                    MfInterface memberFunc = new MembershipFunction( tokens[0], tokens[1], double.Parse( tokens[2] ), double.Parse( tokens[3]), double.Parse( tokens[4] ) );

                    if ( tokens.Length > 5 && tokens[5].Equals("*") )
                        memberFunc.Lock( true );

                    fuzzifier.AddMembershipFunction( memberFunc );
                }
            }
        }
コード例 #4
0
ファイル: Fuzzifier.cs プロジェクト: prezz/Fuzzy-Gammon
        public static void LoadMemberFunctions( Fuzzifier fuzzifier, string file )
        {
            try
            {
                if ( File.Exists( file ) )
                {
                    fuzzifier.m_MembershipFunctions.Clear();

                    StreamReader reader = new StreamReader( file );
                    string line;
                    char[] separator = {' ', '\t', '\n'};
                    string[] tokens;
                    while ( ( line = reader.ReadLine() ) != null )
                    {
                        line = line.Trim();
                        if ( line.Length > 0 && line[0] != ';' )
                        {
                            tokens = line.Split( separator );
                            MfInterface memberFunc = new MembershipFunction( tokens[0], tokens[1], double.Parse( tokens[2] ), double.Parse( tokens[3]), double.Parse( tokens[4] ) );

                            if ( tokens.Length > 5 && tokens[5].Equals("*") )
                                memberFunc.Lock( true );

                            fuzzifier.AddMembershipFunction( memberFunc );
                        }
                    }
                    reader.Close();
                }
            }
            catch ( Exception e )
            {
                LogWriter.Write( e.ToString() );
            }
        }