예제 #1
0
        void channel_NewOfferEvent(object sender, OfferEventArgs e)
        {
            JavaScriptSerializer js = new JavaScriptSerializer();
            string offer            = js.Serialize(e.Offer);

            SideConfig side;

            if (((INegotiationChannel)sender) == AiChannel)
            {
                side = AiConfig;
                Status.AiStatus.Offer = e.Offer;
            }
            else
            {
                side = HumanConfig;
                Status.HumanStatus.Offer = e.Offer;
            }

            this.Actions.Add(new NegotiationActionModel()
            {
                Role          = side.Side,
                Type          = NegotiationActionType.MakeOffer,
                Value         = offer,
                RemainingTime = Status.RemainingTime
            });

            NegotiationManager.SaveNewOffer(this, side, offer);

            ThreadPool.QueueUserWorkItem(x =>
            {
                GetOtherChannel((INegotiationChannel)sender).OpponentOfferReceived(e.Offer);
            });
        }
예제 #2
0
 protected override void OnOfferReceivedEvent(object sender, Negotiation.Models.OfferEventArgs e)
 {
     if (e.Offer.Equals(BestOffer))
     {
         AcceptOffer();
     }
 }
예제 #3
0
        protected override void OnOfferReceivedEvent(object sender, Negotiation.Models.OfferEventArgs e)
        {
            OpponentOffer = e.Offer;

            if (CurrentOffer == null)
            {
                return;
            }

            CompareOffer(e.Offer);
        }
예제 #4
0
        protected override void OnOfferReceivedEvent(object sender, Negotiation.Models.OfferEventArgs e)
        {
            var opponentTypes = Domain.OwnerVariantDict[OpponentSide].Keys;

            var opponentOfferP = opponentTypes.Sum(x => m_offerProbabilities[e.Offer][x] * m_typeProbabilites[x]);

            var newTypeProbabilites = opponentTypes.ToDictionary(
                x => x,
                x => m_offerProbabilities[e.Offer][x] * m_typeProbabilites[x] / opponentOfferP);

            GuessOpponentType(newTypeProbabilites.ArgMax(x => x.Value).Key);

            m_typeProbabilites = newTypeProbabilites;

            base.OnOfferReceivedEvent(sender, e);
        }
예제 #5
0
        protected override void OnOfferReceivedEvent(object sender, Negotiation.Models.OfferEventArgs e)
        {
            foreach (string variant in Domain.OwnerVariantDict[OpponentSide].Keys)
            {
                m_typeUtilities[variant] += AllOptions[e.Offer].UtilityDataDict[variant].OpponentUtility;
            }

            String opponentType = m_typeUtilities.ArgMax(x => x.Value).Key;

            BestFScoreUtilityOffers = new Dictionary <string, OfferUtility> {
                { opponentType, m_BestFScoreUtilityOffers[opponentType] }
            };
            BestCombinedUtilityOffers = new Dictionary <string, OfferUtility> {
                { opponentType, m_BestCombinedUtilityOffers[opponentType] }
            };

            base.OnOfferReceivedEvent(sender, e);
        }