Backpack problem Matlab solution