2020 National Competition Higher Education Cup Mathematical Modeling Problem B Crossing the Desert to Solve the Whole Process Documents and Programs

2020 National Higher Education Cup Mathematical Modeling

Question B Crossing the Desert

Reproduce the original title

  Consider the following small game: With a map, the player uses the initial funds to purchase a certain amount of water and food (including food and other daily necessities), and starts from the starting point to walk in the desert. You will encounter different weather on the way, and you can also replenish funds or resources in mines and villages. The goal is to reach the end within the specified time and retain as much funds as possible.
  The basic rules of the game are as follows:
  (1) Taking days as the basic time unit, the game starts at day 0, and the player is at the starting point. A player must reach the finish line on or before the deadline, after which the player's game ends.
  (2) Two resources, water and food, are needed to cross the desert, and their smallest unit of measurement is a box. The sum of the quality of water and food owned by the player every day cannot exceed the weight limit. If the finish point is not reached and the water or food is exhausted, the game is considered a failure.
  (3) The daily weather is one of the three conditions of "clear", "high temperature" and "sandstorm", and the weather in all areas in the desert is the same.
  (4) Players can go from one area in the map to another adjacent area every day, or stay in place. Sandstorm days must stay put.
  (5) The amount of resources consumed by the player staying in place for one day is called the basic consumption, and the amount of resources consumed by walking for one day is the times of the basic consumption.
  (6) On the 0th day, players can use the initial funds to purchase water and food at the base price at the starting point. Players can stay at the starting point or return to the starting point, but they cannot buy resources at the starting point multiple times. Players can return the remaining water and food after reaching the end point, and the return price of each box is half of the base price.
  (7) When players stay in the mine, they can obtain funds through mining. The amount of funds obtained by mining for one day is called the basic income. If mining, the amount of resources consumed is the times of the base consumption; if not mining, the amount of resources consumed is the base consumption. You cannot mine on the day you arrive at the mine. Mining is also available on sandstorm days.
  (8) Players can use the remaining initial funds or funds obtained from mining to purchase water and food at any time when they pass by or stay in the village, and the price of each box is twice the base price.
  Please build a mathematical model according to the different settings of the game to solve the following problems.
  1. Assuming that there is only one player, and the weather conditions are known in advance every day during the entire game period, try to give the player's optimal strategy under normal circumstances. Solve the "First Level" and "Second Level" in the attachment, and fill the corresponding results into Result.xlsx respectively.
  2. Assume that there is only one player, and the player only knows the weather conditions of the day. Based on this, the player can decide the action plan of the day, try to give the best strategy for the player under normal circumstances, and analyze the "third level" and "first level" in the attachment. Four Passes" for a detailed discussion.
  3. Existing players who have the same initial bankroll and start from the starting point at the same time. If any one of the players walks from area A to area B ( ) on a certain day, the amount of resources consumed by any one of them will be twice the base consumption; mines, the amount of resources consumed by any of them is twice the base consumption, and the funds that each player can obtain through mining in one day are the basic income; if any one of them buys in the same village For resources, the price per box is the multiple of the base price. In other cases, the amount of resources consumed and the price of resources are the same as those in the single-player game.
  (1) Assuming that the weather conditions of each day are known in advance during the entire game period, each player's action plan must be determined on the first day and cannot be changed thereafter. Try to give the strategy that players should adopt under normal circumstances, and discuss the "fifth level" in the appendix in detail.
  (2) Assuming that all players only know the weather conditions of the day, starting from day 1, each player knows the action plans of the other players and the remaining resources of the day after the end of the day's action, and then determines their respective action plans for the next day. Try to give the strategy that players should adopt under normal circumstances, and discuss the "sixth level" in the appendix in detail.

  Note 1: In the map given in the attachment, two areas with a common boundary are called adjacent, and two areas with only common vertices but no common boundary are not considered adjacent.
  Note 2: The amount of remaining funds (remaining water, remaining food) in Result.xlsx refers to the amount of funds (water, food) after all the resources required for the day have been consumed. If there is still a purchase on the day, it refers to the amount of funds (water, food) after the purchase is completed.

