Go to the documentation of this file.00001
00007
00008
00009
00010 #include "Controller.h"
00011 #include "GlobalResource.h"
00012 #include "MOMDP.h"
00013 #include "ParserSelector.h"
00014 #include "AlphaVectorPolicy.h"
00015 #include <iostream>
00016 using namespace std;
00017
00018 int main(int argc, char **argv)
00019 {
00020 SolverParams* p = &GlobalResource::getInstance()->solverParams;
00021 bool parseCorrect = SolverParams::parseCommandLineOption(argc, argv, *p);
00022
00023 if (p->policyFile == "") {
00024 cout<<"Invalid params\n";
00025 return 0;
00026 }
00027
00028 cout<<"\nLoading the model ...\n ";
00029 SharedPointer<MOMDP> problem = ParserSelector::loadProblem(p->problemName, *p);
00030
00031 SharedPointer<AlphaVectorPolicy> policy = new AlphaVectorPolicy(problem);
00032
00033 cout<<"\nLoading the policy ... input file : "<<p->policyFile<<"\n";
00034 bool policyRead = policy->readFromFile(p->policyFile);
00035
00036 if (p->useLookahead) {
00037 cout<<" action selection : one-step look ahead\n";
00038 }
00039
00040 Controller control(problem, policy, p, -1);
00041
00042 cout<<"\nInitialized the controller\n";
00043
00044
00045
00046 int firstAction = control.nextAction(1, 0);
00047 cout<<"\nFirst action : "<<firstAction<<endl;
00048
00049
00050 int action = control.nextAction(0, 0);
00051 cout<<"Obs-left => Action : "<<action<<endl;
00052
00053 action = control.nextAction(0, 0);
00054 cout<<"Obs-left => Action : "<<action<<endl;
00055
00056 action = control.nextAction(1, 0);
00057 cout<<"\nReset ...\nFirst action : "<<action<<endl;
00058
00059 action = control.nextAction(1, 0);
00060 cout<<"Obs-right => Action : "<<action<<endl;
00061
00062 action = control.nextAction(1, 0);
00063 cout<<"Obs-right => Action : "<<action<<endl;
00064
00065 return 0;
00066 }