Linear programming selection of internal financial laws and a knapsack problem