# user_friendly > Solve the user-friendly V2G problem --- ## Description user_friendly solves the user-friendly optimization problem under a given scenario using either a centralized or distributed algorithm. ## Syntax ```matlab [cost,u,result_option] = user_friendly(scenario,algorithm_type) [cost,u,result_option] = user_friendly(scenario,algorithm_type,Name=Value) ``` ## Input Arguments | Name | Type | Description | |------|------|--------------| | `scenario` | *Scenario object* | Scenario object that specifies the optimization problem | | `algorithm_type` | *"cent" \| "dist"* | Type of algorithm, either "cent" for centralized or "dist" for distributed algorithm | ## Name-Value Arguments | Name | Type | Description | |------|------|--------------| | `rho` | *5000 (default) \| nonnegative scalar* | Penalty parameter | | `Uf_iteration` | *40 (default) \| positive integer* | Number of iterations for the distributed algorithm (Only for "dist") | | `Uf_K` | *30 (default) \| positive integer* | Number of fractional iterations for the distributed algorithm (Only for "dist") | | `Uf_c` | *0.1 (default) \| positive scalar* | Parameter for the distributed algorithm (Only for "dist") | | `Uf_theta` | *0 (default) \| scalar* | Parameter for the distributed algorithm (Only for "dist") | | `quiet` | *false (default) \| logical* | On/off solver messages | ## Output Arguments | Name | Type | Description | |------|------|--------------| | `cost` | *scalar* | Optimal cost of the solution | | `u` | *T×N_c matrix* | Optimal charging/discharging schedule | | `result_option` | *struct* | Specification of the options used for solver |