Skip to content

Commit

Permalink
I really need to change all the int types in this program
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayden-F committed Nov 13, 2023
1 parent c7f6555 commit bcf6d1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions inc/Instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
class Instance
{
public:
uint64_t num_of_cols;
uint64_t num_of_rows;
uint64_t map_size;
int num_of_cols;
int num_of_rows;
int map_size;

// enum valid_moves_t { NORTH, EAST, SOUTH, WEST, WAIT_MOVE, MOVE_COUNT }; // MOVE_COUNT is the enum's size

Expand Down Expand Up @@ -55,13 +55,13 @@ class Instance
{
assert(loc >= 0 && loc < map_size && !my_map[loc]);
int degree = 0;
if (0 <= loc - num_of_cols && !my_map[loc - num_of_cols])
if (0 <= (loc - num_of_cols) && !my_map[loc - num_of_cols])
degree++;
if (loc + num_of_cols < map_size && !my_map[loc + num_of_cols])
if ((loc + num_of_cols) < map_size && !my_map[loc + num_of_cols])
degree++;
if (loc % num_of_cols > 0 && !my_map[loc - 1])
if ((loc % num_of_cols) > 0 && !my_map[loc - 1])
degree++;
if (loc % num_of_cols < num_of_cols - 1 && !my_map[loc + 1])
if ((loc % num_of_cols) < (num_of_cols - 1) && !my_map[loc + 1])
degree++;
return degree;
}
Expand Down
2 changes: 1 addition & 1 deletion src/LNS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ LNS::LNS(const Instance &instance, double time_limit, const string &init_algo_na
bool LNS::run()
{
// only for statistic analysis, and thus is not included in runtime
memory_pool.init(instance.map_size * (planning_horizon + 1));
memory_pool.init(static_cast<uint64_t>(instance.map_size) * (static_cast<uint64_t>(planning_horizon) + 1));
sipp_intervals = SIPPIntervals(instance.map_size);

sum_of_distances = 0;
Expand Down

0 comments on commit bcf6d1b

Please sign in to comment.