コード例 #1
0
ocp.scale(m='x', rad=1)

guess_maker = beluga.guess_generator(
    'ones',
    start=[1.0],  # Starting values for states in order
    costate_guess=0.1,
    control_guess=[0.35],
    use_control_guess=True)

continuation_steps = beluga.init_continuation()

continuation_steps.add_step('bisection') \
                .num_cases(10, 'log') \
                .const('eps1', 2e-1)

beluga.add_logger(file_level=logging.DEBUG, display_level=logging.INFO)

bvp_solver = beluga.bvp_algorithm('spbvp')

beluga.solve(ocp=ocp,
             method='indirect',
             optim_options={
                 'control_method': 'differential',
                 'analytical_jacobian': True
             },
             bvp_algorithm=bvp_solver,
             steps=continuation_steps,
             guess_generator=guess_maker,
             autoscale=False,
             save_sols='indirect_data.beluga')
コード例 #2
0
ファイル: zermelo.py プロジェクト: jsdelivrbot/beluga
                                  derivative_method='fd',
                                  tolerance=1e-4)

guess_maker = beluga.guess_generator('auto',
                                     start=[0, 0],
                                     control_guess=[0],
                                     use_control_guess=True,
                                     direction='forward')

continuation_steps = beluga.init_continuation()

continuation_steps.add_step('bisection') \
                .num_cases(10) \
                .const('x_f', 10)

continuation_steps.add_step('bisection') \
                .num_cases(10) \
                .const('y_f', 10)

continuation_steps.add_step('bisection') \
                .num_cases(10) \
                .const('epsilon', 1)

beluga.add_logger(logging_level=logging.DEBUG)

sol = beluga.solve(ocp,
                   method='icrm',
                   bvp_algorithm=bvp_solver,
                   steps=continuation_steps,
                   guess_generator=guess_maker)
コード例 #3
0
                                     start=[0, 0],
                                     costate_guess=-0.1,
                                     time_integrate=1.1,
                                     control_guess=[0],
                                     use_control_guess=True)

continuation_steps = beluga.init_continuation()

continuation_steps.add_step('bisection') \
                .num_cases(6) \
                .const('x_f', 1) \
                .const('y_f', 0) \
                .const('s_f', 1.1)

continuation_steps.add_step('bisection') \
                .num_cases(6) \
                .const('x_f', 1) \
                .const('y_f', 0) \
                .const('s_f', 3)

beluga.add_logger(display_level=logging.INFO)

sol_set = beluga.solve(ocp=ocp,
                       method='traditional',
                       bvp_algorithm=bvp_solver,
                       steps=continuation_steps,
                       guess_generator=guess_maker,
                       autoscale=True,
                       initial_helper=True,
                       save_sols='chain.beluga')
コード例 #4
0
bvp_solver_shooting = beluga.bvp_algorithm('Shooting', algorithm='Armijo')
bvp_solver_collocation = beluga.bvp_algorithm('spbvp')

guess_maker = beluga.guess_generator('auto',
                                     start=[1, 0, 0, 1, 1],
                                     direction='forward',
                                     costate_guess=-0.1)

continuation_steps = beluga.init_continuation()

continuation_steps.add_step('bisection') \
                .num_cases(11) \
                .const('v_r_f', 0) \
                .const('t_f', 4)

beluga.add_logger(logging_level=logging.DEBUG, display_level=logging.DEBUG)

sol_set_collocation = beluga.solve(ocp=ocp,
                                   method='indirect',
                                   bvp_algorithm=bvp_solver_collocation,
                                   steps=continuation_steps,
                                   guess_generator=guess_maker,
                                   save='highthrust_collocation_data.blg')

sol_set_shooting = beluga.solve(ocp=ocp,
                                method='indirect',
                                bvp_algorithm=bvp_solver_shooting,
                                steps=continuation_steps,
                                guess_generator=guess_maker,
                                save='highthrust_shooting_data.blg')