# uf_subproblem > Solve the sub-optimization problem in distributed algorithm for user friendly problem --- ## Description uf_subproblem solves the sub-optimization problem assigned for each charger during the distributed algorithm for user friendly problem. This function is only for the function user_friendly. ## Syntax ```matlab [xi,optval] = uf_subproblem(T,l,x,d,P_max,P_min,A,b,empty_ind,G,h,cs,pc1,pc2,pc3,bs,c,rho) ``` ## Input Arguments | Name | Type | Description | |------|------|--------------| | `T` | *positive integer* | Number of time slots comprising a scenario | | `l` | *(2T)×1 vector* | Variable for building the cost function | | `x` | *(3T)×1 vector* | Variable for building the cost function | | `d` | *(2T)×1 vector* | Variable for building the cost function | | `P_max` | *nonnegative scalar* | Maximum aggregate charging power | | `P_min` | *nonpositive scalar* | Minimum aggregate charging power | | `A` | *T×T matrix* | Local constraint matrix | | `b` | *T×1 vector* | Local constraint matrix | | `empty_ind` | *T×1 vector* | Index for empty time slot (for one charger) | | `G` | *matrix* | Penalty matrix | | `h` | *vector* | Penalty matrix | | `cs` | *1×T vector* | Vector for calculating (cost saving) cost function | | `pc1` | *1×T vector* | Vector for calculating (priority charging) cost function | | `pc2` | *T×1 vector* | Vector for calculating (priority charging) cost function | | `pc3` | *T×T matrix* | Matrix for calculating (priority charging) cost function | | `bs` | *1×T vector* | vector for calculating (battery saving) cost function | | `c` | *positive scalar* | Parameter for optimization algorithm | | `rho` | *nonnegative scalar* | Penalty parameter | ## Output Arguments | Name | Type | Description | |------|------|--------------| | `xi` | *(3T)×1 vector* | Optimal solution of the subproblem | | `optval` | *scalar* | Optimal value |