Free-form topology#

New in version 2.15.

#include <pagmo/topologies/free_form.hpp>

class free_form : public base_bgl_topology#

This user-defined topology (UDT) represents a graph in which vertices and edges can be manipulated freely. It is implemented as a simple extension of base_bgl_topology in which the push_back() function adds a vertex without connections.

free_form()#

Default constructor.

The default constructor initialises an empty topology.

free_form(const free_form&)#
free_form(free_form&&) noexcept#

Copy and move constructors.

explicit free_form(bgl_graph_t g)#

Constructor from a bgl_graph_t.

The internal graph of the topology will be set to g.

Parameters

g – the graph that will be used to initialise this.

Throws

std::invalid_argument – if any edge in the graph has a weight outside the \(\left[ 0, 1 \right]\) range.

explicit free_form(const topology &t)#
template<typename T>
explicit free_form(const T &t)#

Note

The constructor from T does not participate in overload resolution if T is free_form or if T does not satisfy is_udt.

Constructors from a topology or a UDT.

These constructors will first invoke the pagmo::topology::to_bgl() function to extract a graph representation of the input topology or UDT, and will then use that graph object to initialise this free_form object via the constructor from bgl_graph_t.

In other words, these constructors allow to copy the graph of a topology or a UDT into this.

Parameters

t – the input topology or UDT.

Throws

unspecified – any exception raised by the construction of a topology object, the invocation of the pagmo::topology::to_bgl() function or by the constructor from bgl_graph_t.

void push_back()#

Add a new vertex.

The newly-added vertex will not be connected to any other vertex.

Throws

unspecified – any exception thrown by the public API of base_bgl_topology.

std::string get_name() const#

Get the name of the topology.

Returns

"Free form".