Skip to content

Mixed-Integer Linear Programming (MILP) with CPLEX solver to optimize server fleet management.

Notifications You must be signed in to change notification settings

savka777/Server-Fleet-Optimization

Repository files navigation

Server Fleet Optimization

Problem Overview

This repository contains code for solving a server fleet management optimization problem. The challenge involves managing a fleet of servers across multiple datacenters over a set number of time steps. The goal is to maximize overall performance, which includes:

  • Fulfilling demand
  • Extending the lifespan of servers
  • Maximizing profit
  • Minimizing costs (energy consumption, server maintenance, and server movement between datacenters)

Key Problem Aspects

  1. Demand Fulfillment: Servers must meet the demand for different types of latency-sensitive services.
  2. Lifecycle Management: Servers have a finite lifespan, and decisions must be made about when to purchase, move, or dismiss servers.
  3. Cost Minimization: Costs include server purchases, energy consumption, maintenance, and server movement between datacenters.
  4. Profit Maximization: Revenue is generated by fulfilling demand, and profit is calculated as revenue minus costs.

Current Approach: MILP with CPLEX Solver

The current approach uses Mixed-Integer Linear Programming (MILP) to model and solve the problem, leveraging the CPLEX solver to find optimal or near-optimal solutions.

Key Components

Decision Variables

  • Buy: Number of new servers to buy
  • Move: Number of servers to move between datacenters
  • Dismiss: Number of servers to dismiss from the fleet
  • Server Count: The number of servers of each generation at each datacenter
  • Demand Met: The amount of demand met for each server generation, datacenter, and latency sensitivity level

Objective Function

The objective is to maximize a weighted combination of:

  • Demand Met: How well the fleet meets the service demand
  • Server Age: Encouraging the use of older servers where feasible to minimize waste
  • Profit: Revenue from meeting demand minus the costs of operating the servers

The weights of these objectives can be tuned to prioritize different aspects of the problem (e.g., higher profit, longer server lifespan).

Constraints

  • Data Center Capacity: Ensuring that the total number of servers at a datacenter does not exceed its capacity
  • Demand Fulfillment: Ensuring that the servers deployed are capable of meeting the demand for various service types
  • Server Count Dynamics: Accounting for changes in the fleet size due to buying, moving, or dismissing servers
  • Lifecycle Management: Ensuring that servers are dismissed when they exceed their expected lifespan
  • Purchase Window: Restricting server purchases to specific time windows based on their release schedule
  • Utilization: Ensuring that the fleet can meet demand without over-provisioning
  • Maintenance Costs: A non-linear function is used to calculate the maintenance costs for servers as they age

Solver

We use CPLEX as the optimization solver for solving the MILP model. CPLEX is well-suited for large-scale optimization problems and can handle the complexity of this fleet management task efficiently.

How to Run the Project

  1. Install Dependencies: Ensure that you have the required Python packages installed:

    pip install -r requirements.txt
  2. Solver Setup: This project uses the CPLEX solver by default. However, if you don't have access to CPLEX, you can use the open-source CBC CMD solver as an alternative.

    CPLEX Installation:

    • Download the IBM ILOG CPLEX Optimization Studio from IBM's website.
    • Follow the installation instructions provided by IBM for your operating system.
    • After installation, ensure that the CPLEX Python API is properly set up. You may need to add the CPLEX Python package to your Python environment.

    Using CBC CMD Solver (Alternative):

    If you don't have access to CPLEX, you can easily use the CBC CMD solver:

    1. Install PuLP, which includes the CBC solver:

      pip install pulp
    2. Modify the solver in the code: Replace the CPLEX solver initialization with:

      from pulp import PULP_CBC_CMD
      solver = pulp.PULP_CBC_CMD(msg=1, gapRel=0.10,  threads=4)
  3. Run the Optimization: To run the multi-time step optimization:

    python MILP_CPLEX_v2.py
  4. Review Results: The results will be saved as JSON files for each random seed used in the simulation. You can review these files to analyze the fleet performance over the entire time horizon.

Conclusion

This repository demonstrates the power of MILP, coupled with CPLEX, for solving complex optimization problems in server fleet management. By carefully balancing multiple objectives—demand fulfillment, server lifespan, and profit—this approach provides a solution to a challenging problem. However, the problem space is still open to further experimentation with different solvers and optimization techniques.

Feel free to contribute to this repository by suggesting improvements, exploring alternative optimization approaches, or tuning the current model to achieve better performance.