Bdo Co1 Session 2
Bdo Co1 Session 2
Bdo Co1 Session 2
TOPIC :
Representation of solution in R
Session - 2
AIM OF THE SESSION
The aim of a session on "Representation of solution in R" is to teach participants how to effectively communicate and
visualize solutions to problems using the R programming language.
INSTRUCTIONAL OBJECTIVES
LEARNING OUTCOMES
Vectors: Vectors are one-dimensional data structures that can hold elements of the same data type. You
can represent a solution as a vector of values. For example, if you are solving a linear programming
problem, the solution could be a vector of optimal variable values.
Matrices and Data Frames: For more complex problems, you might use matrices or data frames to
represent solutions. For instance, if you are dealing with a dataset, the solution could be a data frame
with rows representing observations and columns representing variables.
2. Lists:
Lists are versatile data structures in R that can hold elements of different data types. You can use lists
to represent complex solutions that consist of various components. For example, you might have a list
with components representing different aspects of your solution.
3. Functions:
Functions are essential in R for solving problems. You can encapsulate a solution in a custom function.
This function can take inputs, perform computations, and return results. It's a way to modularize and
document your solution.
4. Packages:
R has a rich ecosystem of packages that provide specialized functions and tools for solving specific
problems. You can use these packages to implement your solution efficiently. Some popular packages
include:
You can create custom objects to represent your solutions. These objects can
encapsulate the data and methods specific to your problem domain. For instance, if
you are working on a statistical analysis, you might create custom objects to hold the
results, such as regression model objects.
In some cases, your solution might involve data analysis and visualization. You can
use tools like the ggplot2 package to create visual representations of your results and
insights.
7. Report Generation:
R Markdown is a powerful tool for generating reports that document your solutions. You
can combine R code, text, and visualizations in a single document to present your results
and methodology.
Here's a basic example of how you might represent a solution in R:
# Perform computations
return(result)
}
# Call the function with input data
print(solution)
Evaluation Function
Another important decision for handling optimization tasks is the definition of the
evaluation function, which should translate the desired goal (or goals) to be
maximized or minimized.
When considering numeric functions, the shape can be convex or non-convex, with
several local minima/maxima.
Constraints
Hard constraints cannot be violated and are due to factors such as laws or
physical restrictions.
Soft constraints are related with other (often non-priority) user goals, such
as increasing production efficiency while reducing environmental costs.
Optimization Methods
1. sum of bits:
2. max sin:
REFERENCES FOR FURTHER LEARNING OF THE SESSION
Text Books :
:1. Paulo Cortez, “Modern Optimization with R “ Springer, (2014). 2. Nicholas J. Horton & Ken
Klein man, “ Using R and R Studio for Data Management, Statistical Analysis, and Graphics”,
SecondEdition , CRC Press, (2015).
Reference Books :
:1. Carlo Zaniolo, “Advanced database systems”, Morgan Kaufmann, Elsevier, (1997). 2.Jan L.
Harrington, “Relational Database Design”, Morgan Kaufmann, Elsevier, (2009).
Web Links :
:1. https://youtube.videoken.com/embed/ahXszIXr1NE?
rel=1&color1=0xcbba9f&color2=0xcbba9f&border=0&fs=1 2.
https://nptel.ac.in/courses/106/102/106102064/
TERMINAL QUESTIONS
Team – DWDM