// v and y are both variables
        public IConstraints1ConstraintElement Create(
            ImIndexElement mIndexElement,
            IrIndexElement rIndexElement,
            Im m,
            Is s,
            Iζ ζ,
            Iv v,
            Iy y)
        {
            IConstraints1ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints1ConstraintElement(
                    mIndexElement,
                    rIndexElement,
                    m,
                    s,
                    ζ,
                    v,
                    y);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
Example #2
0
 public void vuelenTodos()
 {
     foreach (Ivolador Iv in voladores)
     {
         Iv.volar();
     }
 }
        public IObjectiveFunction100 Create(
            IObjectiveFactory objectiveFactory,
            Imr mr,
            IC C,
            Iv v)
        {
            IObjectiveFunction100 objectiveFunction = null;

            try
            {
                objectiveFunction = new ObjectiveFunction100(
                    objectiveFactory,
                    mr,
                    C,
                    v);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(objectiveFunction);
        }
Example #4
0
 /// <summary>
 /// The to string.
 /// </summary>
 /// <returns>
 /// The <see cref="string"/>.
 /// </returns>
 public override string ToString()
 {
     return(string.Format(
                "Symmetric key: {0}\nValue: {1}\nSenderHash: {2}\nIv: {3}",
                SymmetricKey,
                Command,
                SenderHash,
                Iv.AsString()));
 }
Example #5
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Algorithm?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (Key != null ? Key.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Iv != null ? Iv.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)Mode;
         hashCode = (hashCode * 397) ^ KeyLength;
         return(hashCode);
     }
 }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Iv.Length != 0)
            {
                hash ^= Iv.GetHashCode();
            }
            if (CipherText.Length != 0)
            {
                hash ^= CipherText.GetHashCode();
            }
            return(hash);
        }
Example #7
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)

                hashCode = hashCode * 59 + Direction.GetHashCode();

                hashCode = hashCode * 59 + TickDirection.GetHashCode();
                if (Timestamp != null)
                {
                    hashCode = hashCode * 59 + Timestamp.GetHashCode();
                }
                if (Price != null)
                {
                    hashCode = hashCode * 59 + Price.GetHashCode();
                }
                if (TradeSeq != null)
                {
                    hashCode = hashCode * 59 + TradeSeq.GetHashCode();
                }
                if (TradeId != null)
                {
                    hashCode = hashCode * 59 + TradeId.GetHashCode();
                }
                if (Iv != null)
                {
                    hashCode = hashCode * 59 + Iv.GetHashCode();
                }
                if (IndexPrice != null)
                {
                    hashCode = hashCode * 59 + IndexPrice.GetHashCode();
                }
                if (Amount != null)
                {
                    hashCode = hashCode * 59 + Amount.GetHashCode();
                }
                if (InstrumentName != null)
                {
                    hashCode = hashCode * 59 + InstrumentName.GetHashCode();
                }
                return(hashCode);
            }
        }
Example #8
0
        /// <summary>
        /// 実数値から努力値を逆算する
        /// </summary>
        /// <param name="level"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public ParameterData <int> CalcEv(int level, ParameterData <int> value)
        {
            var result = new ParameterData <int>();

            result.Hp = StatusCalculator.CalcHitPointEv(Bv.Hp, Iv.Hp, value.Hp, level);

            // HP以外の計算式は同じなのでループで計算する
            foreach (var i in Enumerable.Range(1, 5))
            {
                var bv     = Bv.GetByIndex(i);          // 種族値
                var iv     = Iv.GetByIndex(i);          // 個体値
                var p      = value.GetByIndex(i);
                var person = Personality.GetByIndex(i); // 性格補正
                var param  = StatusCalculator.CalcEv(bv, iv, p, person, level);
                result.SetByIndex(i, param);
            }
            return(result);
        }
