float Individual::getPenaltyVehicles() {

    float penalty = 0.0;

    // Relax penalty when split is relaxed
    if (!this->isRelaxSplit()) {

        int validRoutes = getNumVehicles();

        if (validRoutes > this->getProblem()->getVehicles())
            penalty = this->getConfig()->getExtraVehiclesPenalty() * (validRoutes - this->getProblem()->getVehicles());
    }

    return penalty;

}
Exemplo n.º 2
0
/**
 * Returns the amount of space in use by
 * soldiers and vehicles.
 * @return Space used.
 */
int Craft::getSpaceUsed() const
{
	return getNumSoldiers() + getNumVehicles() * 4;
}