Class graph::Face
Base representation of a face.
A face consists of a (face) type, a weight cost, and a list of component edge IDs
Constructors
Face()
Default constructor for an empty face.
Declaration
graph::Face<Cost>::Face()
Face()
Constructor with type.
Declaration
graph::Face<Cost>::Face(const FaceType type)
Face()
Constructor with cost.
Declaration
graph::Face<Cost>::Face(const Cost c)
Face()
Constructor with type and cost.
Declaration
graph::Face<Cost>::Face(const FaceType type, const Cost c)
Face()
Constructor with edge ID list initialization.
Declaration
graph::Face<Cost>::Face(const std::vector<int>&edge_ids)
Face()
Constructor with type, cost, and edge ID list initialization.
Declaration
graph::Face<Cost>::Face(const FaceType type, const Cost c, const std::vector<int>&edge_ids)
Methods
edge_ids()
Accessor for the list of edge IDs.
Declaration
const std::vector<int>&graph::Face<Cost>::edge_ids() const
type()
Accessor for face type.
Declaration
const FaceType&graph::Face<Cost>::type() const
cost()
Accessor for the cost.
Declaration
Cost graph::Face<Cost>::cost() const
set_cost()
Setter for the cost.
Declaration
void graph::Face<Cost>::set_cost(Cost cost)
sort_edge_ids()
Order the list of edge IDs ascendingly.
Declaration
void graph::Face<Cost>::sort_edge_ids()
add_edge_id()
Append an edge ID to the end of the edge ID list.
Declaration
void graph::Face<Cost>::add_edge_id(int edge_id)
remove_edge_id()
Find and remove an edge ID from the edge ID list.
Declaration
void graph::Face<Cost>::remove_edge_id(int edge_id)
configure()
Serialize the face.
Declaration
void graph::Face<Cost>::configure(const utils::Json&json) override
render()
render the object in structured form
Return a structured representation of the object. This is intended for output purposes. For instance, the solution your solver finds should have a render method which allows it to be returned as part of the result. Example:
{c++}
MySolution : public Component {
public:
// Represent the internal bool vector as +-1 output.
utils::Structure render() const override {
utils::Structure rendered;
for (bool item : solution_) rendered.push_back(item ? 1 : -1);
return rendered;
}
private:
std::vector<bool> solution_;
}
MySolution solution;
std::cout << solution.render().to_string() << std::endl;
Declaration
utils::Structure graph::Face<Cost>::render() const override
get_status()
get_status shows a simplified state representation
Like render
, this produces a structured representation of the object's state. However, it is intended to be simpler in nature with the purpose of rendering the object during stream-output and logging. By default, it will fall back to the full render
, but overloading this allows distinguising how the object looks during LOG vs full output.
Declaration
utils::Structure graph::Face<Cost>::get_status() const override
rescale()
Declaration
void graph::Face<Cost>::rescale(double scale_factor)
edges_count()
Declaration
size_t graph::Face<Cost>::edges_count() const
memory_estimate()
Declaration
static size_t graph::Face<Cost>::memory_estimate(size_t num_edges)