| 103 | } |
| 104 | |
| 105 | void initialize_solution(Sol& solution, Prob& problem, Alg& algorithm, Workspace* workspace) |
| 106 | { |
| 107 | int nphases = problem.nphases; |
| 108 | int nparam; |
| 109 | int i; |
| 110 | |
| 111 | solution.states = new MatrixXd[nphases]; |
| 112 | solution.controls = new MatrixXd[nphases]; |
| 113 | solution.nodes = new MatrixXd[nphases]; |
| 114 | solution.integrand_cost= new MatrixXd[nphases]; |
| 115 | solution.parameters = new MatrixXd[nphases]; |
| 116 | solution.relative_errors = new MatrixXd[nphases]; |
| 117 | |
| 118 | solution.dual.costates = new MatrixXd[nphases]; |
| 119 | solution.dual.path = new MatrixXd[nphases]; |
| 120 | solution.dual.events = new MatrixXd[nphases]; |
| 121 | solution.dual.Hamiltonian = new MatrixXd[nphases]; |
| 122 | solution.dual.linkages = new MatrixXd; |
| 123 | solution.endpoint_cost = new double[nphases]; |
| 124 | solution.integrated_cost = new double[nphases]; |
| 125 | solution.problem = &problem; |
| 126 | |
| 127 | |
| 128 | for (i=0;i<nphases; i++) |
| 129 | { |
| 130 | nparam = problem.phase[i].nparameters; |
| 131 | solution.parameters[i].resize(nparam,1); |
| 132 | } |
| 133 | |
| 134 | solution.error_flag = 0; |
| 135 | solution.error_msg = ""; |
| 136 | |
| 137 | solution.mesh_stats = new MeshStats[ get_number_of_mesh_refinement_iterations(problem,algorithm)]; |
| 138 | for (i=0;i<get_number_of_mesh_refinement_iterations(problem,algorithm) ; i++) |
| 139 | { |
| 140 | solution.mesh_stats[i].n_con_evals = 0; |
| 141 | solution.mesh_stats[i].n_obj_evals = 0; |
| 142 | solution.mesh_stats[i].n_ode_rhs_evals = 0; |
| 143 | solution.mesh_stats[i].n_jacobian_evals = 0; |
| 144 | solution.mesh_stats[i].n_hessian_evals = 0; |
| 145 | } |
| 146 | |
| 147 | return; |
| 148 | } |
| 149 | |
| 150 | void resize_solution(Sol& solution, Prob& problem, Alg& algorithm) |
| 151 | { |
no test coverage detected