getRestrictions: Get restrictions by indices

Description Usage Arguments Value See Also Examples

View source: R/problem.R

Description

This function gets restrictions by indices.

Usage

1
getRestrictions(problem, indices)

Arguments

problem

Problem whose restrictions will be searched.

indices

A vector of restriction indices (eg. a result of calling getPreferentialCore.) Incorrect indices are skipped.

Value

List with named elements. Each element is a matrix which contains set of restrictions of same type.

See Also

getPreferentialCore explainAssignment

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
perf <- matrix(c(5, 2, 1, 7, 0.5, 0.9, 0.4, 0.5), ncol = 2)
problem <- buildProblem(perf, 3, FALSE, c('g', 'g'), c(0, 0))
problem <- addAssignmentsLB(problem, c(1, 2), c(2, 3))

possibleAssignments <- calculateAssignments(problem, FALSE)
alternative <- 4
assignment <- c(min(which(possibleAssignments[alternative, ])),
               max(which(possibleAssignments[alternative, ])))

preferentialReducts <- explainAssignment(alternative,
   assignment, problem)
preferentialCore <- getPreferentialCore(preferentialReducts)
coreRestrictions <- getRestrictions(problem, preferentialCore)

rorutadis documentation built on May 2, 2019, 8:51 a.m.