Learn R Programming

MDP2 (version 2.1.2)

convertHMP2Binary: Convert a HMDP model stored in a hmp (xml) file to binary file format.

Description

The function simply parse the hmp file and create binary files using the binaryMDPWriter().

Usage

convertHMP2Binary(file, prefix = "", getLog = TRUE)

Value

NULL (invisible).

Arguments

file

The name of the HMP file (e.g. r.hmp).

prefix

A character string with the prefix which will be added to the binary files.

getLog

Output log text.

See Also

binaryMDPWriter().

Examples

Run this code
## Set working dir
wd <- setwd(system.file("models", package = "MDP2"))

## Convert the machine example to a hmp file
prefix1 <- "machine1_"
getBinInfoStates(prefix1)
convertBinary2HMP(prefix1, duration = NULL)
# have a look at the hmp file
cat(readr::read_file("machine1_converted.hmp"))

## Convert the machine example hmp file to binary files
prefix2 <- "machine_cov_"
convertHMP2Binary("machine1.hmp", prefix2)
getBinInfoStates(prefix2)
## Convert the machine example with a single dummy node to a hmp file
#convertBinary2HMP("machine2_")  # error since using scope = 3 not supported in hmp files

## Reset working dir
setwd(wd)

Run the code above in your browser using DataLab