Overview of the overall solution process (abstract)

  This article mainly studies how to design different maps and different weather conditions in the game of crossing the desert to reach the end point within the specified time and retain as much money as possible. The principle of the amount of food and water initially purchased in this article is to buy water that can just reach the next village at the starting point, and buy as much food as possible when the load and funds are met. Because the unit price of food is high, the funds for replenishing food in the village can be reduced. And all final proposals have been tested for overload and capital limit.
  For problem 1, for the first level, the objective function is to maximize the remaining funds when reaching the end point, and list each constraint condition, and then use Excel to conduct data and logic analysis, and use the heuristic algorithm on the basis of satisfying the constraint conditions. Computer simulation, the optimal strategy of the player is obtained, the final remaining funds are 10430 yuan, and the walking route is 1→25→24→23 (stay)→22→9 (stay)→15 (supplement)→13→14→13 →15 (replenishment)→9→21→27, the remaining water and food are both 0 boxes. Improve the model of the first level, that is, when replenishing resources from the mine to the village, food and water can be placed in the mine, and continue to be used after the supplementary resources return to the mine, so as to increase the number of mining days. After the improvement, the final The remaining funds are 11,030 yuan. See the appendix for the results such as the walking route.
  For the second level, it is similar to the first level, but the game map is different. Through programming, the final remaining funds are 12,730 yuan, and the walking route is 1→2→3→4 (stay) →5→13 (stay)→22→ 30 (digging for 2 days) → 39 → 47 → 55 (digging for 4 days) → 65 (185 boxes of water, 175 boxes of food) → 55 (8 days of digging) → 63 → 64, the final remaining water is 0 boxes, and food is 0 boxes .
  For the second problem and the third level, by analyzing the walking plan under various combinations of weather conditions, it is found that the final remaining funds can be more without going through the mine, and the shortest path is obtained through the Floyd algorithm, and we get
The walking route is 1 → 5 → 6 → 1 → 3, and the expected value of the final number of remaining resources after walking on this route for different days (3-10 days) is calculated by programming (when calculating the expected value, the initial purchase of materials is carried out according to the theoretical optimal value purchase, but in reality, I don’t know the weather conditions at the beginning, so it is more reasonable to purchase initial materials according to all high-temperature weather at the beginning), and found that according to the two methods to start purchasing materials, walking for 3 days can make the final remaining resources The number is the largest, so the player's optimal strategy is to walk the route 1→5→6→13 and not stay in high temperature or sunny weather.
  For the fourth pass, assume that m sandstorms occur within 30 days. The calculation shows that mining in any weather conditions can gain benefits, so the player's strategy is to adopt the optimal solution of mining through the mine → supply → mining (the number of mining days is the largest), and finally return to the end. Assuming that the number of sandstorm days before the last mining is t (t≤m) days, then the player should reserve (3+mt) days to ensure that they can return to the end.
  For question three, for the fifth level, similar to the analysis of the third level, it can be seen that if no mining can make the player's final remaining funds more than mining. Using the win-win method of negotiation and cooperation, the shortest path principle can determine that the walking route of two players is 1→5→6→13, and the walking route of the other player is 1→4 (stay for one day)→7→12→13. The final remaining funds are 9425 yuan, and the remaining funds of the other player are 9510 yuan; if the player does not negotiate and cooperate, he will adopt a zero-sum game and directly choose the most beneficial strategy for himself. For the sixth level, similar to the analysis of the fourth level, the shortest path from the starting point to the end point is 8 days. Adopt the method of negotiation, cooperation and win-win, distribute the mining time of three people on average, and stay in the meeting and sandstorm weather, the first player: 1→2→3→8→13→18→23→24→25, the second player: 1→6→7→12→13→14→19, the third player: 1→2→3→4→9→10→13; if the players do not cooperate, adopt a zero-sum game and choose the one that is most beneficial to the player Strategy.

