poprawiono budowanie

This commit is contained in:
Kacper Donat 2018-03-15 21:47:21 +01:00
parent 7537f02177
commit 9bc85bc995
6 changed files with 32 additions and 5 deletions

24
Makefile Normal file
View File

@ -0,0 +1,24 @@
cpp=cl
link=link
cppflags=/EHsc /std:c++latest /nologo /O2
linkflags=/nologo
all: macd.exe tester.exe trainer.exe
.cpp.obj:
$(cpp) /c $(cppdebug) $(cppflags) $(cppvars) $*.cpp
macd.exe: macd.obj
$(link) $(ldebug) $(conflags) /out:macd.exe macd.obj $(conlibs)
tester.exe: tester.obj decider.obj
$(link) $(ldebug) $(conflags) /out:tester.exe $** $(conlibs)
trainer.exe: trainer.obj decider.obj
$(link) $(ldebug) $(conflags) /out:trainer.exe $** $(conlibs)
clean:
del *.obj
del *.lst
del *.exe

View File

View File

@ -115,8 +115,10 @@ private:
vector<double, p> prices;
vector<double, m+s> tech;
// prices are normalized as percent change value
for (int j = 0; j < p; j++) {
prices.set(j, 0, this->prices[j]);
auto diff = this->prices[j] - this->prices[j+1];
prices.set(j, 0, diff / this->prices[j+1]);
}
int i = 0;
@ -128,8 +130,6 @@ private:
tech.set(i, 0, signal[j]);
}
// prices are normalized in their domain
prices = normalize(prices);
// analytic data is normalized in its own domain
tech = normalize(tech);

View File

@ -69,7 +69,7 @@ int main(int argc, const char* argv[])
} while(input_file >> price);
std::cout << "Koniec: "
std::cout << "Koniec: "
<< money + stock*price << std::showpos << "("
<< (money + stock*price) / (start_money + start_stock*price)
<< ")";

View File

@ -39,7 +39,10 @@ public:
: factory(factory), id(0), generation(1), money(money), stock(stock), n(n), random_engine(std::time(0))
{
this->q = [=](std::shared_ptr<trained<T>> x, const dataset& input, double money, unsigned stock) {
return (money + stock * input.back()) / (this->money + this->stock * input.front()); };
auto result = (money + stock * input.back()) / (this->money + this->stock * input.front());
return result / (1 + abs(result));
};
add(n);
}