def optimize(model, cand):
    """optimize: function for solving the model, updating candidate solutions' list
    Will add to cand all the intermediate solutions found, as well as the optimum
    Parameters:
        - model: Gurobi model object
        - cand: list of pairs of objective functions (for appending more solutions)
    Returns the solver's exit status
    """
    model.hideOutput()
    model.optimize()
    x, y, C, T = model.data
    status = model.getStatus()
    if status == "optimal":
        # collect suboptimal solutions
        solutions = model.getSols()
        for sol in solutions:
            cand.append((model.getSolVal(T, sol), model.getSolVal(C)))
    return status