Model assumptions:

  1. Assume that there are no other weather conditions in the desert except high temperature, sunshine and sandstorm;
  2. Assume that there will be no other emergencies affecting the player's itinerary in the desert;
  3. Assume that the weather conditions given in the title are accurate;
  4. Assume that there are Enough resources for players to buy.
  5. Assuming the mine has enough ore for the player to dig.

problem analysis:

  Analysis of problem 1
  For problem 1, there is only one player, and the weather conditions of the player are known in advance every day in the game. The title gives the ultimate goal of the game: reach the end on or before the specified deadline, and keep as much money as possible. The game rules given in the question are constraints. By establishing a goal programming model, we can find the optimal strategy for players that satisfy the constraints.
  For the first level of the game, the map contains mines and villages. Comparing the basic income with the consumption of mining in different weather conditions, it is found that mining can obtain income whether it is high temperature, sunny or sandstorm weather, but through the map It can be found that the starting point is very far from the mine, and a lot of money is consumed on the road. At this time, we consider two options, one is not to go to the mine to mine, and go directly to the destination, the other is to go to the mine to mine, and consider whether to go to the village to mine, go to the village to buy supplies first, or go to the village first according to your own material needs. Mine and how many times to buy and so on. Calculate the optimal walking path and the amount of remaining funds under the two types of schemes, and the scheme with the largest amount of remaining funds is the optimal strategy.
  For the second level of the game, the map contains two mines and two villages, and each mine is adjacent to a village. Comparing the basic income with the consumption of mining under different weather conditions, it is found that the income can be obtained no matter it is sunny, high temperature or sandstorm. So we go to the mines and mine. There are the following three types of plans. The first type is mining at No. 55 mine. When the supplies are insufficient, go to the village No. 62 adjacent to it to purchase; the second type of plan is to mine at No. 30. When the supplies are insufficient, go to the adjacent village No. 39 village is supplemented; the third type of plan is to mine in a mine and purchase in a village that is not adjacent to it when the supplies are insufficient. Finally, the walking paths and remaining funds under the three schemes are calculated respectively, and the scheme with the largest remaining funds is finally selected as the optimal strategy.
  Analysis of problem two
  For the third level, the deadline of the game is given as 10 days. During the game time, there will only be two kinds of weather, sunny and high temperature, and there will be no weather such as sandstorm. Players only know the weather conditions of the day. We consider three kinds The first is that the weather conditions of each day are sunny; the second is that the weather conditions of each day are high temperature; the third is the general situation, we can randomly simulate the weather conditions of each day through computer simulation. Consider whether to mine or not under the three weather conditions, and determine the optimal walking path. After the walking path is determined, determine the problem of how many days to stay on this path by calculating the expected value of the remaining funds after walking on this path for different days (3~10 days). Finally, the optimal strategy can be determined.
  For the fourth level, firstly, through the simple calculation of the basic consumption and basic income in the parameter setting table, it can be judged that no matter what kind of weather, mining can obtain income. There are few sandstorms within 30 days. We consider two cases. The first case is a high probability event, that is, there is no sandstorm within 30 days. Since we do not know the daily weather conditions, we can use computer simulation to simulate each day. situation. The optimal strategy can be obtained by using the same method as problem 1. In the second case m sandstorms occur within 30 days. Assuming that t times of sandstorms occurred before the last mining was completed and ready to return to the end point, we reserve (3+mt) days to return to the end point.
  Question 3 Analysis
  There can be n players in the game, with the same initial funds and starting from the starting point at the same time. In addition to the most basic game rules given at the beginning, the game rules for n players are added. When we play an n-player game, the best result is to achieve a win-win situation, that is, the formulated walking strategy should satisfy all n players without disputes.
  For the fifth level, the number of players is 2. On the map, there is a mine and no villages. We can consider three situations, the first is that neither player mines; the second is that one player mines and the other does not mine; the third is that both players mine. Then discuss the remaining funds of the two players when they reach the end in the three cases; if the players cannot negotiate and cooperate, adopt a zero-sum game method. Existence, directly choose the plan that is most beneficial to you.
  For the sixth level, the number of players is 3, and the players only know the situation of the day. If they meet each other, one of them will stop for a day, wait for a day before leaving, and consider the sandstorm weather before mining to determine the number of days before the first person returns. Use the above rules to determine the optimal plan; if the players cannot negotiate and cooperate, they will adopt a zero-sum game method. Since they do not know the walking plan of the other two players, they ignore the existence of the other two players and directly choose the best plan for themselves. The most favorable option.

