Assignment Question:

Build a report for LP Brewery telling them all the information from their new problem with Grape Soda and their previous problem before implementing Grape Soda. Use at least 3 markdown techniques

Solution:

Load library

library(lpSolve)

Assign the Objective

objective_coeff = c(13,23,30)

Assign Constrains

constrains= matrix(c(
  5,15,10,
  4,4,4,
  35,20,15,
  5,10,20
  
  ),
  
  nrow = 4, byrow = TRUE)

Assign Direction

direction = c('<=',
              '<=',
              '<=',
              '<=')

Assign Resources

resources = c(480,
              160,
              1190,
              800)

Start Solving

solve = lp(
  direction = 'max',
  objective.in = objective_coeff,
  const.mat = constrains,
  const.dir = direction,
  const.rhs = resources)

The Total Profit is

solve$objval
## [1] 1200

Best values for x1, x2 and x3

solve$solution
## [1]  0  0 40

so as seen the best option is Grape

github