def next_sol(sol, m_objs, H):
    """
    Create a new solution (sol) by incrementing the value of
        
        sol[m_objs-2] += 1
    
    and adjusting the last position of sol
        
        sol[m_objs-1] = H - sum(new_sol)
        
    The resulting solution (new_sol) can be invalid.
    
    Input
    sol         list, solution with m_objs integers
    m_objs      int, number of objectives
    H           int, granularity >= 2
    
    Output
    new_sol     list, a (possibly) valid solution
    """
    new_sol = [0] * m_objs
    for i in range(m_objs - 1):
        new_sol[i] = sol[i]
    new_sol[m_objs - 2] += 1
    new_sol[m_objs - 1] = H - sum(new_sol)
    return new_sol
