Skip to content

Planning and running out of items

toncho11 edited this page Jun 14, 2019 · 4 revisions

It is normal to run out of items for a certain category. This usually happens while planning. Planning is the act of sampling from the main distribution in advance and creating a list of actions to execute. The method 'AdjustProbVariablesDuringPlanning' is executed during planning and allows the bot designer to compensate or rather adjust for that. An example is given below:

public bool AdjustProbVariablesDuringPlanning()
        {
            bool regenerate = false;

            //1. About bot
            //exclude this action because there are no items for it
            if (ProbVariables.Bot.PrSharePureFactInfoAboutBot[(int)PV.Current].Value != 0 && KorraModelHelper.GetItemsLeftForCategory(ActionsEnum.SharePureFactInfoAboutBot) == 0)
            {
                //adjust pure facts probabilities: disable AboutBot and boost AboutUser 

                ProbVariables.Bot.PrSharePureFactInfoAboutBot[(int)PV.Current] = Prob(0);
                SharedHelper.LogWarning("Disabled all pure facts about bot, because there were no items.");

                //we re-inforce AboutUser so that it is stronger than Suggestion action
                if (ProbVariables.Bot.PrAskPureFactQuestionAboutUser[(int)PV.Current].Value > 0) 
                    ProbVariables.Bot.PrAskPureFactQuestionAboutUser[(int)PV.Current] = ProbVariables.Bot.PrAskPureFactQuestionAboutUser[(int)PV.Increased]; 

                regenerate = true;
            }
        }
Clone this wiki locally