Model establishment and solution Overall paper thumbnail

insert image description here
insert image description here
insert image description here

For all papers, please see below "Only modeling QQ business cards" Click on the QQ business card

Program code: (code and documentation not free)

%% 本附件由多段代码组合,根据逐步逻辑推理来进行有效搜索,注释段代码需要分别解除
注释运行 
clear;clc;%清空变量 
A1=zeros(27);%第一关地图地区的邻接矩阵 
%相邻地区的数据输入到邻接矩阵 A1 
A1(1,2)=1;A1(1,25)=1; 
A1(2,3)=1; 
A1(3,4)=1;A1(3,25)=1; 
A1(4,5)=1;A1(4,24)=1;A1(4,25)=1; 
A1(5,6)=1;A1(5,24)=1; 
A1(6,7)=1;A1(6,23)=1;A1(6,24)=1; 
A1(7,8)=1;A1(7,22)=1; 
A1(8,9)=1;A1(8,22)=1; 
A1(9,10)=1;A1(9,15)=1;A1(9,16)=1;A1(9,17)=1;A1(9,21)=1;A1(9,22)=1; 
A1(10,11)=1;A1(10,13)=1;A1(10,15)=1; 
A1(11,12)=1;A1(11,13)=1; 
A1(12,13)=1;A1(12,14)=1; 
A1(13,14)=1;A1(13,15)=1; 
A1(14,15)=1;A1(14,16)=1; 
A1(15,16)=1; 
A1(16,17)=1;A1(16,18)=1; 
A1(17,18)=1;A1(17,21)=1; 
A1(18,19)=1;A1(18,20)=1; 
A1(19,20)=1; 
A1(20,21)=1; 
A1(21,22)=1;A1(21,23)=1;A1(21,27)=1; 
A1(22,23)=1; 
A1(23,24)=1;A1(23,26)=1; 
A1(24,25)=1;A1(24,26)=1; 
A1(25,26)=1; 
A1(26,27)=1; 
A1=A1+A1'; 
for i=1:27 
 for j=1:27 
 if A1(i,j)==0 
 A1(i,j)=inf; 
 end 
 end 
end 
for i=1:27 
 A1(i,i)=0; 
end 
Lm=1200;%负重上限 
deadline=30;%截止日期 
initial=10000;%初始资金 
income=1000;%基础收益 
pm=[3,2];%水和食物的每箱质量(千克) 
price=[5,10];%水和食物每箱的基准价格(元) 
P=0;%最后汇总的资金(包括剩余初始资金、挖矿收益、资源换算资金) 
C1=[5,7; 
 8,6; 
 10,10];%第一关的基础消耗,每行表示水和食物基础消耗量,第一列是水,第二列是食
物 
W1=[2;2;1;0;1;2;0;1;2;2; 
 0;2;1;2;2;2;0;0;2;2; 
 1;1;2;1;0;2;1;1;2;2];%第一关各日期的天气状况,0 表示沙暴天气,1 表示高温天
气,2 表示晴朗天气 
%% Floyd 算法求最短路径 
 [dmin,path]=floyd(A1); 
