Skip to content

Basic steps implementation - #141

Merged
pulsipher merged 9 commits into
infiniteopt:masterfrom
dnguyen227:basic_steps
Oct 15, 2026
Merged

pulsipher merged 9 commits into
infiniteopt:masterfrom
dnguyen227:basic_steps

Conversation

@dnguyen227

Copy link
Copy Markdown
Contributor
  • apply_basic_step(model, [Y1, Y2, ...]) replaces the input disjunctions with their product: one new disjunct per combination, containing the union of the parents' constraints
  • Global constraints can be intersected into every product disjunct
  • Original logical vars Y are kept and linked via Y[i] in Exactly(w_slice) → reformulates to y_i = sum_j w_ij, so the model is equivalent.
  • relax_products = true makes the product binaries continuous [0,1] (the linking equalities force them integral), so binaries don't multiply (Pyomo doesnt do this, its valid according to the lit).
  • Right now, basic steps is destructive, as this all takes place before the user calls optimize and triggers the reformulation workflow.
  • Also InfiniteGDP implementation (it doesnt seem to benefit solve times at all from my minimal testing).
model = GDPModel(HiGHS.Optimizer)
@variable(model, 0 <= x[1:2] <= 10)
@variable(model, Y[1:2], Logical)
@variable(model, Z[1:2], Logical)
@objective(model, Max, x[1] + x[2])
@constraint(model, x[1] <= 1, Disjunct(Y[1]))
@constraint(model, 2 <= x[1] <= 3, Disjunct(Y[2]))
@constraint(model, x[2] <= 1, Disjunct(Z[1]))
@constraint(model, 4 <= x[2] <= 5, Disjunct(Z[2]))
d1 = disjunction(model, Y)
d2 = disjunction(model, Z)
g = @constraint(model, x[1] + x[2] <= 6)

# replace d1 and d2 with their product disjunction (2x2 = 4 disjuncts),
# intersecting the global constraint g into every product disjunct
bs = apply_basic_step(model, [d1, d2], constraints = [g], name = "bs")

optimize!(model, gdp_method = Hull())   # tighter relaxation, same optimum

@codecov

codecov Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.73%. Comparing base (10c37f7) to head (84f9752).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #141      +/-   ##
==========================================
+ Coverage   99.71%   99.73%   +0.01%     
==========================================
  Files          21       22       +1     
  Lines        2456     2608     +152     
==========================================
+ Hits         2449     2601     +152     
  Misses          7        7              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dnguyen227

Copy link
Copy Markdown
Contributor Author

@pulsipher ready for review

Comment thread src/basicsteps.jl
Comment thread src/basicsteps.jl Outdated
@dnguyen227
dnguyen227 requested a review from pulsipher October 15, 2026 15:19
@pulsipher
pulsipher merged commit 6ab70a6 into infiniteopt:master Oct 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants