def cost_derivative(prob, obj):
    jac = Condition(prob.number_of_variables)
    index_m0 = prob.index_states(4, 0, 0)
    index_mf = prob.index_states(4, 0, -1)
    m = prob.states_all_section(4)
    # jac.change_value(index_m0, - m[-1] / m[0]**2)
    # jac.change_value(index_mf, - 1.0 / m[0])
    jac.change_value(index_mf, -1.0)
    return jac()
def cost_derivative(prob, obj):
    jac = Condition(prob.number_of_variables)
    index_R_end = prob.index_states(0, 0, -1)
    jac.change_value(index_R_end, -1)
    return jac()
Exemplo n.º 3
0
def cost_derivative(prob, obj):
    jac = Condition(prob.number_of_variables)
    # index_tf = prob.index_time_final(0)
    index_tf = prob.index_time_final(-1)
    jac.change_value(index_tf, 1)
    return jac()