% %输出起点 1 到终点 27 的最短路径 
% i=1;j=27; 
% k=path(i,j); 
% disp(i); 
% while k~=j 
% disp(k); 
% k=path(k,j); 
% end 
% disp(j); 
%% *******最短路径下的策略******** 
% %只有一名玩家,所有天气状况全部已知 
% %由弗洛伊德算法算出从起点 1 到终点 27 的最短路径是 1-25-26-27 
% lu=[25,26,27]; 
% t=0;%天数 
% dot=1;%当前所在地区 
% i=1; 
% j=1;%记录步数 
% water=0;food=0; 
% while dot~=27 %到达终点后结束 
% if W1(i)==0 
% water=water+C1(3,1);%资源箱数 
% food=food+C1(3,2); 
% t=t+1;%天数+1 
% i=i+1; 
% elseif W1(i)==1 
% water=water+2*C1(1,1); 
% food=food+2*C1(1,2); 
% dot=lu(j);j=j+1; 
% t=t+1;%天数+1 
% i=i+1; 
% elseif W1(i)==2 
% water=water+2*C1(2,1); 
% food=food+2*C1(2,2); 
% dot=lu(j);j=j+1; 
% t=t+1;%天数+1 
% i=i+1; 
% end 
% end 
% Swater=water*price(1); 
% Sfood=food*price(2); 
% p1=initial-Swater-Sfood;%最后剩余初始资金 
% Mwater=water*pm(1); 
% Mfood=food*pm(2); 
% m1=Mwater+Mfood;%最少负重 
% s1dexcel 
%% ******去矿山挖矿策略******* 
%只有一名玩家,所有天气状况全部已知
%% 输出起点 1 到村庄 15 的最短路径 
% i=1;j=15; 
% k=path(i,j); 
% disp(i); 
% while k~=j 
% disp(k); 
% k=path(k,j); 
% end 
% disp(j); 
% %由弗洛伊德算法算出从起点 1 到村庄 15 的最短路径是 1-25-24-23-21-9-15 
% lu=[25,24,23,21,9,15]; 
% t=0;%天数 
% dot=1;%当前所在地区 
% i=1;%日期 i 小于等于 30 
% j=1;%记录步数 
% water=0;food=0; 
% while dot~=15 %到达村庄后结束 
% if W1(i)==0 
% water=water+C1(3,1);%资源箱数 
% food=food+C1(3,2); 
% t=t+1;%天数+1 
% i=i+1; 
% elseif W1(i)==1 
% water=water+2*C1(1,1);%资源箱数 
% food=food+2*C1(1,2); 
% dot=lu(j);j=j+1; 
% t=t+1;%天数+1 
% i=i+1; 
% elseif W1(i)==2 
% water=water+2*C1(2,1);%资源箱数 
% food=food+2*C1(2,2); 
% dot=lu(j);j=j+1; 
% t=t+1;%天数+1 
% i=i+1; 
% end 
% end 
% Swater=water*price(1); 
% Sfood=food*price(2); 
% xiaohao=Swater+Sfood;%消耗资金量 
% Mwater=water*pm(1); 
% Mfood=food*pm(2); 
% m1=Mwater+Mfood;%最少负重 
%% 输出起点 1 到矿山 12 的最短路径 
% i=1;j=12; 
% k=path(i,j); 
% disp(i); 
% while k~=j 
% disp(k); 
% k=path(k,j); 
% end 
% disp(j); 
% %由弗洛伊德算法算出从起点 1 到矿区 12 的最短路径是 1-25-24-23-21-9/17-10/15/16-
11/13/14-12 
% lu=[25,24,23,21,9,15,13,12]; 
% t=0;%天数 
% dot=1;%当前所在地区 
% i=1; 
% j=1;%记录步数 
% water=0;food=0; 
% while dot~=12 %到达矿山后结束 
% if W1(i)==0 
% water=water+C1(3,1);%资源箱数 
% food=food+C1(3,2); 
% t=t+1;%天数+1 
% i=i+1; 
% elseif W1(i)==1 
% water=water+2*C1(1,1);%资源箱数 
% food=food+2*C1(1,2); 
% dot=lu(j);j=j+1; 
% t=t+1;%天数+1 
% i=i+1; 
% elseif W1(i)==2 
% water=water+2*C1(2,1);%资源箱数 
% food=food+2*C1(2,2); 
% dot=lu(j);j=j+1; 
% t=t+1;%天数+1 
% i=i+1; 
% end 
% end 
% Swater=water*price(1); 
% Sfood=food*price(2); 
% xiaohao=Swater+Sfood;%消耗资金量 
% Mwater=water*pm(1); 
% Mfood=food*pm(2); 
% m1=Mwater+Mfood;%最少负重 
%% 输出矿山 12 到终点 27 的最短路径 
% i=12;j=27; 
% k=path(i,j); 
% disp(i); 
% while k~=j 
% disp(k); 
% k=path(k,j); 
% end 
% disp(j); 
% %由弗洛伊德算法算出从矿山 12 到终点 27 的最短路径是 12-11-10-9-21-27 
lu=[11,10,9,21,27]; 
t=0;%天数 
dot=12;%当前所在地区 
i=26; 
j=1;%记录步数 
water=0;food=0; 
while dot~=27 %到达终点后结束 
 if W1(i)==0 
 water=water+C1(3,1);%资源箱数 
 food=food+C1(3,2); 
 t=t+1;%天数+1 
 i=i+1; 
 elseif W1(i)==1 
 water=water+2*C1(1,1);%资源箱数 
 food=food+2*C1(1,2); 
 dot=lu(j);j=j+1; 
 t=t+1;%天数+1 
 i=i+1; 
 elseif W1(i)==2 
 water=water+2*C1(2,1);%资源箱数 
 food=food+2*C1(2,2); 
 dot=lu(j);j=j+1; 
 t=t+1;%天数+1 
 i=i+1; 
 end 
