score_solution: compute the price of a partition solution (and check is...

View source: R/utils.R

score_solutionR Documentation

compute the price of a partition solution (and check is valid).

Description

compute the price of a partition solution (and check is valid).

Usage

score_solution(x, solution)

Arguments

x

NumericMatix, for j>=i x(i,j) is the cost of partition element [i,...,j] (inclusive).

solution

vector of indices

Value

price

Examples


x <- matrix(c(1,1,5,1,1,0,5,0,1), nrow=3)
s <- c(1, 2, 4)
score_solution(x, s)


RcppDynProg documentation built on Aug. 20, 2023, 9:07 a.m.