Optimising Microgrid Energy Management: A MILP Approach for Cost Reduction and Grid Resilience | Synapse