1 00:00:00,660 --> 00:00:10,410 Hello, everyone, and this example is called heroin problem, so, um, we want to find out if we are 2 00:00:10,410 --> 00:00:18,320 given two points like A and B and on the same side of a line called L, and we want to find out point 3 00:00:18,390 --> 00:00:27,930 D, the green one on this graph in a way that the sum of the distances from A to D and also D to B are 4 00:00:28,020 --> 00:00:28,500 minimal. 5 00:00:28,700 --> 00:00:32,300 OK, the summation of the one plus the two are minimal. 6 00:00:32,610 --> 00:00:39,240 What are the given parameters of the problem, the parameters, the data input data of the problem are 7 00:00:39,600 --> 00:00:42,230 L h one and two. 8 00:00:42,240 --> 00:00:49,740 OK, so both of these two quantities are known and the decision variables are X, D, one and D to actually 9 00:00:49,740 --> 00:00:53,030 if we know the X, we know everything else. 10 00:00:53,040 --> 00:00:57,510 OK, so the only decision variable is X in this problem. 11 00:00:58,230 --> 00:01:05,120 OK, so let's write down to formulate the mathematical formulation minimization of D one plus the two 12 00:01:05,460 --> 00:01:07,610 and subject to some constraints. 13 00:01:07,920 --> 00:01:14,190 So on the first triangle you can see here, there is a relation between X and each one and the one X 14 00:01:14,250 --> 00:01:22,380 squared plus each one is square is the one square and also on this triangle and L minus X which is here 15 00:01:22,650 --> 00:01:27,370 squared plus two is square is equal to D to a square. 16 00:01:27,500 --> 00:01:31,050 OK, so let's write it down in pie ten. 17 00:01:31,260 --> 00:01:40,740 And first of all, like the other examples, we have to import the environment and then import non pi 18 00:01:40,770 --> 00:01:41,520 if we need it. 19 00:01:42,180 --> 00:01:46,610 And also we have to define a model here. 20 00:01:46,650 --> 00:01:51,080 It's a concrete model and also the parameters of the model. 21 00:01:51,330 --> 00:01:58,500 There are three parameters in this specific example L, H1 and H2 and we have to initialize them. 22 00:01:58,500 --> 00:02:02,880 We have to tell Pisin that what are the values for them? 23 00:02:03,180 --> 00:02:05,160 And also three variables. 24 00:02:05,160 --> 00:02:06,540 The one D to annex. 25 00:02:07,140 --> 00:02:14,760 Also the one on these two can be found using X, but since we don't know the quantity and the value, 26 00:02:14,760 --> 00:02:16,290 we have to define them as valuable. 27 00:02:16,560 --> 00:02:19,920 And also we need we know that the. 28 00:02:21,080 --> 00:02:29,800 Arrange that one and you can change is between zero and L. OK, and we can initialize them as well. 29 00:02:30,230 --> 00:02:38,370 And also an X variable is between Zero and Ellisville and initialize them as all of them equal to zero. 30 00:02:38,390 --> 00:02:40,400 You can choose any other number. 31 00:02:41,090 --> 00:02:45,350 And also we have to constrain C one and C to the constraint. 32 00:02:45,360 --> 00:02:50,330 C one is telling us an expression equal model. 33 00:02:50,330 --> 00:02:52,470 The one square is equal to model. 34 00:02:52,490 --> 00:02:55,420 Each one is square plus model X is square. 35 00:02:55,820 --> 00:03:04,370 And the second constraint is telling us and the two a square is equal to model actual square plus model 36 00:03:04,370 --> 00:03:06,270 L minus X square. 37 00:03:06,650 --> 00:03:13,280 OK, and the objective function is the summation of the one plus the two and the sense of optimization 38 00:03:13,280 --> 00:03:14,600 is minimize. 39 00:03:15,200 --> 00:03:24,260 Like every other optimization example, we have to run all the times one by one and then choose the 40 00:03:24,380 --> 00:03:30,910 solver, which is obviously the problem is a nonlinear program because of the constraints, the constraints. 41 00:03:30,920 --> 00:03:33,050 You can see the non-linearity terms. 42 00:03:33,440 --> 00:03:35,090 OK, I run this one. 43 00:03:35,090 --> 00:03:40,820 So I have a specify so far the solver for solving the problem and the results will contain the decision 44 00:03:40,820 --> 00:03:43,490 variables, OK, and also the objective function. 45 00:03:43,520 --> 00:03:51,320 So if I print the results, you can see here that the the one is three point eighty nine D2 is seven 46 00:03:51,320 --> 00:03:58,220 point seventy seven and X is three point thirty three and F one is eleven point six six. 47 00:03:58,530 --> 00:04:02,560 OK, and this is a non-linear kind of programming. 48 00:04:03,350 --> 00:04:04,220 Thank you very much.