-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #388 from ozmorph/assign_people_to_places_optimiza…
…tion US Regression Test Optimization
- Loading branch information
Showing
15 changed files
with
113 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
#pragma once | ||
|
||
#include "Direction.hpp" | ||
#include "Error.h" | ||
|
||
class MicroCellPosition { | ||
public: | ||
struct MicroCellPosition | ||
{ | ||
int x; | ||
int y; | ||
|
||
MicroCellPosition operator+(Direction direction) const; | ||
MicroCellPosition& operator+=(Direction direction); | ||
inline MicroCellPosition& operator+=(Direction direction) | ||
{ | ||
switch (direction) { | ||
case Right: this->x += 1; break; | ||
case Up: this->y -= 1; break; | ||
case Left: this->x -= 1; break; | ||
case Down: this->y += 1; break; | ||
default: ERR_CRITICAL("Unknown direction"); | ||
} | ||
return *this; | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,20 @@ | ||
#include "Param.h" | ||
|
||
int Param::get_number_of_micro_cells_wide() const { | ||
return this->ncw * this->NMCL; | ||
} | ||
|
||
int Param::get_number_of_micro_cells_high() const { | ||
return this->nch * this->NMCL; | ||
} | ||
|
||
MicroCellPosition Param::get_micro_cell_position_from_cell_index(int cell_index) const { | ||
int x = cell_index / this->get_number_of_micro_cells_high(); | ||
int y = cell_index % this->get_number_of_micro_cells_high(); | ||
int x = cell_index / this->total_microcells_high_; | ||
int y = cell_index % this->total_microcells_high_; | ||
return {x, y}; | ||
} | ||
|
||
bool Param::is_in_bounds(MicroCellPosition position) const { | ||
bool Param::is_in_bounds(MicroCellPosition const& position) const { | ||
return position.x >= 0 | ||
&& position.y >= 0 | ||
&& position.x < this->get_number_of_micro_cells_wide() | ||
&& position.y < this->get_number_of_micro_cells_high(); | ||
&& position.x < this->total_microcells_wide_ | ||
&& position.y < this->total_microcells_high_; | ||
} | ||
|
||
int Param::get_micro_cell_index_from_position(MicroCellPosition position) const { | ||
int x = (position.x + this->get_number_of_micro_cells_wide()) % this->get_number_of_micro_cells_wide(); | ||
int y = (position.y + this->get_number_of_micro_cells_high()) % this->get_number_of_micro_cells_high(); | ||
return x * this->get_number_of_micro_cells_high() + y; | ||
int Param::get_micro_cell_index_from_position(MicroCellPosition const& position) const { | ||
int x = (position.x + this->total_microcells_wide_) % this->total_microcells_wide_; | ||
int y = (position.y + this->total_microcells_high_) % this->total_microcells_high_; | ||
return x * this->total_microcells_high_ + y; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.