- Record Components:
sense- whether to maximise or minimise the objective; never nullobjective- the per-row coefficient expression summed in the objective; never nullconstraints- the linear constraints (at least one); never nullgroupingKeys- the grouping keys (empty = one whole-relation group); never nullallocation- present iff this is LP (continuous allocation) mode; never nullinput- the candidate relation; never nulllocation- the source location of this node; never null
- All Implemented Interfaces:
RelNode
γ. Within each group
(by groupingKeys) it either selects the
optimal subset (MIP mode) or assigns continuous allocations (LP mode).
MIP mode (default, allocation is empty): each row carries a
binary decision (in or out); the output is the chosen input rows unchanged, so
the output schema equals the input schema. A group whose constraints are
infeasible contributes no rows.
Example: OPTIMIZE MAXIMIZE SUM(value) SUBJECT TO SUM(weight) <= 100 PER
region (Candidates).
LP mode (allocation is present): each row receives a
continuous decision variable in [lo, hi]; every row is emitted with its
allocation value appended as a new column — output schema = input + 1 column.
Syntax: OPTIMIZE ALLOCATE (lo, hi) MAXIMIZE SUM(return) SUBJECT TO
SUM(1) = 1.0 -> weight (Portfolio).
Solved in-engine above the federation boundary; never pushes down.
Materialises its input ([bag]). At least one constraint is required.
-
Constructor Summary
ConstructorsConstructorDescriptionOptimizeNode(ObjectiveSense sense, Operand objective, List<OptimizeConstraint> constraints, List<String> groupingKeys, RelNode input) Convenience constructor for tests (MIP mode); usesSourceLocation.UNKNOWN.OptimizeNode(ObjectiveSense sense, Operand objective, List<OptimizeConstraint> constraints, List<String> groupingKeys, Optional<AllocationSpec> allocation, RelNode input, SourceLocation location) Creates an instance of aOptimizeNoderecord class. -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(RelNodeVisitor<R> visitor) Returns the value of theallocationrecord component.Returns the value of theconstraintsrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thegroupingKeysrecord component.final inthashCode()Returns a hash code value for this object.input()Returns the value of theinputrecord component.location()Returns the value of thelocationrecord component.Returns the value of theobjectiverecord component.sense()Returns the value of thesenserecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.darkcollective.relix.ast.RelNode
children, mapChildren, materializationMode, prettyPrint
-
Constructor Details
-
OptimizeNode
public OptimizeNode(ObjectiveSense sense, Operand objective, List<OptimizeConstraint> constraints, List<String> groupingKeys, Optional<AllocationSpec> allocation, RelNode input, SourceLocation location) Creates an instance of aOptimizeNoderecord class.- Parameters:
sense- the value for thesenserecord componentobjective- the value for theobjectiverecord componentconstraints- the value for theconstraintsrecord componentgroupingKeys- the value for thegroupingKeysrecord componentallocation- the value for theallocationrecord componentinput- the value for theinputrecord componentlocation- the value for thelocationrecord component
-
OptimizeNode
public OptimizeNode(ObjectiveSense sense, Operand objective, List<OptimizeConstraint> constraints, List<String> groupingKeys, RelNode input) Convenience constructor for tests (MIP mode); usesSourceLocation.UNKNOWN.
-
-
Method Details
-
accept
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
sense
Returns the value of thesenserecord component.- Returns:
- the value of the
senserecord component
-
objective
Returns the value of theobjectiverecord component.- Returns:
- the value of the
objectiverecord component
-
constraints
Returns the value of theconstraintsrecord component.- Returns:
- the value of the
constraintsrecord component
-
groupingKeys
Returns the value of thegroupingKeysrecord component.- Returns:
- the value of the
groupingKeysrecord component
-
allocation
Returns the value of theallocationrecord component.- Returns:
- the value of the
allocationrecord component
-
input
Returns the value of theinputrecord component.- Returns:
- the value of the
inputrecord component
-
location
Returns the value of thelocationrecord component.
-