need debug, add write files in ModelCost.cpp