Skip to content

add contextual variable - #69

Merged
roussel-ryan merged 11 commits into
mainfrom
contextual-variable
Jul 16, 2026
Merged

add contextual variable#69
roussel-ryan merged 11 commits into
mainfrom
contextual-variable

Conversation

@roussel-ryan

@roussel-ryan roussel-ryan commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces support for contextual variables in the VOCS class and updates related logic to handle them appropriately. Contextual variables are those that effect objectives/constraints of interest, but are measured and cannot be controlled directly. As such they are listed as variables. By default they have (-inf, inf) bounds, but these bounds can be overwritten if finite bounds are required (to be implemented by the package).

Support for Contextual Variables:

  • Added a new ContextualVariable class as a subclass of ContinuousVariable in gest_api/vocs.py to represent contextual variables.
  • Added a has_contextual_variables property to the VOCS class to indicate if any contextual variables are present.

Testing:

  • Added a new test test_has_contextual_variables_property in gest_api/tests/test_vocs.py to verify the behavior of the has_contextual_variables property and ensure contextual variables are excluded from bounds.
  • Imported ContextualVariable in the test file to support the new tests.

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (cf08a3e) to head (0b40aaa).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #69   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          599       621   +22     
=========================================
+ Hits           599       621   +22     

☔ 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.

@roussel-ryan
roussel-ryan requested review from jlnav and shuds13 July 16, 2026 21:29
@jlnav

jlnav commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

I'm happy with the idea, but within most generators then, we need to be careful to select only those variables that aren't ContextualVariables before sampling over the domain, right?

With some [i.bounds for i in self.vocs.variables if not i.isinstance(ContextualVariable)]

Whereas self.vocs.bounds is simpler for logic more likely to be used throughout a generator?

Maybe I'm misunderstanding.

@roussel-ryan

roussel-ryan commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

That is generally correct, but I would assert that this should be handled on a per package/generator level since each package could treat this differently. Note that in the context of Contextual BO, we need to build the model over the full vocs domain, and then we fix the context value, based on our experience, it makes more sense to keep it in the domain output

@roussel-ryan
roussel-ryan merged commit 260ff37 into main Jul 16, 2026
8 checks passed
@roussel-ryan
roussel-ryan deleted the contextual-variable branch July 17, 2026 14:18
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.

3 participants