Пример #1
0
        public static NeuralNetwork<Matrix> Create(IDataSet<Matrix, Vector> dataSet)
        {
            var count  = 5;

            var a = new ISingleLayer<Matrix, Matrix>[count];
            for (var i = 0; i < count; ++i)
                a[i] = new MatrixConvolutor(28, 28, 24, 24, new Tanh());

            var b = new ISingleLayer<Matrix, Matrix>[count];
            for (var i = 0; i < count; ++i)
                b[i] = new MatrixSubsampler(24, 24, 12, 12, new Tanh());

            var c = new ISingleLayer<Matrix, Matrix>[count];
            for (var i = 0; i < count; ++i)
                c[i] = new MatrixConvolutor(12, 12, 8, 8, new Tanh());

            var d = new ISingleLayer<Matrix, Matrix>[count];
            for (var i = 0; i < count; ++i)
                d[i] = new MatrixSubsampler(8, 8, 4, 4, new Tanh());

            var splitter    = new Splitter<Matrix, Matrix>(a);
            var applicator1 = new Applicator<Matrix, Matrix>(b);
            var applicator2 = new Applicator<Matrix, Matrix>(c);
            var merger      = new MatrixMerger<Matrix>(d);

            var classif  = new FullyConnectedLayer(16 * count, 10, new Tanh());

            var comp = CompositeLayer<Vector, Vector[], Vector>.Compose(splitter,
                                                                        applicator1,
                                                                        applicator2,
                                                                        merger,
                                                                        classif);

            return new NeuralNetwork<Matrix>(comp);
        }
Пример #2
0
        public ApplicatorViewModel(Applicator applicator)
        {
            Applicator = applicator;
            IsBack     = true;

            CreateTankCommand = new Command(CreateApplicatorTank);
            DeleteTankCommand = new Command(DeleteApplicatorTank);
            SaveTankCommand   = new Command(SaveApplicatorTank);
            BackCommand       = new Command(Back);
        }
Пример #3
0
 public Trap(string creator, Frame fr, Applicator app, Gear g, Trigger tr)
 {
     itemName   = "Trap";
     frame      = fr;
     applicator = app;
     gear       = g;
     trigger    = tr;
     setInventoryTextureName("Trap");
     creatorId = creator;
 }
Пример #4
0
 public Turret(string creator, Frame fr, Applicator app, Gear g, EnergySource es)
 {
     itemName      = "Turret";
     itemStackType = ItemStackType.Turret;
     frame         = fr;
     applicator    = app;
     gear          = g;
     energySource  = es;
     setInventoryTextureName("Turret");        //"Units/Turrets/TurretPlaceholder");
     creatorId = creator;
 }
Пример #5
0
 public ObservableCollection <ApplicatorTank> GetApplicatorTanks(Applicator applicator)
 {
     if (applicator == null)
     {
         return(null);
     }
     else
     {
         using (AppDbContext db = App.GetContext())
         {
             var applicatorTanksDB = db.ApplicatorTanks.Where(at => at.ApplicatorId == applicator.ApplicatorId);
             return(new ObservableCollection <ApplicatorTank>(applicatorTanksDB.ToList()));
         }
     }
 }
Пример #6
0
    public Trap(string itemData, string delim) : base(itemData, delim)
    {
        string[] split     = itemData.Split(delim.ToCharArray());
        int      curr      = numSplit;
        ItemCode frameCode = (ItemCode)int.Parse(split[curr++]);

        if (frameCode != ItemCode.None)
        {
            frame = (Frame)Item.deserializeItem(frameCode, split[curr++], otherDelimiter);
        }
        applicator = (Applicator)Item.deserializeItem((ItemCode)int.Parse(split[curr++]), split[curr++], otherDelimiter);
        gear       = (Gear)Item.deserializeItem((ItemCode)int.Parse(split[curr++]), split[curr++], otherDelimiter);
        trigger    = (Trigger)Item.deserializeItem((ItemCode)int.Parse(split[curr++]), split[curr++], otherDelimiter);
        if (curr < split.Length)
        {
            creatorId = split[curr++];
        }
    }
Пример #7
0
        public static NeuralNetwork<Matrix> CreateNorb(IDataSet<Matrix, Vector> dataSet)
        {
            var count  = 12;
            var branch = 5;

            var a = new ISingleLayer<Matrix, Matrix>[count];
            for (var i = 0; i < count; ++i)
                a[i] = new MatrixConvolutor(96, 96, 92, 92, new Tanh());

            var b = new ISingleLayer<Matrix, Matrix>[count];
            for (var i = 0; i < count; ++i)
                b[i] = new MatrixSubsampler(92, 92, 46, 46, new Tanh());

            var c = new ISingleLayer<Matrix, Matrix>[count];
            for (var i = 0; i < count; ++i)
                c[i] = new MatrixSubsampler(46, 46, 23, 23, new Tanh());

            var splitter    = new Splitter<Matrix, Matrix>(a);
            var applicator1 = new Applicator<Matrix, Matrix>(b);
            var merger      = new MatrixMerger<Matrix>(c);

            var classif  = new FullyConnectedLayer(23 * 23 * count, 5, new Tanh());

            var comp = CompositeLayer<Vector, Vector[], Vector>.Compose(splitter,
                                                                        applicator1,
                                                                        merger,
                                                                        classif
                                                                       );

            return new NeuralNetwork<Matrix>(comp);
        }
Пример #8
0
 public TennisRule(string category, Applicator applier)
     : base(category)
 {
     apllicator = applier;
 }
Пример #9
0
        public static float[,] AddHeat(this float[,] array, Vector2Int position, Heater function, Applicator applicator)
        {
            float[] values = new float[Mathf.Max(array.GetLength(0) - position.x, position.x) + Mathf.Max(array.GetLength(1) - position.y, position.y) + 1];
            for (int i = 0; i < values.Length; i++)
            {
                values[i] = function(i);
            }

            for (int x = 0; x < array.GetLength(0); x++)
            {
                for (int y = 0; y < array.GetLength(1); y++)
                {
                    int distance = Mathf.Abs(position.x - x) + Mathf.Abs(position.y - y);
                    array[x, y] = applicator(array[x, y], values[distance]);
                }
            }

            return(array);
        }
Пример #10
0
 public CurveMenuRule(string category, Applicator applier) : base(category) {
     apllicator = applier;
 }