isoexp/mab/smab_algs.py [595:610]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        constraints = [cp.sum(cp.multiply(temp_1, x)) == 1]
        if alg == 'log_barrier':
            obj = cp.Minimize(cp.sum(cp.multiply(temp_2, x)) - 1/eta*cp.sum(cp.log(x)))
        elif alg == 'inf':
            obj = cp.Minimize(cp.sum(cp.multiply(temp_2, x)) - 2/eta*cp.sum(cp.sqrt(x)))
        else:
            obj = cp.Minimize(cp.sum(cp.multiply(temp_2, x)) + 1/eta*(cp.sum(cp.kl_div(x, temp_1)) - K))
        pb = cp.Problem(obj, constraints)
        try:
            pb.solve()
            P = x.value
        except:
            P = np.ones((K,))/K
        # print('Probability distribution:', P)
        if not np.sum(P) == 1:
            P = P/np.sum(P)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



isoexp/mab/smab_algs.py [636:656]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        constraints = [cp.sum(cp.multiply(temp_1, x)) == 1]
        if alg == 'log_barrier':
            obj = cp.Minimize(cp.sum(cp.multiply(temp_2, x)) - 1/eta*cp.sum(cp.log(x)))
        elif alg == 'inf':
            obj = cp.Minimize(cp.sum(cp.multiply(temp_2, x)) - 2/eta*cp.sum(cp.sqrt(x)))
        else:
            obj = cp.Minimize(cp.sum(cp.multiply(temp_2, x)) + 1/eta*(cp.sum(cp.kl_div(x, temp_1)) - K))
        pb = cp.Problem(obj, constraints)
        try:
            pb.solve()
            P = x.value
        except:
            P = np.ones((K,))/K
        # print("\nThe optimal value is", pb.value)
        # print("A solution x is")
        # print(x.value)
        # print("A dual solution corresponding to the inequality constraints is")
        # print(pb.constraints[0].dual_value)
        # print('Probability distribution:', P)
        if not np.sum(P) == 1:
            P = P/np.sum(P)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



