# submodular#

## Structs#

### GraphConstraint#

struct GraphConstraint : public ioh::problem::Constraint<int>#

Specific constraints function for submodular problems.

Public Functions

inline GraphConstraint(const std::shared_ptr<graph::Graph> &graph)#

Construct a new Graph Constraint object.

Parameters:

graph – A shared ptr to a graph

inline virtual bool compute_violation(const std::vector<int> &x) override#

Compute constraint violation.

Parameters:

x – the candidate solution

Returns:

true when there is constraint violation

Returns:

false when there is no constraint violaton

inline double penalty() const override#

Compute the penalty by scaling the violotation.

inline virtual std::string repr() const override#

String representation.

Public Members

std::shared_ptr<graph::Graph> graph#

Shared ptr to the graph in memory.

### GraphProblem#

struct GraphProblem : public ioh::problem::SingleObjectiveProblem<int>#

Implementation of the Graph Problem.

Public Functions

inline GraphProblem(const int problem_id, const int instance, const std::string &name, const std::shared_ptr<graph::Graph> &graph)#

Construct a new Graph Problem object.

Parameters:
• problem_id – the id of the problem

• instance – the instance id

• name – the name of the problem

• graph – the graph data

Public Members

std::shared_ptr<graph::Graph> graph#

Shared ptr to the graph in memory.

### GraphProblemType#

template<typename ProblemType>
struct GraphProblemType : public ioh::problem::submodular::GraphProblem, public ioh::problem::InstanceBasedProblem, public ioh::common::AutomaticTypeRegistration<ProblemType, IntegerSingleObjective>, public ioh::common::AutomaticTypeRegistration<ProblemType, GraphProblem>#

Graph Problem Type.

Public Functions

inline GraphProblem(const int problem_id, const int instance, const std::string &name, const std::shared_ptr<graph::Graph> &graph)#

Construct a new Graph Problem object.

Parameters:
• problem_id – the id of the problem

• instance – the instance id

• name – the name of the problem

• graph – the graph data

Public Static Functions

template<typename G = graph::Graph>
static inline Constructors<ProblemType, int, int> get_constructors(const fs::path &path)#

Get the constructors used in explicit specialization of load_isntances method if InstanceBasedProblem.

Parameters:

path

Returns:
template<typename ...Args>
static inline void load_graph_instances(const fs::path &path)#

Helper to load problems from a file.

### MaxCoverage#

struct MaxCoverage : public ioh::problem::submodular::GraphProblemType<MaxCoverage>#

Max Coverage problem definition.

Public Functions

inline MaxCoverage(const int problem_id, const int, const std::shared_ptr<graph::Graph> &graph)#

Construct a new MaxCoverage object.

Suggested usage is via the factory. If you want to create your own objects, please be sure to pass a correct graph instance.

Parameters:
• problem_id – the id to the problem

• graph – the graph object on which to operate

inline double evaluate(const std::vector<int> &x) override#

Evaluate function for MaxCoverage.

Public Members

std::vector<uint8_t> is_covered#

The vector of convered points.

Public Static Attributes

static int default_id = 2100#

### MaxCut#

struct MaxCut : public ioh::problem::submodular::GraphProblemType<MaxCut>#

Public Functions

inline MaxCut(const int problem_id, const int, const std::shared_ptr<graph::Graph> &graph)#

Construct a new MaxCut object.

Suggested usage is via the factory. If you want to create your own objects, please be sure to pass a correct graph instance.

Parameters:
• problem_id – the id to the problem

• graph – the graph object on which to operate

inline double evaluate(const std::vector<int> &x) override#

Evaluate function.

Public Static Attributes

static int default_id = 2000#

### MaxInfluence#

struct MaxInfluence : public ioh::problem::submodular::GraphProblemType<MaxInfluence>#

MaxInfluence problem definition.

Public Functions

inline MaxInfluence(const int problem_id, const int, const std::shared_ptr<graph::Graph> &graph)#

Construct a new MaxInfluence object.

Suggested usage is via the factory. If you want to create your own objects, please be sure to pass a correct graph instance.

Parameters:
• problem_id – the id to the problem

• graph – the graph object on which to operate

Random process to compute the spread of x.

Parameters:

x – the candidate solutions

Returns:

inline double evaluate(const std::vector<int> &x) override#

MaxInfluence evaluate function.

Public Members

int simulation_reps = 100#

The number of repetitions to used for random_spread_count.

std::vector<uint8_t> is_activated#

Vector of activations.

Public Static Attributes

static int default_id = 2200#

### PackWhileTravel#

struct PackWhileTravel : public ioh::problem::submodular::GraphProblemType<PackWhileTravel>#

PWT problem definition.

Public Functions

inline PackWhileTravel(const int problem_id, const int, const std::shared_ptr<pwt::TTPGraph> &graph)#

Construct a new PackWhileTravel object.

Suggested usage is via the factory. If you want to create your own objects, please be sure to pass a correct graph instance.

Parameters:
• problem_id – the id to the problem

• graph – the graph object on which to operate

inline double evaluate(const std::vector<int> &x) override#

Evaluate the problem.

Parameters:

x – the candidate solution

Returns:

double the raw problem value

Public Static Attributes

static int default_id = 2300#