end 
Swater=water*price(1); 
Sfood=food*price(2); 
xiaohao=Swater+Sfood;%消耗资金量 
Mwater=water*pm(1); 
Mfood=food*pm(2); 
m1=Mwater+Mfood;%最少负重 
%% 计算在矿山挖矿的收益和消耗 
mine1=1000-3*C1(1,1)*2*price(1)-3*C1(1,2)*2*price(2);%晴朗天气挖矿收益 
cw1=3*C1(1,1)*pm(1);%晴朗天气的水消耗 
cf1=3*C1(1,2)*pm(2);%晴朗天气的食物消耗 
mine2=1000-3*C1(2,1)*2*price(1)-3*C1(2,2)*2*price(2);%高温天气挖矿收益
cw2=3*C1(2,1)*pm(1);%高温天气的水消耗 
cf2=3*C1(2,2)*pm(2);%高温天气的食物消耗 
mine0=1000-3*C1(3,1)*2*price(1)-3*C1(3,2)*2*price(2);%沙暴天气挖矿收益 
cw0=3*C1(3,1)*pm(1);%沙暴天气的水消耗 
cf0=3*C1(3,2)*pm(2);%沙暴天气的食物消耗 
%% 分策略进行搜索 
%去矿山途中经过村庄,进行一次补给,去到终点的途中再进行补给一次 
%到达村庄 15 需要最少的水量数为 98intwater=98; 
intfood=(Lm-intwater*pm(1))/pm(2); 
digw=0;digf=0; 
smoney=initial-intwater*price(1)-intfood*price(2); 
smoney=smoney-2*2*C1(2,1)*price(1)-2*2*C1(2,2)*price(2); 
smoney=smoney+(intfood-98)*2*price(2); 
for i=11:25 
 if W1(i)==0 
 digw=digw+3*C1(3,1);%资源箱数 
 digf=digf+3*C1(3,2); 
 elseif W1(i)==1 
 digw=digw+3*C1(1,1);%资源箱数 
 digf=digf+3*C1(1,2); 
 elseif W1(i)==2 
 digw=digw+3*C1(2,1);%资源箱数 
 digf=digf+3*C1(2,2); 
 end 
 sum=digw*2*price(1)+digf*2*price(2); 
 nw=0;nf=0;%每次循环都置零 
 if W1(i+1)==0 
 nw=nw+C1(3,1);%资源箱数 
 nf=nf+C1(3,2); 
 elseif W1(i+1)==1 
 nw=nw+2*C1(1,1);%资源箱数 
 nf=nf+2*C1(1,2); 
 elseif W1(i+1)==2 
 nw=nw+2*C1(2,1);%资源箱数 
 nf=nf+2*C1(2,2); 
 end 
 if W1(i+2)==0 
 nw=nw+C1(3,1);%资源箱数 
 nf=nf+C1(3,2); 
 elseif W1(i+2)==1 
 nw=nw+2*C1(1,1);%资源箱数 
 nf=nf+2*C1(1,2); 
 elseif W1(i+2)==2
  nw=nw+2*C1(2,1);%资源箱数 
 nf=nf+2*C1(2,2); 
 end 
 if sum>smoney-nw*2*price(1)-nf*2*price(2) 
 break; 
 end 
 if (digw+nw+32)*3+(digf+nf+24)*2>Lm 
 break; 
 end 
