Last active
August 29, 2015 14:11
-
-
Save RudoCris/bda33799cf9b5ddb9864 to your computer and use it in GitHub Desktop.
Скрипт вычисляющий значения частных критериев оптимальности
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var f1 = function(x,y){ | |
return Math.pow(x-2, 2) + Math.pow(y-1,2); | |
} | |
var f2 = function(x,y) { | |
return Math.pow(x-5, 2) + Math.pow(y-5,2); | |
}; | |
(function(input) { | |
var crit = []; | |
var node = 0; | |
for (var x = input.xFrom; x <= input.xTo; x++) { | |
for (var y = input.yFrom; y <= input.yTo; y++) { | |
crit.push({x: x, y: y, "f1(x,y)": f1(x,y), "f2(x,y)": f2(x,y), "номер узла": ++node}) | |
} | |
} | |
console.table(crit); | |
})({xFrom: 0, xTo: 5, yFrom: 1, yTo: 5}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Измените функции f1 и f2 под свой вариант (вторая и шестая строка). И в последней строчке подставьте свои значения для множества Dx.
Откройте консоль Google Chrome и вставьте этот код туда.. =)
Пример взят отсюда http://bigor.bmstu.ru/?cnt/?doc=MO/opt11011.tst/?cou=MO/base.cou