2011-06-01 112 views
1

假設您想查找哪個輸入導致函數x輸出值y,並且知道可能輸入的(有限)範圍。算法優化

輸入和輸出都是數字,並且正相關。

什麼是最佳的方式來優化呢?

我目前只是循環所有可能的輸入。

謝謝。

+3

這個小信息很難猜測。你在尋找一個特定的輸出嗎?如果你有函數x的衍生物,[牛頓法](http://en.wikipedia.org/wiki/Newton's_method)速度很快。如果您沒有衍生產品,[secant方法](http://en.wikipedia.org/wiki/Secant_method)是合理的第二選擇。如果函數相對於輸入變量單調遞增或遞減,則[二進制搜索](http://en.wikipedia.org/wiki/Binary_search_algorithm)可能就是該工具。 – sarnold 2011-06-01 02:31:18

回答

1

一個解決方案是在可能的輸入的二進制搜索。

流量:

find the median input x 
get the output from function(x) 
if the output is less than the desired y 
    start over using the smaller half of the possible inputs 
else 
    start over using the larger half of the possible inputs 
+0

完美,謝謝! – senak 2011-06-01 02:43:39

0

如果範圍是有限的,小的,如果你有一些設置專門的預先計算的查找表可能是最快的方式

0

「X」數據產生「Y」你可以在訓練和測試集之間進行分配並使用神經網絡。