The purpose to optimize the ship structure is to obtain the minimum weight and the maximization of economic benefit. The way is to change the ship size, structure form, whole or partial structure layout under the condition of meeting the requirements of mechanical properties. The whole ship structure optimization model is established. Optimization is carried out by means of the Optimtoolbox in MATLAB, with the total mass of the ship as objective function, the requirements of the specification and the natural frequencies as constraint conditions. With sensitivity analysis,the thickness of bottom plate, deck, keelson, side keelson, superstructure bulkhead, hatch coaming and other components are selected as design variables. The results show that through optimization, better ship lightweight effect is obtained under the premise of guarantee hull structure strength, stiffness and dynamic characteristics. The bulk carrier structure is optimizaed.