end 
%当经过补充后,若挖矿日期在第 21 天及以后则无法获得补给,游戏失败 
%最好情况为从第 11 天到 17 天挖矿 
sum=sum-3*C1(1,1)*2*price(1)-3*C1(1,2)*2*price(2); 
mine=0;%挖矿获得的收益 
for i=11:15 
 if W1(i)==0 
 mine=mine+mine0; 
 elseif W1(i)==1 
 mine=mine+mine1; 
 elseif W1(i)==2 
 mine=mine+mine2; 
 end 
end 
% %lastcost=2*((C1(3,1)*price(1)+C1(3,2)*price(2))+2*(C1(1,1)*price(1)+C1(1,2)*
price(2))+2*2*(C1(2,1)*price(1)+C1(2,2)*price(2))); 
% smoney1=smoney-sum; 
% smoney2=smoney+mine; 
% smoney1=smoney1-2*(C1(1,1)*2*price(1)+C1(1,2)*2*price(2))-
2*(C1(2,1)*2*price(1)+C1(2,2)*2*price(2)); 
% xiaohao1w=(C1(3,1))+2*(C1(1,1))+2*2*(C1(2,1)); 
% xiaohao1f=(C1(3,2))+2*(C1(1,2))+2*2*(C1(2,2)); 
% xiaohao1f=xiaohao1f-smoney1/10; 
% smoney2=smoney2-lastcost+smoney1 
% water=water-buchong_w;%经过补充后总消耗的资源数 
% food=food-buchong_f; 
% while t<25 
% while shenyu>=(water+food) 
% if W1(i)==0 
% water=water+C1(3,1);%资源箱数 
% food=food+C1(3,2); 
% t=t+1;%天数+1 
% i=i+1; 
% elseif W1(i)==1 
% water=water+
% food=food+2*C1(1,2); 
% dot=lu(j);j=j+1; 
% t=t+1;%天数+1 
% i=i+1; 
% elseif W1(i)==2 
% water=water+2*C1(2,1);%资源箱数 
% food=food+2*C1(2,2); 
% dot=lu(j);j=j+1; 
% t=t+1;%天数+1 
% i=i+1; 
% end 
% end 
% end2*C1(1,1);%资源箱数
For all papers, please see below "Only modeling QQ business cards" Click on the QQ business card

Guess you like

Origin blog.csdn.net/weixin_43292788/article/details/131527356