net.sourceforge.combean.graph.alg.lp
Class GraphAsLPModelColumns

Package class diagram package GraphAsLPModelColumns
java.lang.Object
  extended by net.sourceforge.combean.graph.alg.lp.GraphAsLPModelColumns
All Implemented Interfaces:
AbstractMatrix, LPModelColumns, LPModelComponent

public class GraphAsLPModelColumns
extends Object
implements LPModelColumns

Converts a graph into an LP model based on the incidence matrix, i.e., the rows correspond to the nodes and the columns correspond to the edges. The entry (v,e) is set to -1 if edge e is an outgoing edge of v, set to 1 if edge e is an incoming edge of v and zero otherwise. The orientation of the resulting LP component is columnwise.


Field Summary
protected  String nodeRowsOffsetId
           
 
Constructor Summary
GraphAsLPModelColumns(String edgeColumnsOffsetId, String nodeRowOffsetId, Graph g)
          Constructor.
 
Method Summary
 LPModelIndex getColumnModelIndex(int localColumn)
          Convert a local index into a model index.
 Iterator getColumnOffsetIds()
          Get an iterator through all column offset ids used by the component.
 LPSparseVector getColumnVector(int localColumn)
           
 String getNodeRowsOffsetId()
           
 int getNumColumns()
          Return the number of columns of the model component.
 int getNumRows()
          Return the number of rows of the model component.
 VectorOrientation getOrientation()
          Get the orientation how the component shall be inserted into the global model (either row-by-row or column-by-column).
 LPModelIndex getRowModelIndex(int localRow)
           
 Iterator getRowOffsetIds()
          Get an iterator through all row offset ids used by the component.
 void setEdgeColumnsOffsetId(String edgeColumnsOffsetId)
           
 void setNodeRowsOffsetId(String nodeRowsOffsetId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeRowsOffsetId

protected String nodeRowsOffsetId
Constructor Detail

GraphAsLPModelColumns

public GraphAsLPModelColumns(String edgeColumnsOffsetId,
                             String nodeRowOffsetId,
                             Graph g)
Constructor. The graph must possess the neighborhood graph property and the global numbered graph property. The edges are considered to be directed.

Parameters:
g - The graph to be represented by the LP model.
Method Detail

getColumnVector

public LPSparseVector getColumnVector(int localColumn)
Specified by:
getColumnVector in interface LPModelColumns

getNumColumns

public int getNumColumns()
Description copied from interface: AbstractMatrix
Return the number of columns of the model component.

Specified by:
getNumColumns in interface AbstractMatrix
Returns:
the number of columns.

getNumRows

public int getNumRows()
Description copied from interface: AbstractMatrix
Return the number of rows of the model component.

Specified by:
getNumRows in interface AbstractMatrix
Returns:
the number of rows.

getRowModelIndex

public LPModelIndex getRowModelIndex(int localRow)

getColumnModelIndex

public LPModelIndex getColumnModelIndex(int localColumn)
Description copied from interface: LPModelColumns
Convert a local index into a model index.

Specified by:
getColumnModelIndex in interface LPModelColumns
Parameters:
localColumn - the local column.
Returns:
the correponding model index.

getOrientation

public VectorOrientation getOrientation()
Description copied from interface: LPModelComponent
Get the orientation how the component shall be inserted into the global model (either row-by-row or column-by-column).

Specified by:
getOrientation in interface LPModelComponent
Returns:
the orientation for inserting the component into the global model

getColumnOffsetIds

public Iterator getColumnOffsetIds()
Description copied from interface: LPModelComponent
Get an iterator through all column offset ids used by the component.

Specified by:
getColumnOffsetIds in interface LPModelComponent
Returns:
an iterator through all column offset ids used by the component.

getRowOffsetIds

public Iterator getRowOffsetIds()
Description copied from interface: LPModelComponent
Get an iterator through all row offset ids used by the component.

Specified by:
getRowOffsetIds in interface LPModelComponent
Returns:
an iterator through all row offset ids used by the component.

setEdgeColumnsOffsetId

public final void setEdgeColumnsOffsetId(String edgeColumnsOffsetId)
Parameters:
edgeColumnsOffsetId - The edgeColumnsOffsetId to set.

getNodeRowsOffsetId

public String getNodeRowsOffsetId()
Returns:
the nodeRowsOffsetId

setNodeRowsOffsetId

public final void setNodeRowsOffsetId(String nodeRowsOffsetId)
Parameters:
nodeRowsOffsetId - The nodeRowsOffsetId to set.