The growing importance of Microgrid in future power systems highlights critical challenges like microgrid control and stability. An islanded microgrid including distributed generations (DG), energy storage systems (ESS), and different types of loads (static or dynamic) is prone to instability. The whole microgrid system must be analyzed and designed to operate within stable regions. This study models an inverter-interfaced microgrid which supplies different types of loads such as static loads and symmetrical induction machines (SIM) by virtual synchronous generators (VSG). Afterwards, a generalized small-signal stability analysis framework is proposed for an islanded microgrid. This model is applied for stability analysis of an arbitrary islanded microgrid including several VSGs, lines, static loads, and SIM loads. Subsequently, permissible intervals for VSG parameters are drawn according to the microgrid small-signal stability analysis. These permissible intervals are compared for static and SIM load. Finally, a novel optimization platform is introduced which utilizes the particle swarm optimization (PSO) algorithm to draw optimal values for virtual impedances (VI), virtual inertia (Jv), virtual damping (D), and current state-feedback factor (F). The proposed optimization platform enhances the microgrid stability, minimizes voltage drops on the buses, the reactive power mismatches, and the frequency Nadir, simultaneously.