Node: The Node class

Description Details Slots Creating objects of type Node 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

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 Node. The default value will be caluclated randomly.

x:

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

y:

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

Creating objects of type Node

Creating an S4-Object

new("Node", ...)

Converting from a data.frame

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

Converting from a list

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

Methods

as.list(node, ...)

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

as.data.frame(node, ...)

Converts a Node 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.Node(obj)

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

is.Node(obj)

Checks if the object obj is of type Node.

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

Customer

This class extends the Node-Class with attributes for according to customers for OR-Problems.

Warehouse

This class extends the Node-Class with attributes for according to warehouses for OR-Problems.

Link

This class is constructed by two entities of the Node-Class representing the origin and destination of Link for OR-Problems.

To be used for

SPP

Shortest-Path-Problem

TSP

Travelling Salesman 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 Node with specific values
x<- new("Node", x= 10, y=20, id="myid", label = "mylabel")
x
# create from data.frame
df<- data.frame(x=10,y=20)
new("Node", df)
as(df, "Node")
as.Node(df)
#create some nodes
n1 <- new("Node",x=10,y=20, id ="n1")
n2 <- new("Node",x=13,y=24, id ="n1")
# 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.