14 views (last 30 days)

sharifah shuthairah syed abdullah
on 3 Jul 2018

Commented: sharifah shuthairah syed abdullah
on 4 Jul 2018

OCDER
on 3 Jul 2018

I think you need to make your own function of perms, but one that only returns 1 of many permutations at a time. When you past n = 10, you'll run out of memory fast.

3.5 GB n = 11

46.0 GB n = 12

647.6 GB n = 13

9764.0 GB n = 14

One suggestion is to make a classdef object that track the ith permutation and will continuously return the the next permutation. But read this link as your attempt to compute permutations for n >> 11 gets fairly impossible...

OCDER
on 3 Jul 2018

Hi Sharifah, no one is mad here - we're just confused as to why you need to do this massive calculation. So, looks like you are indeed solving a very tough NP-hard problem.

The issue will be making the permutations without using 100% RAM - see the file exchange links that @Stephen posted in his answer. This solves the memory issue, but not the CPU issue. It'll be slow, unless you can figure out a way to break this up into blocks of independent jobs and use Parallel Computing Toolbox to cut times roughly by the number of cores you have. You should also consider making MEX/C++ files to speed up simple and highly repetitive calculations. GPU processing could also help. This is quite an advanced problem so there isn't really a simple solution we can provide.

Walter Roberson
on 3 Jul 2018

https://www.mathworks.com/matlabcentral/fileexchange/53110-quadratic-assignment-problem--qap--using-ga--pso-and-fa

https://github.com/cshen/quadratic-assignment-problem

Stephen Cobeldick
on 3 Jul 2018

One option would be to use a permutation generator, which does not store all permutations in memory:

etc.

I leave it up to the reader to decide if running through all permutations is tractable or not.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.