OK, this example is, um, referring to the connected to so suppose we want to start from one given
point.
Let's assume it's a starting point is, uh, point one, and we want to find out how we can travel to
different nodes and come back to the same node.
Without, um, creating a loop or passing any of these notes more than one time.
OK.
Now, in order to model that again, I put a virtual demand on each node and I put that generation here
as well, and then try to supply every demand in the system.
Um.
And the objective function is defined as the UI multiplied by Deji, you multiply by the age are or
the binary variables, and the flow will determine from, um, how the production is flowing to the
demand points.
And also the flow should be less than you are and multiply by a big M, uh, in order to make it connected
to it means that um, at each node, let's call it I the there is only one um flow going out.
Mm hmm.
And also the uh at each node there's only one flow is coming in.
OK.
So in this way we can make sure that, um, we have uh, connected to.
OK, so let's have a look at the code, the import, the required packages.
And also we go forward.
Um, you can see here that, um, the model abstract is created.
And also, um, we do need to specify the number of, um, nodes said I is representing each node and
J is the alias of any of you is, uh, binary variable, uh, defined Overset I and J.
Uh, flow is a real variable, um, it's always good to specify the bounds for your, um, variable
so I can put it down for you.
And I tell your mom that it's a non negative real number is a positive one and variable G is also between
zero and well.
And and also, um, the objective function is, um, not negative real.
So, uh, we can initialize any uh valuable as well.
And also the locations of these, these nodes are randomly allocated.
The second rule is calculating the distances between different nodes for each pair of nodes and parameter,
um, is defined for that and also the node all balance is defined here for only node one, it has a
G, but the rest of them are only pillow's.
Um, the next rule is telling us and flow is less than you multiply by and a big number.
I chose that big number equal to number of nodes.
So this constraint is defined over in Jay.
Um, it's definitely better if we, um.
Define this rule in a way that it doesn't and it it's not calculated for the cases where I and J are,
um, equal to each other.
So let me modify this code for you.
OK, so I put her.
If yeah, OK, so here you can see that if, um, I is not equal to Jipé, then return this, OK, or
else, uh, else return to what?
I have to skip that constraint in case that, um.
Um, these two are equal to each other, so, um.
Consecrates dance.
OK.
I hope it's correct.
OK, so I will check it for you next and then, um.
Let's have a look at the other code.
The other constraint, this constraint is telling us that, um, summation or, um, summation of UIGEA
over J should be one.
It means that the outgoing pages should be only one.
And also, this one is telling umpire more to say.
And the incoming, um.
As to each node should be only one and the objective function is.
And doing this summation where you are, you are seeing multiply by D.R.C. and so on.
OK, so let me run the code.
Uh, OK.
And this one, OK.
It is also correct.
And, uh, the software is chosen by Rhonda.
Mm hmm.
It says constraint has no escape.
Maybe I have made a mistake the way I approach to skip a skip should as should be capitalized on.
But no.
So I run into again, um, check the result.
So I'm waiting for the model to, um, give me the solution.
OK, so here you can see we have a connected to OK, so as you can see, all the nodes are connected
to each other and the degree of each node is two.
So you could write it down in a different way.
So instead of writing it as two separate concentrate like uh well let's see three and C four, you could
say degree of each node should be exactly equal to two.
That should give you the same kind of result.
Thank you very much.