This package contains the source files to perform an optimization for the study "The Effects of Motor Modularity on Performance, Learning, and Generalizability in Upper-Extremity Reaching: a Computational Analysis" by Al Borno, Hicks and Delp. The code was developed on a Unix environment with OpenSim 3.3. I included a CMakeLists.txt file as an example, but the user should follow the instructions on how to compile example C++ code from the OpenSim website (e.g., https://simtk-confluence.stanford.edu/display/OpenSim33/API+Examples), and use the CMakeLists.txt from there. The main file is ArmController.cpp. When performing an optimization, the user must specify in the main file the following: perform a full-dimensional or synergy-based optimization (see function compare_low_full), the initial coordinates of the arm (initial_coords), the target hand position unless a random target is chosen (end_eff_target), and the duration of the optimization (estimate_optimization_time in TrajOpt.cpp). In general, the duration should increase for targets that are "further away". However, increasing the duration makes the optimization slower and more prone to fall in local minima. The default duration is set to 0.5 s. The parameters maxIter and lambda determine the number of iterations and the population size in the Covariance Matrix Adaptation optimization. Our default parameters (600 and 60, respectively) takes about 6 hours when running our code in parallel with 20 threads. The cost function is specified in the file OptSystem.cpp (function: evaluate_cost_function). Our code uses the model "ue_rigid.osim" from the study "Benchmarking of dynamic simulation predictions in two software platforms using an upper limb musculoskeletal model". When the optmization is done, it produces a file "ue_full_bestSoFar_states.sto". The movement can be visualized and analyzed in the OpenSim 3.3 GUI.