Customer: The Customer class

Description Details Slots Slots (from Node) Creating objects of type Customer Methods Derived Classes To be used for Note Author(s) See Also Examples

Description

This class is part of the HNUORTools. It represents the base class for every locateable class in an Operations-Research (OR)-context.

Details

Find here the defined slots for this class.

Slots

demand:

Object of class "numeric", containing the amount for the demand. The default value cannot be negative.

isDummy:

Object of class "logical", indicating if a customer was added in an algorithm (e.g. TPP-Column-Minimum-Method) in order to avoid degenerated soulutions.

Slots (from Node)

id:

Object of class "character", containing data from id. Should be unique. The default value will be caluclated randomly.

label:

Object of class "character", containing the label of the Customer. The default value will be caluclated randomly.

x:

Object of class "numeric", containing the x-coordinate of the Customer. The default value will be caluclated randomly.

y:

Object of class "numeric", containing the y-coordinate of the Customer. The default value will be caluclated randomly.

Creating objects of type Customer

Creating an S4-Object

new("Customer", ...)

Converting from a data.frame

as.Customer{<data.frame>} See also below in the Methods-Section.

Converting from a list

as.Customer{<list>} See also below in the Methods-Section.

Methods

as.list(Customer, ...)

Converts a Customer into a list. ... are user-defined (not used) parameters.

as.data.frame(Customer, ...)

Converts a Customer into a data.frame. as.data.frame accepts the optional parameter withrownames of class "logical" (default is TRUE). If withrownames == TRUE the returned data.frame will recieve the id as rowname. ... are user-defined (not used) parameters.

as.Customer(obj)

Converts an object of class data.frame or of class list into a Customer.

is.Customer(obj)

Checks if the object obj is of type Customer.

getDistance

Calculating the distance between two Nodes (As the classes Customer and Warehouse depend on Node, distances can be calculated between any of these objects).

getpolar

Calculating the polar-angle to the x-Axis of a link, connecting two Nodes (As the classes Customer and Warehouse depend on Node, polar-angles can be calculated between any of these objects).

Derived Classes

None.

To be used for

WLP

Warehouse-Location-Problem

TPP

Transportation Problem

VRP

Vehicle Routing Problem

Note

for citing use: Felix Lindemann (2014). HNUORTools: Operations Research Tools. R package version 1.1-0. http://felixlindemann.github.io/HNUORTools/.

Author(s)

Dipl. Kfm. Felix Lindemann felix.lindemann@hs-neu-ulm.de

Wissenschaftlicher Mitarbeiter Kompetenzzentrum Logistik Buro ZWEI, 17

Hochschule fur angewandte Wissenschaften Fachhochschule Neu-Ulm | Neu-Ulm University Wileystr. 1

D-89231 Neu-Ulm

Phone +49(0)731-9762-1437 Web www.hs-neu-ulm.de/felix-lindemann/ http://felixlindemann.blogspot.de

See Also

The classes are derived from this class and the following Methods can be used with this class.:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# create a new Customer with specific values
x<- new("Customer", x= 10, y=20, id="myid", label = "mylabel", demand = 20)
x
# create from data.frame
df<- data.frame(x=10,y=20, demand = 30)
new("Customer", df)
as(df, "Customer")
as.Customer(df)
#create some Customers
n1 <- new("Customer",x=10,y=20, demand = 30, id ="n1")
n2 <- new("Customer",x=13,y=24, demand = 40, id ="n2")
# calculate Beeline distance
#getDistance(n1,n2) # should result 5
#getDistance(n1,n2, costs = 2) # should result 10

felixlindemann/HNUORTools documentation built on May 8, 2019, 6:46 p.m.