# Determine Center(s) of Gravity

Center(s) of Gravity can be determined using two scenarios:

## Number of CoGs Scenario

The *Number of CoGs Scenario* calculates one or more centers of gravity for you. These center(s) of gravity are possible locations for your DCs. They are calculated such that the total travel distance to all specified demand/supply locations is minimal.
This scenario can be executed by entering the number of CoGs into *Number of CoGs* widget. This should be an integer between 1 and the total number of locations that you take into account. After specifying this number, click *Solve Number of CoGs* button to execute the calculation.

### Algorithm to determine CoGs in Number of CoG scenario

Imagine that each of your demand/supply locations has a certain force proportional to its load. They each pull on the location of a single center of gravity (CoG). When each location uses its force to pull in its own direction, the CoG ends up in the center of those forces. At that moment, the algorithm has found the location that minimizes the total load travel distance.

To find multiple (N) centers of gravity (CoGs), the algorithm starts with N locations being the CoGs. The app assigns the closest CoG as the serving DC for each demand/supply location. For each DC (=CoG), the algorithm locates the optimal location for each CoG based on the loads of the locations that it serves.

This process is reiterated. The demand/supply locations are reassigned to the closest CoG location, based on new locations calculated for CoGs. Then, according to the loads of new supply/demand assignments, the CsoG are relocated. The process is reiterated until a final balance is found with N centers of gravity and each supply/demand location is served by the closest center of gravity, resulting in a minimal total load travel distance.

## Drive Time Scenario

In this scenario, **Center of Gravity** generates a grid of cities on top of the data area and selects the minimum number of cities that can serve as DC such that all customer locations can be reached within the specified maximum drive time. This means that for each demand/supply location, the drive time to its serving DC (center of gravity) will be at most the maximum drive time you specify.
In the *Maximum Drive Time* widget, you can specify the maximum number of hours (!) that demand/supply is allowed to travel from DC to demand location/supply location. After entering this number, click the *Solve Max Drive Time* button.

## Result Overview

On the *Run Scenario* page the high level scenario data can be accessed. Detailed solution overview available on Scenario Details.

**Drive Time Distribution**
The *Drive Time Distribution* bar chart shows you the distribution of drive times from location to DC. Each bar represents the number of locations with a drive time within a certain time interval.

**Cost Breakdown**
Cost breakdown has two views, and the user is able to switch between them using the widget action menu :

*Cost Breakdown*: In this barchart you can see how the several cost components relate to each other.*Cost Breakdown per CoG*: In this barchart you can see how the several cost components relate to each other for each CoG.

**Results Overview**

Further solution details can be found on the *Results Overview* dialog, which can be opened using the status bar.

Here the following data is listed:

*Primary Cost*- the total transport cost from the suppliers to their distribution center(s) (CoGs).*Secondary Cost*- the total transport cost from the distribution center(s) (CoGs) to their customers.*DC Running Cost*- the cost for running all the DCs. This is a scalar cost value times the number of DCs (Centers of Gravity).*Total Cost*- the sum of all the above cost components.*Average Drive Time*- the average drive time from CoGs to demand/supplier nodes.*Max Drive Time*- the maximum drive time from CoGs to demand/supplier nodes.*# Customer Served*- the total number of locations serviced by the center(s) of gravity.*Volume Served*- the total volume (load) that is serviced.