lq/pltlib.py
def relative_inf_cost(self, j, tot_samples, alg, xlab, uplim=6, zoomplt = True):
        '''
        Relative Infinite average cost error for for N_fix iterations for different trajectory length over MC stable samples
        :param j: Infinite average cost
        :param tot_samples:
        :param alg: Algorithm names
        :return:
        '''
        fig, ax = plt.subplots()
        for alg_i in range(len(alg)):
            ax.plot(tot_samples, np.median((j[alg_i]-self._j_inf_opt)/self._j_inf_opt, axis=0),
                    linestyle=self._linestyle[alg_i+1],
                    marker=self._marker[alg_i+1], color=self._colors[alg_i+1],
                    linewidth=self._linewidth, markersize=self._markersize[alg_i+1],
                    label=alg[alg_i])
            ax.fill_between(tot_samples, np.percentile((j[alg_i]-self._j_inf_opt)/self._j_inf_opt,25,axis=0),
                            np.percentile((j[alg_i]-self._j_inf_opt)/self._j_inf_opt,75,axis=0), alpha=0.25)

        ax.axis([tot_samples[0], tot_samples[-1], 0, uplim])

        ax.set_xlabel(xlab, fontsize=self._label_fontsize)
        ax.set_ylabel('Relative average cost error', fontsize=self._label_fontsize)
        # plt.legend(fontsize=self._legend_fontsize, loc='upper left',bbox_to_anchor=(0.4, 0.5))
        plt.legend(fontsize=self._legend_fontsize, loc='upper left')
        plt.xticks(fontsize=self._tick_fontsize)
        plt.yticks(fontsize=self._tick_fontsize)
        plt.grid(True)

        fig.set_size_inches(9, 6)
        plt.show()

        if(zoomplt):
            axins = inset_axes(ax, 2,1, loc=7)
            for alg_i in range(len(alg)):
                axins.plot(tot_samples, np.median((j[alg_i]-self._j_inf_opt)/self._j_inf_opt, axis=0),
                           linestyle=self._linestyle[alg_i+1],
                           marker=self._marker[alg_i+1], color=self._colors[alg_i+1],
                           linewidth=self._linewidth, markersize=self._markersize[alg_i+1],
                           label=alg[alg_i])
                axins.fill_between(tot_samples, np.percentile((j[alg_i]-self._j_inf_opt)/self._j_inf_opt,25,axis=0),
                                   np.percentile((j[alg_i]-self._j_inf_opt)/self._j_inf_opt,75,axis=0), alpha=0.25)

            axins.set_xlim(3900, 5000)  # apply the x-limits
            axins.set_ylim(-0.05, 0.55)  # apply the y-limits
            mark_inset(ax, axins, loc1=1, loc2=3, fc="none", ec="0.5")

        Relative Infinite average cost error for for N_fix iterations for different trajectory length over MC stable samples
        :param j: Infinite average cost
        :param tot_samples:
        :param alg: Algorithm names
        :return:
        
Relative Infinite average cost error for for N_fix iterations for different trajectory length over MC stable samples
Relative Infinite average cost error for for N_fix iterations for different trajectory length over MC stable samples
def relative_inf_cost(self, j, tot_samples, alg, xlab, uplim=6, zoomplt = True):
        fig, ax = plt.subplots()
        for alg_i in range(len(alg)):
            ax.plot(tot_samples, np.median((j[alg_i]-self._j_inf_opt)/self._j_inf_opt, axis=0),
                    linestyle=self._linestyle[alg_i+1],
                    marker=self._marker[alg_i+1], color=self._colors[alg_i+1],
                    linewidth=self._linewidth, markersize=self._markersize[alg_i+1],
                    label=alg[alg_i])
            ax.fill_between(tot_samples, np.percentile((j[alg_i]-self._j_inf_opt)/self._j_inf_opt,25,axis=0),
                            np.percentile((j[alg_i]-self._j_inf_opt)/self._j_inf_opt,75,axis=0), alpha=0.25)
        ax.axis([tot_samples[0], tot_samples[-1], 0, uplim])
        ax.set_xlabel(xlab, fontsize=self._label_fontsize)
        ax.set_ylabel('Relative average cost error', fontsize=self._label_fontsize)
        plt.legend(fontsize=self._legend_fontsize, loc='upper left')
        plt.xticks(fontsize=self._tick_fontsize)
        plt.yticks(fontsize=self._tick_fontsize)
        plt.grid(True)
        fig.set_size_inches(9, 6)
        plt.show()
        if(zoomplt):
            axins = inset_axes(ax, 2,1, loc=7)
            for alg_i in range(len(alg)):
                axins.plot(tot_samples, np.median((j[alg_i]-self._j_inf_opt)/self._j_inf_opt, axis=0),
                           linestyle=self._linestyle[alg_i+1],
                           marker=self._marker[alg_i+1], color=self._colors[alg_i+1],
                           linewidth=self._linewidth, markersize=self._markersize[alg_i+1],
                           label=alg[alg_i])
                axins.fill_between(tot_samples, np.percentile((j[alg_i]-self._j_inf_opt)/self._j_inf_opt,25,axis=0),
                                   np.percentile((j[alg_i]-self._j_inf_opt)/self._j_inf_opt,75,axis=0), alpha=0.25)
            axins.set_xlim(3900, 5000)  
            axins.set_ylim(-0.05, 0.55)  
            mark_inset(ax, axins, loc1=1, loc2=3, fc="none", ec="0.5")
