Commit 85ab884b authored by Amelie Royer's avatar Amelie Royer

Adding parameters e x and b to cmd line args

parent ba31cf76
......@@ -243,7 +243,9 @@ int main(int argc, char* argv[]) {
assert(("Unvalid discount parameter", discount > 0 && discount < 1));
int steps = ((argc > 3) ? std::atoi(argv[3]) : 1000000);
assert(("Unvalid steps parameter", steps > 0));
int precision = ((argc > 4) ? std::atoi(argv[4]) : 10);
float epsilon = ((argc > 4) ? std::atof(argv[4]) : 0.01);
assert(("Unvalid epsilon parameter", epsilon >= 0));
int precision = ((argc > 5) ? std::atoi(argv[5]) : 10);
assert(("Unvalid precision parameter", precision >= 0));
// Load model parameters
......@@ -275,10 +277,10 @@ int main(int argc, char* argv[]) {
// Solve
std::cout << current_time_str() << " - Init solver...!\n";
AIToolbox::MDP::ValueIteration<decltype(model)> solver(steps);
AIToolbox::MDP::ValueIteration<decltype(model)> solver(steps, epsilon);
std::cout << current_time_str() << " - Starting solver!\n";
auto solution = solver(model);
std::cout << current_time_str() << " - Convergence criterion reached: " << std::boolalpha << std::get<0>(solution) << "\n";
std::cout << current_time_str() << " - Convergence criterion e = " << epsilon << " reached ? " << std::boolalpha << std::get<0>(solution) << "\n";
elapsed = std::chrono::high_resolution_clock::now() - start;
double training_time = std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count() / 1000000.;
......
......@@ -275,10 +275,17 @@ int main(int argc, char* argv[]) {
assert(("Unvalid discount parameter", discount > 0 && discount < 1));
int steps = ((argc > 4) ? std::atoi(argv[4]) : 1000000);
assert(("Unvalid steps parameter", steps > 0));
int precision = ((argc > 5) ? std::atoi(argv[5]) : 10);
unsigned int horizon = ((argc > 5) ? std::atoi(argv[5]) : 1);
assert(("Unvalid horizon parameter", horizon > 0));
double epsilon = ((argc > 6) ? std::atof(argv[6]) : 0.01);
assert(("Unvalid convergence criterion", epsilon >= 0));
double exp = ((argc > 7) ? std::atof(argv[7]) : 10000);
assert(("Unvalid exploration parameter", exp >= 0));
unsigned int beliefSize = ((argc > 8) ? std::atoi(argv[8]) : 100);
assert(("Unvalid belief size", beliefSize >= 0));
int precision = ((argc > 9) ? std::atoi(argv[9]) : 10);
assert(("Unvalid precision parameter", precision >= 0));
unsigned int horizon = ((argc > 6) ? std::atoi(argv[6]) : 90);
assert(("Unvalid horizon parameter", horizon >= 0));
// Load model parameters
auto start = std::chrono::high_resolution_clock::now();
......@@ -312,10 +319,6 @@ int main(int argc, char* argv[]) {
std::cout << current_time_str() << " - Init " << algo << " solver...!\n";
// Evaluation
float exp = 10000;
size_t beliefSize = 100;
float epsilon = 0.1;
// POMCP
if (!algo.compare("pomcp")) {
AIToolbox::POMDP::POMCP<decltype(model)> solver(model, beliefSize, steps, exp);
......
#!/bin/bash
# PATHES
# PATHES (if local installation)
AIBUILD="/home/amelie/Libs/AI-Toolbox/build"
AIINCLUDE="/home/amelie/Libs/AI-Toolbox/include"
EIGEN="/usr/local/include/eigen3/"
......@@ -15,12 +15,15 @@ PLEVEL="4"
HIST="2"
DISCOUNT="0.95"
STEPS="1500"
EPSILON="0.01"
PRECISION="0"
BELIEFSIZE="100"
EXPLORATION="10000"
HORIZON="1"
COMPILE=false
# SET ARGUMENTS FROM CMD LINE
while getopts "m:d:n:k:g:s:p:h:c" opt; do
while getopts "m:d:n:k:g:s:p:h:e:x:b:c" opt; do
case $opt in
m)
MODE=$OPTARG
......@@ -46,6 +49,15 @@ while getopts "m:d:n:k:g:s:p:h:c" opt; do
h)
HORIZON=$OPTARG
;;
e)
EPSILON=$OPTARG
;;
b)
BELIEFSIZE=$OPTARG
;;
x)
EXPLORATION=$OPTARG
;;
c)
COMPILE=true
;;
......@@ -60,7 +72,6 @@ while getopts "m:d:n:k:g:s:p:h:c" opt; do
esac
done
echo $COMPILE
# SET CORRECT DATA PATHS
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ $DATA = "fm" ]; then
......@@ -99,7 +110,7 @@ if [ $MODE = "mdp" ]; then
# RUN
echo
echo "Running mainMDP on $BASE"
./mainMDP $BASE $DISCOUNT $STEPS $PRECISION
./mainMDP $BASE $DISCOUNT $STEPS $EPSILON $PRECISION
echo
# POMDPs
else
......@@ -119,6 +130,6 @@ else
# RUN
echo
echo "Running mainMEMDP on $BASE with $MODE solver"
./mainMEMDP $BASE $MODE $DISCOUNT $STEPS $PRECISION $HORIZON
./mainMEMDP $BASE $MODE $DISCOUNT $STEPS $HORIZON $EPSILON $EXPLORATION $BELIEFSIZE $PRECISION
echo
fi
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment