I'm looking to simulate a poset, called x say, of size 2n in java of the form a_1 < a_2 < ... < a_n, and b_1 < b_2 < ... < b_n.
I want to run an iteration to get a random linear extension whereby I compare the 'size' of each object and if two adjacent positions can be switched I do so, if not then I stick, to end with a new order. For example x[i] = a_k and x[i+1] = b_k I switch them, however if x[i] = a_k and x[i+1] = a_(k+1) I would not. (In essence this is the Karzanov Khachiyan chain).
I initially thought of using an array of arrays where x[][] = {a_1[], ..., b_1[], ... }, where say a_1 = {a,1}, where I could compare the values and easily make a switch. Now I am trying to think of other ways to do this, as from my previous quesiton I can see this isn't going to be a partiularly efficient or elegant way of doing this. Does anyone have any suggestions?