Optimization of Foam Filled Structures Using Gradient Algorithms