We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function calAdaptability(chromosomeMatrix) { adaptability = []; // 计算每条染色体的任务长度 for (var chromosomeIndex=0; chromosomeIndex<chromosomeNum; chromosomeIndex++) { var maxLength = Number.MIN_VALUE; for (var nodeIndex=0; nodeIndex<nodeNum; nodeIndex++) { var sumLength = 0; for (var taskIndex=0; taskIndex<taskNum; taskIndex++) { if (chromosomeMatrix[chromosomeIndex][taskIndex] == nodeIndex) { sumLength += timeMatrix[taskIndex][nodeIndex]; } } if (sumLength > maxLength) { maxLength = sumLength; } } // 适应度 = 1/任务长度 adaptability.push(1/maxLength); } }
我看了代码,chromosomeMatrix[chromosomeIndex][taskIndex]存的就是节点索引吧,外面的for (var nodeIndex=0; nodeIndex<nodeNum; nodeIndex++) { 这个循环没必要吧,直接这样就可以吧
chromosomeMatrix[chromosomeIndex][taskIndex]
for (var nodeIndex=0; nodeIndex<nodeNum; nodeIndex++) {
var maxLength = Number.MIN_VALUE; var sumLength = 0; for (var taskIndex=0; taskIndex<taskNum; taskIndex++) { var nodeIndex = chromosomeMatrix[chromosomeIndex][taskIndex] sumLength += timeMatrix[taskIndex][nodeIndex]; } if (sumLength > maxLength) { maxLength = sumLength; }
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
No branches or pull requests
我看了代码,
chromosomeMatrix[chromosomeIndex][taskIndex]
存的就是节点索引吧,外面的for (var nodeIndex=0; nodeIndex<nodeNum; nodeIndex++) {
这个循环没必要吧,直接这样就可以吧The text was updated successfully, but these errors were encountered: