Particle swarm is firstly initialized by the result of K-Means clustering algorithm, and clustering process is based on Euclidean distance among data vectors. Then clustering center is found by QPSO algorithm. Simulation experiment is on NS-2 with use of KDD 99 dataset, and experiment result shows the method is effective.In Ch.5, wavelet neural network, trained by QPSO algorithm, is used in Ad Hoc anomaly detection. To test performance, gradient descent algorithm, PSO algorithm and QPSO algorithm are used to train the same wavelet neural network‘s parameters for Ad Hoc anomaly detection. Simulation experiment result on NS-2 with use of KDD 99 dataset shows the method is effective.In Ch.6, based on Ch.5, B-QPSO algorithm is introduced. To test performance, it’s compared with gradient descent algorithm, PSO algorithm and QPSO algorithm. Simulation experiment result on NS-2 with use of KDD 99 dataset shows the method is effective.The research is indicated that QPSO algorithm, combined with other intelligence algorithms, can be used in Ad Hoc anomaly detection. Simulation experiment shows that the accuracy of anomaly detection is enhanced and the false positive rate for normal state in the network anomaly detection was declined.