This Matlab code is intended to find D-optimal and orthogonal designs from an unspecified number of independant parameters in order to design experimental campaigns. It's very easy to use: enter the number of experiments planned and the number of independant parameters of your study. The code will try to find an optimal design for these conditions. We mean by "optimal" the fact that the variance/covariance matrix of the experiments has the maximal possible determinant while being orthogonal at the same time. It is fully optimal when the extra-diagonal terms of the variance/covariance matrix are null and the diagonal terms equals. Other configurations are only sub-optimal but still usable with not much risks.
The code generally converges readily for variance/covariance matrix of order 16 and less. Up to order 16, it converges to sub-optimal designs only (unless you let the code running for an unreasonnable amount of time). It can easily produce matrices with the same properties as Hadamard matrices, Plackett and Burman matrices or find factorial designs. It is limited to two-levels designs in its current version. It uses parallel computing because it is funnier but it can be run on a single core also.
The code itself comes from a loose implementation inspired from this document. It tries random substitution of +1/-1 from randomly generated matrices having the same number of +1 and -1 levels for each independant parameter. In other words, this is a constrained brute-force algorithm. I ended to this short and efficient code after many attempts with more complicated optimizations techniques that did not worked as well (for example genetic algorithms). Anyway, please cite the source in case you use this code.
The way the code is implemented allows very easy modification for adding constraints, other type of optimality, extension to mixture designs, etc. Have fun with it. Maybe one day it will be extended to three or five levels design, maybe.