I'm finally done with the first working version, so here are some results:
The approach I took is similar to the one here, using the general idea the silent one described, implemented using the algorithm I added. There are some parts that aren't quite finished yet, for simplicity the current demands are just the different tech categories, and their values are static, and the value of each tech is just determined by the type, (I figured refinements are probably the most desireable, because they need no additional investments, followed by applications and lastly theories, whose values only lie in the techs they unlock) and their costs and research time (currently unnoticeable, but I've done tests changing the techs.txt)
Given the nature of the research AI, I have no graphical proof that it works, but there is enough output to the log to see whats going on. Interestingly with all techs at 1 RP/ 1 turn, the last tech gets researched at the end of turn 15, which is nearly optimal, considering there are 131 techs, so it is only one turn of.
I've already found some things I'd like to change, but for now this version is definitively working so I thought I'd get some opinions first.
By the way, is it possible to make the TechManager class visible to python, since I haven't found a way to access the names of unresearched techs and had to include them manually as a list extracted from techs.txt. Also I am missing a function like the totalSpent for the production queue, the equivalent exists in the c++ code, but isn't included in PythonEmpireWrapper.cpp.
So, could someone tell me all the things I did wrong , correct them and upload the file to the svn (and add import statement and function call to FreeOrionAI.py)?
research AI
Moderator: Committer
research AI
- Attachments
-
- ResearchAI.zip
- (2.67 KiB) Downloaded 98 times
- The Silent One
- Graphics
- Posts: 1129
- Joined: Tue Jul 01, 2003 8:27 pm
Re: research AI
Nice. I'll look into this some time next week.
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13587
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: research AI
http://freeorion.svn.sourceforge.net/vi ... threv=2416m_k wrote:By the way, is it possible to make the TechManager class visible to python, since I haven't found a way to access the names of unresearched techs and had to include them manually as a list extracted from techs.txt. Also I am missing a function like the totalSpent for the production queue, the equivalent exists in the c++ code, but isn't included in PythonEmpireWrapper.cpp.
Re: research AI
Thanks, but I seem to be missing something, since it is in the same scope as for example getTech, I try to call the function the same way, but calling fo.techs() just gets me:Geoff the Medio wrote:http://freeorion.svn.sourceforge.net/vi ... threv=2416m_k wrote:By the way, is it possible to make the TechManager class visible to python, since I haven't found a way to access the names of unresearched techs and had to include them manually as a list extracted from techs.txt. Also I am missing a function like the totalSpent for the production queue, the equivalent exists in the c++ code, but isn't included in PythonEmpireWrapper.cpp.
Code: Select all
2008-03-23 12:50:55,421 DEBUG AI : Traceback (most recent call last):
2008-03-23 12:50:55,421 DEBUG AI : File "C:\Dokumente und Einstellungen\Eins\Desktop\FreeOrion_SDK\FreeOrion\default\AI\FreeOrionAI.py", line 91, in generateOrders
2008-03-23 12:50:55,421 DEBUG AI : ResearchAI.generateResearchOrders()
2008-03-23 12:50:55,421 DEBUG AI : File "C:\Dokumente und Einstellungen\Eins\Desktop\FreeOrion_SDK\FreeOrion\default\AI\ResearchAI.py", line 14, in generateResearchOrders
2008-03-23 12:50:55,421 DEBUG AI : technames = fo.techs()
2008-03-23 12:50:55,421 DEBUG AI : Boost.Python.ArgumentError: Python argument types in
2008-03-23 12:50:55,421 DEBUG AI : freeOrionAIInterface.techs()
2008-03-23 12:50:55,421 DEBUG AI : did not match C++ signature:
2008-03-23 12:50:55,421 DEBUG AI : techs(class TechManager {lvalue})
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13587
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: research AI
It's a bug... I'm trying to call a member function like it was static or a free function. The TechManager::TechNames functions need a TechManager pointer passed to function properly. I'll whip up some boost::bind to deal with it...m_k wrote:Is this an actual bug or am I just calling the function in the wrong way.
Edit: Try again with the latest SVN please...