[f'fD_dynamics'], lambda x: torch.mean(F.relu(x - dxudmax)), weight=args.Q_con_fdu, name='dist_influence_ub') constraints += [ disturbances_max_influence_lb, disturbances_max_influence_ub ] ########################################## ########## OPTIMIZE SOLUTION ############ ########################################## model = Problem(objectives, constraints, components).to(device) optimizer = torch.optim.AdamW(model.parameters(), lr=args.lr) visualizer = VisualizerOpen(dataset, dynamics_model, args.verbosity, args.savedir, training_visuals=args.train_visuals, trace_movie=args.trace_movie) # simulator = OpenLoopSimulator(model=model, dataset=dataset, eval_sim=not args.skip_eval_sim) simulator = MHOpenLoopSimulator(model=model, dataset=dataset, eval_sim=not args.skip_eval_sim) trainer = Trainer(model, dataset, optimizer, logger=logger, visualizer=visualizer, simulator=simulator, epochs=args.epochs, eval_metric=args.eval_metric, patience=args.patience,
simulator = OpenLoopSimulator(model=model, dataset=dataset, eval_sim=not args.skip_eval_sim) optimizer = torch.optim.AdamW(model.parameters(), lr=args.lr) trainer = Trainer( model, dataset, optimizer, logger=logger, simulator=simulator, epochs=args.epochs, eval_metric=args.eval_metric, patience=args.patience, warmup=args.warmup, ) best_model = trainer.train() best_outputs = trainer.evaluate(best_model) visualizer = VisualizerOpen( dataset, dynamics_model, args.verbosity, args.savedir, training_visuals=args.train_visuals, trace_movie=args.trace_movie, ) plots = visualizer.eval(best_outputs) logger.log_artifacts(plots) logger.clean_up()