-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IO: Start to refactor agent to/from_string
Created `agent_writer.hpp` to provide a more streamlined interface to agent parsing and output. Moved the `to_string` function out of agent Also changed the agent type of the DeGroot model, so that it contains the opinion as `agent.data.opinion`. Co-authored-by: Amrita Goswami <[email protected]>
- Loading branch information
1 parent
ee6e0f4
commit 6daca16
Showing
7 changed files
with
71 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
#include <fmt/format.h> | ||
|
||
namespace Seldon | ||
{ | ||
|
||
template<typename AgentT> | ||
std::string agent_to_string( const AgentT & agent ) | ||
{ | ||
static_assert( false, "Base implementation not valid" ); | ||
return ""; | ||
} | ||
|
||
template<typename AgentT> | ||
std::string opinion_to_string( const AgentT & agent ) | ||
{ | ||
return fmt::format( "{}", agent.data.opinion ); | ||
} | ||
|
||
} // namespace Seldon |
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