/// <summary>
 /// すべての取り得るStateを生成
 /// </summary>
 /// <param name="Length">Multiplexerの長さ</param>
 /// <returns>すべての取り得るState</returns>
 public static State[] AllState( int Length )
 {
     State[] All = new State[( int )Math.Pow( 2, Length )];
     for( int i = 0; i < All.Length; i++ )
     {
         string S = Convert.ToString( i, 2 );
         // 頭に足りない分0を付加
         while( S.Length < Length )
         {
             S = "0" + S;
         }
         All[i] = new BinaryState( S );
     }
     return All;
 }
Exemple #2
0
        // situationに合うものをPopulationから取り、足りないときはCovering
        protected override void Covering( State S, Population P )
        {
            while( this.CList.Count == 0 )
            {
                // situationにあうものをPopulationから探す
                this.CList = P.MatchSituation( S );

                // Actionの種類
                List<char> Actions = new List<char>();
                int NumberOfActions = 0;

                // Multiplexer(2進数)
                if( Configuration.Type == "Binary" )
                {
                    Actions.Add( '0' );
                    Actions.Add( '1' );
                    foreach( Classifier C in this.CList )
                    {
                        Actions.Remove( C.A );
                    }
                    NumberOfActions = 2 - Actions.Count;
                }

                // MatchSetにある行動が少ないとき
                if( NumberOfActions < Configuration.Theta_mna )
                {
                    // 一部を変化させたCondition
                    State state = new BinaryState( S );
                    state.Covering();

                    Classifier CC;
                    if( Configuration.ASName == "CS" || Configuration.ASName == "MaxCS" || Configuration.ASName == "Max" || Configuration.ASName == "Updatee0CS" )
                    {
                        CC = new SigmaNormalClassifier( state, Actions, Configuration.ExpThreshold );
                    }
                    else
                    {
                        CC = new NormalClassifier( state, Actions );
                    }
                    P.Add( CC );
                    // 整理
                    P.Delete();
                    this.CList = new List<Classifier>();
                }
            }
        }