So are you going down a C++ route now?
Will TD continue to run on Mac, Windoze and Linux?
Issues that get reported on the issue tracker (http://kfs.org/td/issues) tend to get fixed faster. That said, I fixed the numpy issue earlier today and I just pushed my fix for --age now.
Thank you, I will make sure I use issue tracker in the future.![]()
Issues that get reported on the issue tracker (http://kfs.org/td/issues) tend to get fixed faster. That said, I fixed the numpy issue earlier today and I just pushed my fix for --age now.
The key feature of numpy is vectorization, and that can be leveraged if we store data the right way - for instance, refactor the buy/sell lists the right way and you could vectorize the few math operations we need doing there. The question being how much it will cost to marshal them into a usefully vectorizable layout.
For those of us on Windows, there is always http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpyand then there's all the blas/lapack stuff to install to get the high-end perf that would make it rock, it just gets nasty
Being on Windows, trying to pass NUMPY = 1 before the call to trade.py just gives me an error![]()
Try without the spaces in between the argument NUMPY=1
G:\Elite\TD>NUMPY=1 trade.py run -vvv --summary --avoid slaves,imperial --ly 18.14 --insurance 550k --cap 116 --credits
3768464 --from Wolf10/Town --hops 3 --jumps 3
'NUMPY' is not recognized as an internal or external command,
operable program or batch file.
This is more of a fyi;
Ran this on OS X
NUMPY=1 trade.py run --from "BES/Stephonson Terminal" --detail --progress --credits 25000000 --capacity 240 --ly-per 12.54 --hops 8 --jumps 4 -vv
and got this
/Library/Frameworks/Python.framework/Versions/3.4/Resources/Python.app/Contents/MacOS/Python: can't open file 'NUMPY=1': [Errno 2] No such file or directory
then further attempts to run trade.py would output nothing. Python 3.4.3 seemed to be still working, just TD wasn't doing anything, at least that I could determine. After puttering around I reset my TD Repository on Git and that resolved what ever my issue was.
you@bash$ NUMPY=1 python trade.py --help
hehe you inspire me to learn Python.
Being on Windows, trying to pass NUMPY = 1 before the call to trade.py just gives me an error![]()
C:\Dev\Trade\> set NUMPY=1
C:\Dev\Trade\> set NUMPY
NUMPY=1
C:\Dev\Trade\> trade.py ...
C:\Dev\Trade\> set NUMPY=
user@box:~/trade$ export NUMPY=1
user@box:~/trade$ trade.py ...
or
user@box:~/trade$ NUMPY=1 python trade.py ...
or
user@box:~/trade$ NUMPY=1 trade.py ...
If you built the thing as a web service plus client, hosting the service in the cloud would be pretty easy. I have some unused developer credit for Microsoft Azure; standing up a replicated service in the cloud wouldn't be hard and would get pretty good performance. (And since you have to have network connectivity to play ED at all, asking someone to have a live internet connection to use TD isn't a big stretch.)But I've also been pondering whether I would redo TD In C#, especially now that .NET is open source. The perf would be better than Python, there's a common GUI, and I've written a few small things in it (https://bitbucket.org/kfsone/houseomatic).
Heck, I'd even be okay with C++, since that's my current day-job language.
I'm vastly more comfortable in C++ than I am in Python, and unlike Python, C++ actually shows program flow using braces instead of indentation, the way the good Lord intended it to be shown.
if (foo.bar == x)
#{
print("It hurts, it hurts...");
#}
>>> pip.main(['install', '--upgrade', 'requests'])
>>> import requests
>>> help(requests)
>>> r = requests.get("http://kfs.org/td/thread")
>>> help(r)
>>> r.headers, r.history, r.status_code
An aside: Have you found anything good on 11/14/17? Most of what I've picked up sweats the small stuff - lambdas, rvalues, reference collapsing, but coverage of library changes in 11 and 14 seems to be vague handwavy and "well, don't you know about that?" e.g. traits, alias_t<T> vs traits<T>::type, etc.
If K is std::pair<T1, T2> then hash(K) is as simple as xor(rotate_left(hash(T1), 16), hash(T2))
- Biggest improvement in C++11 is move semantics. With proper thought applied in advance, and some judicious refactoring done after analysis, one can remove a whole lot of copying from the proceedings. The fact that the library containers handle move/rvalue/&& makes it all work.
- The emplace container methods also eliminate a lot of copying.
- The container iterator syntax [ for (const auto & foo : my_container) { ... } ] really makes iterators natural; code is a whole lot cleaner.
- You already mentioned lambdas. Combined with <functional>, I find state machines and similar constructs to be easily represented as declaratively-initialized data structures; my state table actually looks like a table, and it's implemented in an std::map<state_t, std::function<blahblah> > with some trivial driving code.
- The explicit-size datatypes (int32_t etc.) significantly improve code portability between Linux and Windows.
- Big chunks of Boost appeared in the C++11 library, which means deployment is much easier.
- Combine asio and timers and something like Microsoft's free cross-platform Casablanca library (async REST API), and stupid-fast client code for web services becomes pretty simple to write.
- Unicode support in C++14 will be a blessing, once everyone's implemented it.
- I'm not a big metaprogramming expert, but I'm all agog at what the brainiacs who understand that stuff can do.
All I can tell you is that the code I write under C++11 is more robust and bug-free than the stuff I wrote under C++98. I spend far less time screwing around with new/delete; the standard "smart pointers" really help with object lifetime management.
My biggest disappointment: unordered_map<K, V> just doesn't automagically handle an arbitrary type K which is a pair or tuple of simpler types for which std::hash is already defined.. It's just not that hard to have the library figure out the correct hashing function when it's trivially composable. (Ditto unordered_set, of course.)Code:If K is std::pair<T1, T2> then hash(K) is as simple as xor(rotate_left(hash(T1), 16), hash(T2))
#include <iostream>
#include <vector>
#include <map>
struct Thing {
Thing(const char* const name_) : m_name(name_) { std::cout << "created " << m_name << '\n'; }
Thing(const Thing& rhs_) : m_name(rhs_.m_name) { std::cout << "copied " << m_name << '\n'; }
Thing(Thing&& rhs_) : m_name(rhs_.m_name) { std::cout << "moved " << m_name << '\n'; rhs_.m_name = nullptr; }
Thing& operator = (const Thing& rhs_) { m_name = rhs_.m_name; std::cout << "=& " << m_name; return *this; }
Thing& operator = (Thing&& rhs_) { m_name = rhs_.m_name; std::cout << "=&& " << m_name; return *this; }
~Thing() { std::cout << "dtor(" << (m_name ? m_name : "null") << ")\n"; }
const char* m_name;
};
int main() {
std::map<int64_t, std::vector<Thing>> myMap { { 1, { "Hello", "World" } }, { 2, { "Eat", "Pizza" } } };
std::cout << "for\n";
for (auto kv : myMap) {
std::cout << "for " << kv.first << " -> " << kv.second[0].m_name << "\n";
}
std::cout << "endfor\n";
}
created Hello
created World
copied Hello
copied World
copied Hello
copied World
created Eat
created Pizza
copied Eat
copied Pizza
copied Eat
copied Pizza
copied Hello
copied World
copied Eat
copied Pizza
dtor(Eat)
dtor(Pizza)
dtor(Hello)
dtor(World)
dtor(Eat)
dtor(Pizza)
dtor(Pizza)
dtor(Eat)
dtor(Hello)
dtor(World)
dtor(World)
dtor(Hello)
for
v7.0.3 May 09 2015
. (kfsone) "run" command:
- Added "--show-jumps" (aka -J)
- Jumps are no-longer shown by default,
- Request #233 Jumps now include distance
- If start and end station of a hop are in the same system,
display "Supercruise to ..." instead of a jump
- When a hop involves multiple jumps using --show-jumps, it will
tell you the direct and total distances,
. (kfsone) Revamped the intro of the README.md (http://kfs.org/td/source)
. (gazelle) Corrected unicode system names (Argetlamh etc)