Ejemplo n.º 1
0
 // keeps track of the differences between all sequencial pairs of cards in the straightflush bin
 public HandEvaluator()
 {
     binMap = new Hand[9];
     binFull = new bool[9];
     bins = new Bins();
     // map all the bins to their coresponding rank as index in the ArrayList
     binMap[1] = bins.PairBin;
     binMap[2] = (bins.TwoPairBin);
     binMap[3] = (bins.ThreeKindBin);
     binMap[4] = (bins.StraightBin);
     binMap[6] = (bins.FullHouseBin);
     binMap[7] = (bins.FourKindBin);
     for (int i = 0; i < binFull.Length; i++)
         binFull[i] = false;
 }
Ejemplo n.º 2
0
 public TsvFeature[] Split(int[][] assignment)
 {
     return(Bins.Split(assignment)
            .Select(bins => new TsvFeature(bins, _valueMap, _name)).ToArray());
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Writes a binary representation of this class to a byte buffer, at a given position.
 /// The position is incremented to the end of the representation
 /// </summary>
 /// <param name="buffer">a byte array where the binary represenaion is written</param>
 /// <param name="position">the position in the byte array</param>
 public virtual void ToByteArray(byte[] buffer, ref int position)
 {
     ((int)Type).ToByteArray(buffer, ref position);
     Bins.ToByteArray(buffer, ref position);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Clone a TSVFeature containing only the items indexed by <paramref name="itemIndices"/>
 /// </summary>
 /// <param name="itemIndices"> item indices will be contained in the cloned TSVFeature  </param>
 /// <returns> The cloned TSVFeature </returns>
 public TsvFeature Clone(int[] itemIndices)
 {
     return(new TsvFeature(Bins.Clone(itemIndices), _valueMap, _name));
 }
Ejemplo n.º 5
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Bins obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Ejemplo n.º 6
0
        //l0

        public void UpdateBestSolution(IOutputUtilities OutputUtilities, string itemAllocationMethod,
                                       string pricingRule, string priceUpdatingRule)
        {
            Zstar = z;
            Bins  = TemporaryBins;

            //Utilities.IsSolutionCorrect(items, bins, iter);

            if (OutputUtilities.IsNewBestWidthFound(Bins[i]))
            {
                //aggiungo la sequenza di un certa iterazione
                Sequence s = new Sequence()
                {
                    Zstar          = Zstar,
                    Bins           = new List <Bin>(),
                    IteratioNumber = Iter,
                    Criterias      = new List <string>
                    {
                        itemAllocationMethod,
                        pricingRule,
                        priceUpdatingRule
                    },
                    WidthCovered            = OutputUtilities.GetBestWidthFound(),
                    UsedAreaAbsoluteValue   = OutputUtilities.ComputeUsedAreaAbsoluteValue(Bins[i].NestedItems),
                    UsedAreaPercentageValue = OutputUtilities.ComputeUsedAreaPercentageValue(Bins[i].Height, Bins[i].Width)
                };

                //per mettere in sequence solo i bin che hanno elementi e non quelli dove nestedItems = null
                s.Bins = Bins.Where(x => x.NestedItems != null).ToList();

                Sequences.RemoveAt(0);
                Sequences.Insert(0, s);
            }

            if (OutputUtilities.IsNewBestAreaFound(Bins[i]))
            {
                //aggiungo la sequenza di un certa iterazione
                Sequence s = new Sequence()
                {
                    Zstar          = Zstar,
                    Bins           = new List <Bin>(),
                    IteratioNumber = Iter,
                    Criterias      = new List <string>
                    {
                        itemAllocationMethod,
                        pricingRule,
                        priceUpdatingRule
                    },
                    WidthCovered            = OutputUtilities.ComputeWidthLastBin(Bins[i].NestedItems),
                    AreaCovered             = OutputUtilities.GetBestAreaFound(),
                    UsedAreaAbsoluteValue   = OutputUtilities.ComputeUsedAreaAbsoluteValue(Bins[i].NestedItems),
                    UsedAreaPercentageValue = OutputUtilities.ComputeUsedAreaPercentageValue(Bins[i].Height, Bins[i].Width)
                };

                //per mettere in sequence solo i bin che hanno elementi e non quelli dove nestedItems = null
                s.Bins = Bins.Where(x => x.NestedItems != null).ToList();

                Sequences.RemoveAt(1);
                Sequences.Insert(1, s);
            }
        }