def relative_inf_cost ( self , j , tot_samples , alg , xlab , uplim = 6 , zoomplt = True ) : fig , ax = plt . subplots ( ) for alg_i in range ( len ( alg ) ) : ax . plot ( tot_samples , np . median ( ( j [ alg_i ] - self . _j_inf_opt ) / self . _j_inf_opt , axis = 0 ) , linestyle = self . _linestyle [ alg_i + 1 ] , marker = self . _marker [ alg_i + 1 ] , color = self . _colors [ alg_i + 1 ] , linewidth = self . _linewidth , markersize = self . _markersize [ alg_i + 1 ] , label = alg [ alg_i ] ) ax . fill_between ( tot_samples , np . percentile ( ( j [ alg_i ] - self . _j_inf_opt ) / self . _j_inf_opt , 25 , axis = 0 ) , np . percentile ( ( j [ alg_i ] - self . _j_inf_opt ) / self . _j_inf_opt , 75 , axis = 0 ) , alpha = 0.25 ) ax . axis ( [ tot_samples [ 0 ] , tot_samples [ - 1 ] , 0 , uplim ] ) ax . set_xlabel ( xlab , fontsize = self . _label_fontsize ) ax . set_ylabel ( 'Relative average cost error' , fontsize = self . _label_fontsize ) plt . legend ( fontsize = self . _legend_fontsize , loc = 'upper left' ) plt . xticks ( fontsize = self . _tick_fontsize ) plt . yticks ( fontsize = self . _tick_fontsize ) plt . grid ( True ) fig . set_size_inches ( 9 , 6 ) plt . show ( ) if ( zoomplt ) : axins = inset_axes ( ax , 2 , 1 , loc = 7 ) for alg_i in range ( len ( alg ) ) : axins . plot ( tot_samples , np . median ( ( j [ alg_i ] - self . _j_inf_opt ) / self . _j_inf_opt , axis = 0 ) , linestyle = self . _linestyle [ alg_i + 1 ] , marker = self . _marker [ alg_i + 1 ] , color = self . _colors [ alg_i + 1 ] , linewidth = self . _linewidth , markersize = self . _markersize [ alg_i + 1 ] , label = alg [ alg_i ] ) axins . fill_between ( tot_samples , np . percentile ( ( j [ alg_i ] - self . _j_inf_opt ) / self . _j_inf_opt , 25 , axis = 0 ) , np . percentile ( ( j [ alg_i ] - self . _j_inf_opt ) / self . _j_inf_opt , 75 , axis = 0 ) , alpha = 0.25 ) axins . set_xlim ( 3900 , 5000 ) axins . set_ylim ( - 0.05 , 0.55 ) mark_inset ( ax , axins , loc1 = 1 , loc2 = 3 , fc = "none" , ec = "0.5" )
Relative Infinite average cost error for for N_fix iterations for different trajectory length over MC stable samples
Relative Infinite average cost error for for N_fix iterations for different trajectory length over MC stable samples
'''
        Relative Infinite average cost error for for N_fix iterations for different trajectory length over MC stable samples
        :param j: Infinite average cost
        :param tot_samples:
        :param alg: Algorithm names
        :return:
        ''' # plt.legend(fontsize=self._legend_fontsize, loc='upper left',bbox_to_anchor=(0.4, 0.5)) # apply the x-limits # apply the y-limits
None
self
j
Infinite average cost
Infinite average cost
tot_samples
None
alg
None
xlab
uplim
zoomplt