CN107526903A - Prescribed Properties permutation and combination encodes generating algorithm and MATLAB implementation methods - Google Patents
Prescribed Properties permutation and combination encodes generating algorithm and MATLAB implementation methods Download PDFInfo
- Publication number
- CN107526903A CN107526903A CN201710915691.1A CN201710915691A CN107526903A CN 107526903 A CN107526903 A CN 107526903A CN 201710915691 A CN201710915691 A CN 201710915691A CN 107526903 A CN107526903 A CN 107526903A
- Authority
- CN
- China
- Prior art keywords
- mrow
- prescribed properties
- generation
- msubsup
- combination
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2111/00—Details relating to CAD techniques
- G06F2111/04—Constraint-based CAD
Abstract
The invention discloses a kind of Prescribed Properties permutation and combination coding generating algorithm and MATLAB Program Realizing Methods, the arrangement generation method of Prescribed Properties generates next fully intermeshing since the minimum fully intermeshing for meeting constraints, by the method increased successively;Since combining the minimum ascending order for meeting constraints, generate next ascending order by the method increased successively and combine;The method of the present invention, can effectively solve integer programming solution, the information coding of Prescribed Properties, vehicle scheduling, competitive sports, course arrangement etc. and be related to the encoded computer program of Prescribed Properties requirement to realize, efficiently, it is quick, accurate, economically solve the practical problems such as production, scientific research.
Description
Technical field
The invention belongs to plan strategies for, plan, the coding generating algorithm technical field in the field such as information, computer, more particularly to
Prescribed Properties permutation and combination encodes generating algorithm and MATLAB implementation methods.
Background technology
On 1,2 ..., n fully intermeshing and combination producing, have tens of kinds of different derivation algorithms at present.Typical row
Sequence algorithm has Straight Selection Sort, bubble sort, insertion sort, merger sequence, quicksort etc.;And fully intermeshing generating algorithm allusion quotation
Such as lexcographical order method, transfer method, conversion method, the ortho position exchange method of type, some of them are more indigestible recursion type algorithms.But
Not exclusively it is fully intermeshing or the combination of different elements in practical application, sometimes there is the arrangement of particular/special requirement, such as course arrangement
The solution of algorithm, the arrangement of competitive sports, vehicle scheduling, integral linear programming solve, in information coding, certain algorithm or program
Requirement etc..On the permutation and combination of Prescribed Properties requirement, there are part documents and materials, but Shortcomings:1st, algorithm idea is not
It is enough simple and direct, it is more complicated.2nd, arthmetic statement not enough describes to refine, and is not easy to allow reader's grasp to understand.3rd, in program realization, not enough
Specifically, definition is lacked.4th, constraints is simple, and digit is few, without generality.
The content of the invention
It is an object of the present invention to provide a kind of algorithm of Prescribed Properties permutation and combination coding generation;Program based on algorithm is real
It is existing;It is easy to grasp the algorithm and program with presented example;Encode, plan strategies for for information, scientific research, the produce reality such as programming evaluation provide
Effectively service.
The present invention is realized using following technical scheme:
A kind of Prescribed Properties permutation and combination encodes generating algorithm, including the arrangement generation method of Prescribed Properties and has about
The combination producing method of beam condition,
The arrangement generation method of Prescribed Properties:
If arrange a1a2…am, meet:0≤ai≤Ni, a1+a2+…+am=n, seek all a1a2…amGeneration;
Since the minimum fully intermeshing for meeting constraints, next fully intermeshing is generated by the method increased successively:
(1) from arrangement a1a2…anRightmost starts to search to the left side:at< Nt, t=max { i ︱ ai< Ni, i ≠ m },
a1a2…at-1Keep constant, at+1→at;
(2) calculate:
(3) t+1 positions are regenerated to m positions:
MjφNjWhen, make a 'j=Nj, Mj-1=Mj-Nj;Mj≤NjWhen, make a 'j=Mj, a 'j-1=a 'j-2=Λ=a 't+1=
0;
(4) new arrangement is formed:a1a2Λat-1(at+1)a′t+1Λa′j-1a′jΛa′m;
(5) (1)-(3) are repeated, whole arrangements can be generated, terminate generation.
Preferably, the combination producing method of Prescribed Properties:
If seek ai≠aj, i ≠ j, a1+a2+Λ+am=n, by a1, a2..., amAll combinations of composition.
Since combining the minimum ascending order for meeting constraints, generate next ascending order by the method increased successively and combine:
(1) a is combined from ascending order1a2…amRightmost begin look for ak, t=max j | aj-1φaj-1,
K=max r | the Ι a of t-r φ 1r+1-ar=2 } (1) formula or k=max r | ar+1-ar>=3 } (2) formula;
(2) if meeting (1) formula, ak+1→ak, at-1→at, other every elements are constant, form new ascending order combination:
a1a2Λak-1(ak+1)ak+1Λat-1(at-1)at+1Λam
(3) if meeting (2) formula,
Other every elements are constant, form new ascending order combination:a1a2Λak-1a′ka′k+1Λa′m;
(4) (1)-(3) step is repeated, whole ascending order combinations is generated, terminates generation.
The present invention discloses a kind of MATLAB Program Realizing Methods of Prescribed Properties permutation and combination coding generation:
The MATLAB Program Realizing Methods of the arrangement generation of Prescribed Properties:
Work as a1+a2+a3+a4=9,0≤a1≤ 3,0≤a2≤ 4,0≤a3≤ 2,0≤a4≤ 3, by a1、a2、a3、a4Generation
All arrangements.
The combination producing MATLAB Program Realizing Methods of Prescribed Properties::
a1+a2+a3+a4+a5=21;0≤ai,ai≠aj, j ≠ i, meet all combinations of constraints;
The present invention method, can effectively solve integer programming solution, the information coding of Prescribed Properties, vehicle scheduling,
The encoded computer program that competitive sports, course arrangement etc. are related to Prescribed Properties requirement is realized, efficient, quick, accurate, economical
Ground solves the practical problems such as production, scientific research.
Brief description of the drawings
Fig. 1 is Prescribed Properties arranging and encoding generation program flow diagram of the present invention.
Fig. 2 is Prescribed Properties assembly coding generation program flow diagram of the present invention.
Embodiment
1st, the algorithm mathematics principle of coding generation
Define 1:If a1a2…am, b1b2…bmIt is 2 different arrays, works as a1a2…arWith b1b2…brIt is identical, and
ar+1> br+1When, then claim a1a2…amMore than b1b2…bm, a1a2…amWith b1b2…bmOnly relatively large foreword value, without definitely big
Foreword value, such as the arrangement and the arrangement of 12,139 4 numbers of 12,156 4 numbers, each arrange no absolute size, but definable
12156 arrangements are more than 12139.
Define 2:If a1a2…amIt is from 1,2,3 ..., the combination chosen in n, if a1≤a2≤…≤am, then claim
a1a2…amIt is an ascending order combination.
Theorem 1:If arrange a1a2…amWith b1b2…bm, it is satisfied by:0≤ai≤Ni, 0≤bi≤Ni, a1+a2+…+am=n,
b1+b2+…+bm=n.If at< Nt, t=max { i ︱ ai< Ni, i ≠ m },
MjφNjWhen, make a 'j=Nj, Mj-1=Mj-Nj;Mj≤NjWhen, make a 'j=Mj, a 'j-1=a 'j-2=Λ=a 't+1=
0;Then:
a1a2Λat-1(at+1)a′t+1Λa′j-1a′jΛa′m=min { b1b2Λbm|b1b2Λbmφa1a2Λam}
Prove:Known by the meaning of the question, work as at< NtWhen, at+1..., amIt is reached maximum, it is impossible to increase again, so being more than
a1a2…amArrangement increase maximum position can only be in t positions, so at+ 1, at this moment from at+1To amWill be by constraints according to most
Small principle of ordering rearrangement, thereforeJ=m, m-1, Λ, t+1, work as MjφNjWhen, make a 'j=Nj, Mj-1=Mj-
Nj;
Mj≤NjWhen, make a 'j=Mj, a 'j-1=a 'j-2=Λ=a 't+1=0;At this moment a 't+1Λa′j-1a′jΛa′mTo meet
The minimum sequence of constraints,So have, a1a2Λat-1(at+1)a′t+1
Λa′j-1a′jΛa′m=min { b1b2Λbm|b1b2Λbmφa1a2Λam}。
Theorem 2:If arrange a1a2…amWith b1b2…bmTo meet the 2 of same constraints ascending order combinations,
Wherein
ai≠aj, i ≠ j, 0≤a1πΛπam, a1+a2+Λ+am=n,
bi≠bj, i ≠ j, 0≤b1πΛπbm, b1+b2+Λ+bm=n
If
T=max j | aj-1φaj-1,
K=max r | the Ι a of t-r φ 1r+1-ar=2 } (1) formula or k=max r | ar+1-ar>=3 } (2) formula
Then:If meeting (1) formula,
a1a2Λak-1(ak+1)ak+1Λat-1(at-1)at+1Λam=min { b1b2Λbm|b1b2Λbmφa1a2Λam};
If meet (2) formula, a1a2Λak-1a′ka′k+1Λa′m=min { b1b2Λbm|b1b2Λbmφa1a2Λam}。
Prove:If meeting (1) formula, known by the meaning of the question, as t-k > 1 and ak+1-akWhen=2, ak+ 1 < ak+1< ... < at-1
< ... < am, more than a1a2…amThe position of minimum arrangement increase be kth position, ak+ 1, the position of reduction is t positions, so having:
a1a2Λak-1(ak+1)ak+1Λ(at-1)at+1Λam=min { b1b2Λbm|b1b2Λbmφa1a2Λam}。
If meet (2) formula, more than a1a2…amThe position of minimum arrangement increase be kth position, ak+ 1,
But due to ak+1-ak>=3, from kth+1, meet
Minimum ascending order be combined as:ak+ 2=a 'k+1, Λ ak+ m-k=a 'm-1,
So have:a1a2Λak-1(ak+1)a′k+1Λa′m=min { b1b2Λbm|b1b2Λbmφa1a2Λam}
2nd, the description of permutation and combination coding method of formation and step
2.1st, the arrangement generation of Prescribed Properties, as shown in Figure 1:
If arrange a1a2…am, meet:0≤ai≤Ni, a1+a2+…+am=n, seek all a1a2…amGeneration.
It is next complete by the method generation increased successively since the minimum fully intermeshing for meeting constraints according to theorem 1
Arrangement:
(1) from arrangement a1a2…amRightmost starts to search to the left side:at< Nt, t=max { i ︱ ai< Ni, i ≠ m },
a1a2…at-1Keep constant, at+1→at。
(2) calculate:
(3) t+1 positions are regenerated to m positions:
MjφNjWhen, make a 'j=Nj, Mj-1=Mj-Nj;
Mj≤NjWhen, make a 'j=Mj, a 'j-1=a 'j-2=Λ=a 't+1=0;
(4) new arrangement is formed:a1a2Λat-1(at+1)a′t+1Λa′j-1a′jΛa′m。
(5) (1)-(3) are repeated, whole arrangements can be generated, terminate generation.
2.2nd, the combination producing of Prescribed Properties, as shown in Figure 2:
If seek ai≠aj, i ≠ j, a1+a2+Λ+am=n, by a1, a2..., amAll combinations of composition.
It is next by the method generation increased successively since combining the minimum ascending order for meeting constraints according to theorem 2
Ascending order combines:
(1) a is combined from ascending order1a2…amRightmost begin look for ak, t=max j | aj-1φaj-1, k=max r | t-
rφ1Ιar+1-ar=2 } (1) formula or k=max r | ar+1-ar>=3 } (2) formula
(2) if meeting (1) formula, ak+1→ak, at-1→at, other every elements are constant, form new ascending order combination:
a1a2Λak-1(ak+1)ak+1Λat-1(at-1)at+1Λam
(3) if meeting (2) formula,
Other every elements are constant, form new ascending order combination:a1a2Λak-1a′ka′k+1Λa′m
(4) (1)-(3) step is repeated, whole ascending order combinations is generated, terminates generation.
3rd, the realization of MATLAB programs and example
3.1st, the arrangement generation of Prescribed Properties
Example:a1+a2+a3+a4=9,0≤a1≤ 3,0≤a2≤ 4,0≤a3≤ 2,0≤a4≤ 3, by a1、a2、a3、a4Generation
All arrangements.
Following methods are not limited to this example, can be applicable.
3.2nd, the combination producing of Prescribed Properties:
a1+a2+a3+a4+a5=21;0≤ai,ai≠aj, j ≠ i, meet all combinations of constraints.
Following methods are not limited to this example, can be applicable.
Finally it should be noted that:The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention,
Although the present invention is described in detail with reference to the foregoing embodiments, for those skilled in the art, it still may be used
To be modified to the technical scheme described in foregoing embodiments, or equivalent substitution is carried out to which part technical characteristic.
Within the spirit and principles of the invention, any modification, equivalent substitution and improvements made etc., it should be included in the present invention's
Within protection domain.
Claims (3)
1. a kind of Prescribed Properties permutation and combination encodes generating algorithm, include the arrangement generation method and Constrained of Prescribed Properties
The combination producing method of condition, it is characterised in that
The arrangement generation method of Prescribed Properties:
If arrange a1a2…am, meet:0≤ai≤Ni, a1+a2+…+am=n, seek all a1a2…amGeneration;
Since the minimum fully intermeshing for meeting constraints, next fully intermeshing is generated by the method increased successively:
(1) from arrangement a1a2…amRightmost starts to search to the left side:at< Nt, t=max { i ︱ ai< Ni, i ≠ m }, a1a2…at-1
Keep constant, at+1→at;
(2) calculate:J=m, m-1, Λ, t+1;
(3) t+1 positions are regenerated to m positions:
MjφNjWhen, make a 'j=Nj, Mj-1=Mj-Nj;Mj≤NjWhen, make a 'j=Mj, a 'j-1=a 'j-2=Λ=a 't+1=0;
(4) new arrangement is formed:a1a2Λat-1(at+1)a′t+1Λa′j-1a′jΛa′m。
(5) (1)-(3) are repeated, whole arrangements can be generated, obtain all a1a2…amGeneration, terminate generation.
2. Prescribed Properties permutation and combination according to claim 1 encodes generating algorithm, it is characterised in that
The combination producing method of Prescribed Properties:
If seek ai≠aj, i ≠ j, 0≤a1πΛπam, a1+a2+Λ+am=n, by a1, a2..., amAll combinations of composition;
Since combining the minimum ascending order for meeting constraints, generate next ascending order by the method increased successively and combine:
(1) a is combined from ascending order1a2…amRightmost begin look for ak,
T=max j | aj-1φaj-1},
K=max r | the Ι a of t-r φ 1r+1-ar=2 } (1) formula or k=max r | ar+1-ar>=3 } (2) formula;
(2) if meeting (1) formula, ak+1→ak, at-1→at, other every elements are constant, form new ascending order combination:
a1a2Λak-1(ak+1)ak+1Λat-1(at-1)at+1Λam;
(3) if meeting (2) formula,
<mrow>
<mi>S</mi>
<mo>=</mo>
<munderover>
<mo>&Sigma;</mo>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mi>k</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
<mi>m</mi>
</munderover>
<msub>
<mi>a</mi>
<mi>i</mi>
</msub>
<mo>-</mo>
<mn>1</mn>
<mo>;</mo>
<msub>
<mi>a</mi>
<mi>k</mi>
</msub>
<mo>+</mo>
<mn>1</mn>
<mo>=</mo>
<msubsup>
<mi>a</mi>
<mi>k</mi>
<mo>&prime;</mo>
</msubsup>
<mo>,</mo>
<msub>
<mi>a</mi>
<mi>k</mi>
</msub>
<mo>+</mo>
<mn>2</mn>
<mo>=</mo>
<msubsup>
<mi>a</mi>
<mrow>
<mi>k</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
<mo>&prime;</mo>
</msubsup>
<mo>,</mo>
<msub>
<mi>&Lambda;a</mi>
<mi>k</mi>
</msub>
<mo>+</mo>
<mi>m</mi>
<mo>-</mo>
<mi>k</mi>
<mo>=</mo>
<msubsup>
<mi>a</mi>
<mrow>
<mi>m</mi>
<mo>-</mo>
<mn>1</mn>
</mrow>
<mo>&prime;</mo>
</msubsup>
<mo>,</mo>
<msubsup>
<mi>a</mi>
<mi>m</mi>
<mo>&prime;</mo>
</msubsup>
<mo>=</mo>
<mi>S</mi>
<mo>-</mo>
<munderover>
<mo>&Sigma;</mo>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mi>k</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>m</mi>
<mo>-</mo>
<mn>1</mn>
</mrow>
</munderover>
<msubsup>
<mi>a</mi>
<mi>i</mi>
<mo>&prime;</mo>
</msubsup>
<mo>,</mo>
</mrow>
Other every elements are constant, form new ascending order combination:a1a2Λak-1a′ka′k+1Λa′m;
(4) (1)-(3) step is repeated, whole ascending order combinations is generated, terminates generation.
A kind of 3. MATLAB Program Realizing Methods of Prescribed Properties permutation and combination coding generation:Characterized in that,
The MATLAB Program Realizing Methods (application for being not limited only to this example) of the arrangement generation of Prescribed Properties:
Work as a1+a2+a3+a4=9,0≤a1≤ 3,0≤a2≤ 4,0≤a3≤ 2,0≤a4≤ 3, by a1、a2、a3、a4Generation is owned
Arrangement;
A kind of MATLAB Program Realizing Methods of the combination producing of Prescribed Properties (application for being not limited only to this example):
Work as a1+a2+a3+a4+a5=21;0≤ai,ai≠aj, j ≠ i, meet all combinations of constraints;
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710915691.1A CN107526903A (en) | 2017-09-30 | 2017-09-30 | Prescribed Properties permutation and combination encodes generating algorithm and MATLAB implementation methods |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710915691.1A CN107526903A (en) | 2017-09-30 | 2017-09-30 | Prescribed Properties permutation and combination encodes generating algorithm and MATLAB implementation methods |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107526903A true CN107526903A (en) | 2017-12-29 |
Family
ID=60684143
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710915691.1A Pending CN107526903A (en) | 2017-09-30 | 2017-09-30 | Prescribed Properties permutation and combination encodes generating algorithm and MATLAB implementation methods |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107526903A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110189052A (en) * | 2019-06-06 | 2019-08-30 | 吉林省中创永道科技有限公司 | A kind of evaluation method based on scattered data being combination constraint condition |
CN112880556A (en) * | 2021-01-06 | 2021-06-01 | 南京林业大学 | Method for generating accurate codes of forest stand survey sample trees through three-dimensional laser scanning of foundation |
CN114758728A (en) * | 2022-06-15 | 2022-07-15 | 成都边界元科技有限公司 | Genotype identification and visualization method for generating minimum hamming distance under mixed system |
-
2017
- 2017-09-30 CN CN201710915691.1A patent/CN107526903A/en active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110189052A (en) * | 2019-06-06 | 2019-08-30 | 吉林省中创永道科技有限公司 | A kind of evaluation method based on scattered data being combination constraint condition |
CN112880556A (en) * | 2021-01-06 | 2021-06-01 | 南京林业大学 | Method for generating accurate codes of forest stand survey sample trees through three-dimensional laser scanning of foundation |
CN112880556B (en) * | 2021-01-06 | 2022-04-22 | 南京林业大学 | Method for determining forest stand standard ground sample wood position through three-dimensional laser scanning of foundation |
CN114758728A (en) * | 2022-06-15 | 2022-07-15 | 成都边界元科技有限公司 | Genotype identification and visualization method for generating minimum hamming distance under mixed system |
CN114758728B (en) * | 2022-06-15 | 2022-09-02 | 成都边界元科技有限公司 | Genotype identification and visualization method for generating minimum hamming distance under mixed system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Zhu et al. | A secure and fast image encryption scheme based on double chaotic S-boxes | |
Juteau et al. | Parity sheaves | |
Terras | Zeta functions of graphs: a stroll through the garden | |
Elizalde | Fixed points and excedances in restricted permutations | |
Jin et al. | A construction of new quantum MDS codes | |
Haviv et al. | Tensor-based hardness of the shortest vector problem to within almost polynomial factors | |
CN107526903A (en) | Prescribed Properties permutation and combination encodes generating algorithm and MATLAB implementation methods | |
Deutsch et al. | Computing Hosoya polynomials of graphs from primary subgraphs | |
Persichetti | Efficient one-time signatures from quasi-cyclic codes: A full treatment | |
Witten | Two lectures on the Jones polynomial and Khovanov homology | |
CN107124251A (en) | A kind of polarization code encoding method based on arbitrary kernel | |
Alderson | A note on full weight spectrum codes | |
Moya-Albor et al. | Color image encryption algorithm based on a chaotic model using the modular discrete derivative and langton’s ant | |
Webster | Representation theory of the cyclotomic Cherednik algebra via the Dunkl-Opdam subalgebra | |
CN109767004A (en) | A kind of One-dimensional Quantum convolutional calculation method of information | |
Liu et al. | DNA Codes Over the Ring F₄ [U] | |
CN117411616A (en) | Multiparty threshold privacy set intersection method | |
Cao et al. | Construction of minimal sets for capacity-approaching variable-length constrained sequence codes | |
Tian et al. | A coding algorithm for constant weight vectors: A geometric approach based on dissections | |
Wu et al. | A novel threshold changeable secret image sharing scheme | |
La Guardia et al. | Good and asymptotically good quantum codes derived from Algebraic geometry codes | |
Kim et al. | Banded surfaces, banded links, band indices and genera of links | |
Nekrutkin | On the complexity of binary floating point pseudorandom generation | |
Escribano Pablos et al. | The cracking of WalnutDSA: a survey | |
Chen et al. | Efficient Encoding Method for Combined Codes in the MWD Telemetry System |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20171229 |