Commit 13805843 authored by Weigert, Andreas's avatar Weigert, Andreas
Browse files

added exercise file

parent ba9d6eb8
---
title: 'Tutorial 14: Optimization'
output: html_notebook
editor_options:
chunk_output_type: inline
---
This file is part of the lecture Business Intelligence & Analytics (EESYS-BIA-M), Information Systems and Energy Efficient Systems, University of Bamberg.
```{r}
library(lpSolve)
library(ggplot2)
```
```{r lpSolve default example}
#
# Set up problem: maximize
# x1 + 9 x2 + x3 subject to
# x1 + 2 x2 + 3 x3 <= 9
# 3 x1 + 2 x2 + 2 x3 <= 15
#
objective.in <- c(1, 9, 1)
const.mat <- matrix(c(1, 2, 3, 3, 2, 2), nrow=2, byrow=TRUE)
f.dir <- c("<=", "<=")
const.rhs <- c(9, 15)
direction <- "max"
lp(direction, objective.in, const.mat, f.dir, const.rhs)
lp(direction, objective.in, const.mat, f.dir, const.rhs)$solution
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment