Skip to content

Hull: evaulate_at_zero function - #148

Merged
pulsipher merged 5 commits into
infiniteopt:masterfrom
dnguyen227:infgdp_hull_0
Oct 9, 2026
Merged

pulsipher merged 5 commits into
infiniteopt:masterfrom
dnguyen227:infgdp_hull_0

Conversation

@dnguyen227

Copy link
Copy Markdown
Contributor

The nonlinear hull reformulation computed the perspective constant f(0) with JuMP.value(v -> 0.0, con.func). This doesnt work for GeneralVariableRef

evaluate_at_zero that goes through numbers, variables, affine, quadratic, and nonlinear expressions. This allows for dispatch in InfGDP. dispatch_variable_ref should ensure that we're only evaluating things we're confident about. Can build out other types as they come up, but this solves the issue of variables inside GeneralVariableRef erroring out when they shouldnt.

using DisjunctiveProgramming, InfiniteOpt

model = InfiniteGDPModel()
@infinite_parameter(model, t ∈ [0, 1], num_supports = 3)
@variable(model, 0 <= x <= 10, Infinite(t))
@finite_parameter(model, p == 3)
@variable(model, Y[1:2], InfiniteLogical(t))
@constraint(model, exp(x) - 3 <= 0, Disjunct(Y[1]))   # nonlinear disjunct
@constraint(model, x >= 5, Disjunct(Y[2]))
@disjunction(model, Y)

# g(0), the perspective constant of the hull row
evaluate_at_zero(exp(x) - 3)   # -2.0   variables -> 0
evaluate_at_zero(exp(x) - p)   # -2.0   finite parameter -> its value
evaluate_at_zero(exp(x) - t)   # ERROR: g(0) would depend on the infinite parameter t

reformulate_model(model, Hull())   # MethodError on master: no JuMP.value(f, ::GeneralVariableRef)

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.69%. Comparing base (eca397e) to head (69f1e1b).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #148   +/-   ##
=======================================
  Coverage   99.69%   99.69%           
=======================================
  Files          21       21           
  Lines        2265     2298   +33     
=======================================
+ Hits         2258     2291   +33     
  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 dnguyen227 closed this Oct 8, 2026
@dnguyen227 dnguyen227 reopened this Oct 8, 2026
@dnguyen227
dnguyen227 marked this pull request as draft October 8, 2026 14:24
@dnguyen227
dnguyen227 marked this pull request as ready for review October 8, 2026 16:55
@dnguyen227

Copy link
Copy Markdown
Contributor Author

@pulsipher ready for review. This replaces the JuMP.value(vref) PR on InfiniteOpt.

Comment thread ext/InfiniteDisjunctiveProgramming.jl Outdated
@pulsipher
pulsipher merged commit 471b92a into infiniteopt:master Oct 9, 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