Rank and unrank permutation with special properties

雨燕双飞 提交于 2019-12-08 08:16:34

问题


I want to rank and unrank permutations with special properties. How can i do this? The both properties of permutations in the set are:

  1. each permutation has only 1 cycle
  2. each permutation consist of subsets of permutation elements, where the subsets are in some special ordering.

For example:

The permutations with length 6 (N := 6) has following permutation elements: (1,2,3,4,5,6) with subsets:

Subset S1 := (5,6)

Subset S2 := (3,4)

Subset S3 := (1,2)

Where the elements are S1 > S2 > S3.

So the permutation has following Subset ordering: L := (S3,S2,S1,S3,S2,S1)

With the 1 cycle constraint, there exist just 1 permutation which fullfill both constraints.

(5,4,2,6,3,1)

Counter example:

(6,4,2,5,3,1) matches second constraint but not the first.

How can i rank and unrank the permutations which fullfill both constraints.

When I have as input parameters:

N as permutation length

K as count of subsets

L as list of subsets(Si) consisting permutation elements, where L defines the ordering of the subsets(Si).

And as output parameter the Rank or the permutation if the Rank is given?

Iam able to rank and unrank permutations with only the one constraint but not with both constraints. Thus the permutations will have a length bigger than 100 (N > 100) It will not work to generate all permutations of one constraint and check against the other, to get the valid permutations to rank/unrank.

来源:https://stackoverflow.com/questions/56514684/rank-and-unrank-permutation-with-special-properties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!