Learn R Programming

coopProductGame (version 2.0)

productLinearProblem: Linear production programming problems

Description

Given a linear production programming problem A %*% x <= b, the productLinearProblem solves the problem by making use of lpSolveAPI.

Usage

productLinearProblem(c, A, b, plot = FALSE, show.data = FALSE)

Arguments

c

vector of benefits.

A

production matrix.

b

vector of resources.

plot

logical value indicating if the function displays graphical solution (TRUE) or not (FALSE). Note that this option only makes sense when we have a two-dimension problem.

show.data

logical value indicating if the function displays the console output (TRUE) or not (FALSE). By default the value is TRUE.

Value

productLinearProblem returns and prints a list with the following components:

ObjetiveValue Value of the objetive function from a successfully solved linear production programming problem.

OptimalSolution Values of the variables from a successfully solved linear production programming problem.

Examples

Run this code
# NOT RUN {
# Vector of benefits
c <- c(68,52)
# Production matrix
A <- matrix(c(4,5,6,2),ncol=2, byrow = TRUE)
# Matrix of resources. Each row is the vector of resources of each player
b <- c(4,33)
# Solution of the associated linear production game
productLinearProblem(c,A,b, show.data = TRUE)

# ------------------------------------------------------------------------
# Objetive value: 
# ------------------------------------------------------------------------
#   [1] "Z = 68"
# 
# ------------------------------------------------------------------------
# Optimal solution: 
# ------------------------------------------------------------------------
#   [1] 1 0
# ------------------------------------------------------------------------
  
# }

Run the code above in your browser using DataLab