Skip to content

feat(kdl): indexed bounds syntax for var blocks #181

@pesap

Description

@pesap

Summary

Add support for indexed bounds in var blocks using lower { expr } and upper { expr } child nodes, allowing bounds to reference parameters.

Parent: #176
Blocked by: #179

Syntax

// Scalar bounds (existing, inline)
var x lower=0 upper=100 {index generators; index buses}

// Indexed bounds (new, child nodes)
var x lower=0 {
    index generators; index buses
    upper { capacity[g] }
}

// Both bounds indexed
var flow {
    index arcs
    lower { min_flow[a] }
    upper { max_flow[a] }
}

Acceptance Criteria

  • Parser accepts lower { expr } as child node in var block
  • Parser accepts upper { expr } as child node in var block
  • Inline scalar bounds (lower=0) still work
  • Mixed: inline lower=0 + child upper { expr } works
  • Expression inside bounds parsed by math expression parser
  • Test: indexed upper bound parses correctly
  • Test: indexed lower bound parses correctly
  • Test: mixed scalar/indexed bounds work
  • Test: expression references parameter correctly

Implementation Notes

Location: crates/arco-kdl/src/source/parser.rs (in parse_var or similar)

The lower { expr } / upper { expr } nodes contain a math expression that gets parsed by the existing expression parser.

  • AFK — extends existing var parsing with clear pattern

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions