function calculateCostMatrix(slots, values, costFunction) {
    var costs = [];
    for (var i = 0; i < slots.length; i++) {
        var row = [];
        for (var j = 0; j < values.length; j++) {
            var cost = costFunction(slots[i], values[j]);
            row.push(cost);
        }
        costs.push(row);
    }
    return costs;
}
// the cost function for each combination of elements from the two arrays
the cost function for each combination of elements from the two arrays
the cost function for each combination of elements from the two arrays
function calculateCostMatrix(slots, values, costFunction) {
    var costs = [];
    for (var i = 0; i < slots.length; i++) {
        var row = [];
        for (var j = 0; j < values.length; j++) {
            var cost = costFunction(slots[i], values[j]);
            row.push(cost);
        }
        costs.push(row);
    }
    return costs;
}
function calculateCostMatrix ( slots , values , costFunction ) { var costs = [ ] ; for ( var i = 0 ; i < slots . length ; i ++ ) { var row = [ ] ; for ( var j = 0 ; j < values . length ; j ++ ) { var cost = costFunction ( slots [ i ] , values [ j ] ) ; row . push ( cost ) ; } costs . push ( row ) ; } return costs ; }
the cost function for each combination of elements from the two arrays
the cost function for each combination of elements from the two arrays