Example #9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Iv.Length != 0)
            {
                hash ^= Iv.GetHashCode();
            }
            if (CipherText.Length != 0)
            {
                hash ^= CipherText.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Example #10
0
        public Iv Create(
            ImmutableList <IvResultElement> value)
        {
            Iv result = null;

            try
            {
                result = new v(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(result);
        }
Example #11
0
        public Iv Create(
            ImmutableList <IvParameterElement> value)
        {
            Iv parameter = null;

            try
            {
                parameter = new v(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(parameter);
        }
Example #12
0
        public Iv Create(
            VariableCollection <ImIndexElement, IrIndexElement> value)
        {
            Iv variable = null;

            try
            {
                variable = new v(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(variable);
        }
Example #13
0
        public ObjectiveFunction100(
            IObjectiveFactory objectiveFactory,
            Imr mr,
            IC C,
            Iv v)
        {
            Expression expression = Expression.Sum(
                mr.Value
                .Select(
                    x => (double)C.GetElementAtAsdecimal(
                        x.mIndexElement)
                    *
                    v.Value[x.mIndexElement, x.rIndexElement]));

            Objective objective = objectiveFactory.Create(
                expression,
                ObjectiveSense.Minimize);

            this.Value = objective;
        }
        public Constraints1ConstraintElement(
            ImIndexElement mIndexElement,
            IrIndexElement rIndexElement,
            Im m,
            Is s,
            Iζ ζ,
            Iv v,
            Iy y)
        {
            Expression LHS = Expression.Sum(
                s.Value
                .Select(
                    x => y.Value[x, rIndexElement]
                    *
                    ζ.GetElementAtAsint(
                        x,
                        mIndexElement)));

            Expression RHS = m.GetM()
                             *
                             v.Value[mIndexElement, rIndexElement];

            this.Value = LHS <= RHS;
        }
Example #15
0
 public void NewIv()
 {
     Contract.Ensures(!Iv.Equals(Contract.OldValue(Iv)));
 }
Example #16
0
        /// <summary>
        /// Returns true if UserTrade instances are equal
        /// </summary>
        /// <param name="other">Instance of UserTrade to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(UserTrade other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Direction == other.Direction ||

                     Direction.Equals(other.Direction)
                     ) &&
                 (
                     FeeCurrency == other.FeeCurrency ||

                     FeeCurrency.Equals(other.FeeCurrency)
                 ) &&
                 (
                     OrderId == other.OrderId ||
                     OrderId != null &&
                     OrderId.Equals(other.OrderId)
                 ) &&
                 (
                     Timestamp == other.Timestamp ||
                     Timestamp != null &&
                     Timestamp.Equals(other.Timestamp)
                 ) &&
                 (
                     Price == other.Price ||
                     Price != null &&
                     Price.Equals(other.Price)
                 ) &&
                 (
                     Iv == other.Iv ||
                     Iv != null &&
                     Iv.Equals(other.Iv)
                 ) &&
                 (
                     TradeId == other.TradeId ||
                     TradeId != null &&
                     TradeId.Equals(other.TradeId)
                 ) &&
                 (
                     Fee == other.Fee ||
                     Fee != null &&
                     Fee.Equals(other.Fee)
                 ) &&
                 (
                     OrderType == other.OrderType ||

                     OrderType.Equals(other.OrderType)
                 ) &&
                 (
                     TradeSeq == other.TradeSeq ||
                     TradeSeq != null &&
                     TradeSeq.Equals(other.TradeSeq)
                 ) &&
                 (
                     SelfTrade == other.SelfTrade ||
                     SelfTrade != null &&
                     SelfTrade.Equals(other.SelfTrade)
                 ) &&
                 (
                     State == other.State ||

                     State.Equals(other.State)
                 ) &&
                 (
                     Label == other.Label ||
                     Label != null &&
                     Label.Equals(other.Label)
                 ) &&
                 (
                     IndexPrice == other.IndexPrice ||
                     IndexPrice != null &&
                     IndexPrice.Equals(other.IndexPrice)
                 ) &&
                 (
                     Amount == other.Amount ||
                     Amount != null &&
                     Amount.Equals(other.Amount)
                 ) &&
                 (
                     InstrumentName == other.InstrumentName ||
                     InstrumentName != null &&
                     InstrumentName.Equals(other.InstrumentName)
                 ) &&
                 (
                     TickDirection == other.TickDirection ||

                     TickDirection.Equals(other.TickDirection)
                 ) &&
                 (
                     MatchingId == other.MatchingId ||
                     MatchingId != null &&
                     MatchingId.Equals(other.MatchingId)
                 ) &&
                 (
                     Liquidity == other.Liquidity ||

                     Liquidity.Equals(other.Liquidity)
                 ));
        }
Example #17
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)

                hashCode = hashCode * 59 + Direction.GetHashCode();

                hashCode = hashCode * 59 + FeeCurrency.GetHashCode();
                if (OrderId != null)
                {
                    hashCode = hashCode * 59 + OrderId.GetHashCode();
                }
                if (Timestamp != null)
                {
                    hashCode = hashCode * 59 + Timestamp.GetHashCode();
                }
                if (Price != null)
                {
                    hashCode = hashCode * 59 + Price.GetHashCode();
                }
                if (Iv != null)
                {
                    hashCode = hashCode * 59 + Iv.GetHashCode();
                }
                if (TradeId != null)
                {
                    hashCode = hashCode * 59 + TradeId.GetHashCode();
                }
                if (Fee != null)
                {
                    hashCode = hashCode * 59 + Fee.GetHashCode();
                }

                hashCode = hashCode * 59 + OrderType.GetHashCode();
                if (TradeSeq != null)
                {
                    hashCode = hashCode * 59 + TradeSeq.GetHashCode();
                }
                if (SelfTrade != null)
                {
                    hashCode = hashCode * 59 + SelfTrade.GetHashCode();
                }

                hashCode = hashCode * 59 + State.GetHashCode();
                if (Label != null)
                {
                    hashCode = hashCode * 59 + Label.GetHashCode();
                }
                if (IndexPrice != null)
                {
                    hashCode = hashCode * 59 + IndexPrice.GetHashCode();
                }
                if (Amount != null)
                {
                    hashCode = hashCode * 59 + Amount.GetHashCode();
                }
                if (InstrumentName != null)
                {
                    hashCode = hashCode * 59 + InstrumentName.GetHashCode();
                }

                hashCode = hashCode * 59 + TickDirection.GetHashCode();
                if (MatchingId != null)
                {
                    hashCode = hashCode * 59 + MatchingId.GetHashCode();
                }

                hashCode = hashCode * 59 + Liquidity.GetHashCode();
                return(hashCode);
            }
        }
Example #18
0
 /// <summary>
 /// 個体値を設定する
 /// ex "4-252-0-0-0-0"
 /// </summary>
 /// <param name="str"></param>
 public void SetIv(string str)
 {
     Iv.Set(str);
 }
Example #19
0
 /// <summary>
 /// 個体値を設定する
 /// </summary>
 /// <param name="data"></param>
 public void SetIv(ParameterData <int> data)
 {
     Iv.CopyFrom(ref data);
 }
Example #20
0
        /// <summary>
        /// Returns true if PublicTrade instances are equal
        /// </summary>
        /// <param name="other">Instance of PublicTrade to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PublicTrade other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Direction == other.Direction ||

                     Direction.Equals(other.Direction)
                     ) &&
                 (
                     TickDirection == other.TickDirection ||

                     TickDirection.Equals(other.TickDirection)
                 ) &&
                 (
                     Timestamp == other.Timestamp ||
                     Timestamp != null &&
                     Timestamp.Equals(other.Timestamp)
                 ) &&
                 (
                     Price == other.Price ||
                     Price != null &&
                     Price.Equals(other.Price)
                 ) &&
                 (
                     TradeSeq == other.TradeSeq ||
                     TradeSeq != null &&
                     TradeSeq.Equals(other.TradeSeq)
                 ) &&
                 (
                     TradeId == other.TradeId ||
                     TradeId != null &&
                     TradeId.Equals(other.TradeId)
                 ) &&
                 (
                     Iv == other.Iv ||
                     Iv != null &&
                     Iv.Equals(other.Iv)
                 ) &&
                 (
                     IndexPrice == other.IndexPrice ||
                     IndexPrice != null &&
                     IndexPrice.Equals(other.IndexPrice)
                 ) &&
                 (
                     Amount == other.Amount ||
                     Amount != null &&
                     Amount.Equals(other.Amount)
                 ) &&
                 (
                     InstrumentName == other.InstrumentName ||
                     InstrumentName != null &&
                     InstrumentName.Equals(other.InstrumentName)
                 ));
        }