Selection of materials considering function and cost