editor › Globals › IdealMasterPlateAssignmentStrategy
Class: IdealMasterPlateAssignmentStrategy
This class implements the MasterPlateAssignmentStrategy and tries to make the result ideal in terms of - plates with concave corners become master plate - plates that are master in some corners should become master in all their corners - plates that have many convex edges are more likely to become master
To do this, it computes a min cost flow in a flow network, that is designed like this: Each Plate get a node (pNode). Each VertexPosition gets a node (vNode). Add a source node, where all flow originates. There is an edge from the source node to all pNodes. There is an edge from each pNode to vNodes, where this plate has a finger joint. Each vNode requires 1 flow unit. Each pNode requires 0 flow units. The costs are modeled in a way that tries to fulfil the requirements listed above. The second criterion requires a non-convex cost function (it is cheaper to send a lot a flow over one edge than to distribute it over many edges). Thus the problem is likely NP-hard, which is why we use a generic ILP solver to find an optimal solution.
see ../../src/model/visualization/Joints/JointCoordination/flow_network_ideal_master_plates.svg details
Hierarchy
↳ IdealMasterPlateAssignmentStrategy
Index
Constructors
Properties
Methods
- _applyMasterPlate
- _createLPModel
- _forceMasterPlateAtOutlinePoint
- _getLPModel
- _getMasterPlatesFromLPResults
- _getPlateCost
- _getPlatesMaps
- _getVertexPositions
- _processLPResult
- assignMasterPlates
- assignMasterPlatesAsynchronously
Constructors
constructor
+ new IdealMasterPlateAssignmentStrategy(jointType: Constructor‹FingerJoint›): IdealMasterPlateAssignmentStrategy
Inherited from MasterPlateAssignmentStrategy.constructor
Defined in src/model/visualization/Joints/JointCoordination/MasterPlateAssignmentStrategy.ts:11
Parameters:
| Name | Type |
|---|---|
jointType |
Constructor‹FingerJoint› |
Returns: IdealMasterPlateAssignmentStrategy
Properties
Protected jointType
• jointType: Constructor‹FingerJoint›
Inherited from MasterPlateAssignmentStrategy.jointType
Defined in src/model/visualization/Joints/JointCoordination/MasterPlateAssignmentStrategy.ts:12
Methods
Protected _applyMasterPlate
▸ _applyMasterPlate(vertexPosition: VertexPosition, masterPlate: Plate): void
Inherited from MasterPlateAssignmentStrategy._applyMasterPlate
Defined in src/model/visualization/Joints/JointCoordination/MasterPlateAssignmentStrategy.ts:34
Parameters:
| Name | Type |
|---|---|
vertexPosition |
VertexPosition |
masterPlate |
Plate |
Returns: void
Private _createLPModel
▸ _createLPModel(plates: Map‹Plate, number›, vertexPositions: Map‹VertexPosition, number›): object
Defined in src/model/visualization/Joints/JointCoordination/IdealMasterPlateAssignmentStrategy.ts:158
Creates a model (POJO) with the following variables. The names are shortened as an optimization for the solver. - 'c' (cost) should be minimized - "v#{vertexId}" (vertexHasMasterPlate) must be 1 - "f#{plateId}" (netFlow) flow in and out of a plate needs to add up to 0 - "p#{plateId}_#{inflow}" how many master corners this plate gets - "p#{plateId}I#{vertexId}" (plate##IsMasterAtVertex##) whether the plate is master at the vertex Variables are declared as int/binary where appropriate
Parameters:
| Name | Type | Description |
|---|---|---|
plates |
Map‹Plate, number› | - |
vertexPositions |
Map‹VertexPosition, number› | - |
Returns: object
-
model(): object
-
binaries(): object
-
constraints(): object
-
opType: string = "min"
-
optimize: string = "c"
-
variables(): object
-
ints: object
- c: number = 1
-
predefinedMasterPlates: Map‹VertexPosition‹›, Plate‹››
Private _forceMasterPlateAtOutlinePoint
▸ _forceMasterPlateAtOutlinePoint(outlinePoint: OutlinePoint): boolean
Defined in src/model/visualization/Joints/JointCoordination/IdealMasterPlateAssignmentStrategy.ts:261
Parameters:
| Name | Type |
|---|---|
outlinePoint |
OutlinePoint |
Returns: boolean
Private _getLPModel
▸ _getLPModel(assembly: Assembly): object
Defined in src/model/visualization/Joints/JointCoordination/IdealMasterPlateAssignmentStrategy.ts:131
Parameters:
| Name | Type |
|---|---|
assembly |
Assembly |
Returns: object
-
model: any
-
plates: Map‹Plate‹›, number›
-
predefinedMasterPlates: Map‹VertexPosition‹›, Plate‹››
-
vertexPositions: Map‹VertexPosition‹›, number›
Private _getMasterPlatesFromLPResults
▸ _getMasterPlatesFromLPResults(result: any, predefinedMasterPlates: Map‹VertexPosition, Plate›, vertexPositions: Map‹VertexPosition, number›, plates: Map‹Plate, number›): Map‹VertexPosition‹›, Plate‹››
Defined in src/model/visualization/Joints/JointCoordination/IdealMasterPlateAssignmentStrategy.ts:103
Parameters:
| Name | Type |
|---|---|
result |
any |
predefinedMasterPlates |
Map‹VertexPosition, Plate› |
vertexPositions |
Map‹VertexPosition, number› |
plates |
Map‹Plate, number› |
Returns: Map‹VertexPosition‹›, Plate‹››
A map assigning each vertex position its master plate
Private _getPlateCost
▸ _getPlateCost(masterCorners: number, predefinedMasterCorners: number, convexity: number): number
Defined in src/model/visualization/Joints/JointCoordination/IdealMasterPlateAssignmentStrategy.ts:257
Parameters:
| Name | Type | Description |
|---|---|---|
masterCorners |
number | The number of master corner that this plate gets (in addition to predefined ones) |
predefinedMasterCorners |
number | The number of predefined master corners that this plate already has |
convexity |
number | The number of convex sections that this plate has |
Returns: number
Private _getPlatesMaps
▸ _getPlatesMaps(assembly: Assembly): Map‹Plate‹›, number›
Inherited from MasterPlateAssignmentStrategy._getPlatesMaps
Defined in src/model/visualization/Joints/JointCoordination/MasterPlateAssignmentStrategy.ts:49
Parameters:
| Name | Type | Description |
|---|---|---|
assembly |
Assembly | - |
Returns: Map‹Plate‹›, number›
A map giving each Plate a numerical ID
Private _getVertexPositions
▸ _getVertexPositions(plates: Map‹Plate, number›): Map‹VertexPosition‹›, number›
Inherited from MasterPlateAssignmentStrategy._getVertexPositions
Defined in src/model/visualization/Joints/JointCoordination/MasterPlateAssignmentStrategy.ts:60
Parameters:
| Name | Type | Description |
|---|---|---|
plates |
Map‹Plate, number› | - |
Returns: Map‹VertexPosition‹›, number›
A map giving each VertexPosition a numerical ID
Private _processLPResult
▸ _processLPResult(result: any, predefinedMasterPlates: Map‹VertexPosition, Plate›, vertexPositions: Map‹VertexPosition, number›, plates: Map‹Plate, number›, accumulatedMasterPlatesMap: Map‹VertexPosition, Plate›): void
Defined in src/model/visualization/Joints/JointCoordination/IdealMasterPlateAssignmentStrategy.ts:80
Parameters:
| Name | Type |
|---|---|
result |
any |
predefinedMasterPlates |
Map‹VertexPosition, Plate› |
vertexPositions |
Map‹VertexPosition, number› |
plates |
Map‹Plate, number› |
accumulatedMasterPlatesMap |
Map‹VertexPosition, Plate› |
Returns: void
assignMasterPlates
▸ assignMasterPlates(changedObjects: Set‹PhysicalObject›): Map‹VertexPosition‹›, Plate‹››
Overrides MasterPlateAssignmentStrategy.assignMasterPlates
Defined in src/model/visualization/Joints/JointCoordination/IdealMasterPlateAssignmentStrategy.ts:36
Parameters:
| Name | Type |
|---|---|
changedObjects |
Set‹PhysicalObject› |
Returns: Map‹VertexPosition‹›, Plate‹››
assignMasterPlatesAsynchronously
▸ assignMasterPlatesAsynchronously(changedObjects: Set‹PhysicalObject›): any
Overrides MasterPlateAssignmentStrategy.assignMasterPlatesAsynchronously
Defined in src/model/visualization/Joints/JointCoordination/IdealMasterPlateAssignmentStrategy.ts:52
Parameters:
| Name | Type |
|---|---|
changedObjects |
Set‹PhysicalObject› |
Returns: any