We'll look at three different approaches to the we can add it to the data farm.

So just add it as a new data, that's one way of doing it.

We can use constraints to build,

we can write constraints to force the rank [a, b].

They used to take the rank arrays or we can use more complex comprehensions.

So, adding it to the data file is fairly straightforward.

So here, is our two-dimensional array of agents and it's basically saying,

okay, agent one ranks number two as the first preference.

Number four as the second preference and number five, it's the third preference.

Agent two ranks number one as the second preference,

number three is the third preference and number six is the first preference.

So, we can see a different view of the data.

Now, this is advantageous and the reason is we can use any program we want

to create this other view of the data.

But when we do this we have to be very careful.

We have to ensure we don't have to add to our model sign.

It's going to check that the preference information and

the rank information actually agree, right?

So we know that if we have two agents and

i is in the preference set with a, and we know that the i's

preference of a is b means it must be that the rank a gets to b is i.

If that's not the case, then something has gone wrong and

your ranking doesn't agree for those pair of agents.

We also have to do something else, we have to see if a ranks b is zero, so

that means it has no ranking for it, then it shouldn't be the case.

But there's something in its number of preferences,

some i, the i's preference of a is b.

So, we have to check these things to make sure that the preference and

the rank array agree on the data.

And if we're using two views of the data that are both coming from the outside.

It's essential that we check the date, give us the same year.

So, another way of doing the rank array is to use constraints.

So now we have to make this a variable array,

because we're going to use constraints to evaluate it.

And then we can basically wipe down the constraints which define it.

So we know for two agents, if the preference and i and

the number of actual preferences are made,

then if i's preference of a is b and the rank of ab should be equal to i.

So basically that's exactly the definition,

we have to also ensure that the other ones, so this one is applied.

So if a and b, if there's no preference between a and b,

then this one forced at the rank of a, b, zero.

So, we have to do that as well.

So we're looking two agents and for none of the preferences of a there's

an i which gives us agent b then we're going to set the rank of a b equals zero.

So this can be very easy, because basically, often the relationship

between these two views are very simple to write down with constraints.

But there's strong disadvantages that, when we use this model,

the rank is not fixed in translation time.

So remember, when we gave them the data these were not variables,

these were just integers from zero to n-1 those ranks.

So, all the ranks were known at translation time.

So in this model, the ranks are not known.

So wherever we use them, we're going to be using variables.

And it gives it more resolve to do.

So another thing we can do, is we can just build the rankings and comprehension.

And now we have to be a bit clever about how we do that.

So, we know that this is a two-dimensional array for pairs of agents.

Now, how can we work out to put the right value i in this a,

b position for a pair of agents?

So this is the expression that's fixing a in i, and

we're going to sum up for i in the number of preferences of a.

We find that preference at the i-th position of a is is b,

then this will evaluate to true, and so we'll add up i.