| solve_mwcsp | R Documentation |
Generic function for solving MWCS instances using solvers collected in the package.
solve_mwcsp(solver, instance, ...)
## S3 method for class 'virgo_solver'
solve_mwcsp(solver, instance, ...)
## S3 method for class 'rmwcs_solver'
solve_mwcsp(solver, instance, max_cardinality = NULL, budget = NULL, ...)
## S3 method for class 'rnc_solver'
solve_mwcsp(solver, instance, ...)
## S3 method for class 'simulated_annealing_solver'
solve_mwcsp(solver, instance, warm_start, ...)
## S3 method for class 'scipjack_solver'
solve_mwcsp(solver, instance, ...)
solver |
a solver object returned by rmwcs_solver, annealing_solver, rnc_solver or virgo_solver. |
instance |
an MWCS instance, an igraph object with problem-related vertex, edge and graph attributes. See details. |
... |
other arguments to be passed. |
max_cardinality |
integer maximum number of vertices in solution. |
budget |
numeric maximum budget of solution. |
warm_start |
warm start solution, an object of the class mwcsp_solution. |
MWCS instance here is represented as an undirected graph, an igraph object.
The package supports four types of instances: Simple MWCS, Generalized MWCS,
Budget MWCS, signal MWCS problems. All the necessary weights and costs are
passed by setting vertex and edge attributes. See get_instance_type to check
if the igraph object is a correct MWCS instance. For Simple MWCS problem
numeric vertex attribute weight must be set. For generalized version weights
can be provided for edges. For budget version of the problem in addition to
vertex weights it is required that igraph object would have budget_cost vertex
attribute with positive numeric values.
Signal MWCS instance is quite different. There is no weight attribute for
neither vertices nor edges. Instead, vertex and edge attribute signal should
be provided with signal names. A numeric vector containing weights for the signals
should be assigned to graph attribute signals.
See vignette for description of the supported problems. See igraph package
documentation for more details about getting/setting necesasry attributes.
An object of class mwcsp_solution consisting of resulting subgraph,
its weight and other information about solution provided.
library(igraph)
# for a MWCS instance
data(mwcs_example)
head(V(mwcs_example)$weight)
# for a GMWCS instance
data(gmwcs_example)
head(E(gmwcs_example)$weight)
# for a SGMWCS instance
data(sgmwcs_example)
head(V(sgmwcs_example)$signal)
head(E(sgmwcs_example)$signal)
head(sgmwcs_example$signals)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.