Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Maybe GW should inherit from FGW instead of vice versa #716

Open
selmanozleyen opened this issue Jun 14, 2024 · 2 comments
Open

Comments

@selmanozleyen
Copy link
Collaborator

I was wondering if it would make more sense to inherit GWProblem from FGWProblem since FGW kind of includes GW in itself. This is a problem since when GW inherites prepare it removes the linear arguments: (xy_callback etc.). And because of this we need to use CompoundProblem.prepare instead of super().prepare which is not ideal if you ask me.

return CompoundProblem.prepare(
self, # type: ignore[return-value, arg-type]
key=key,
xy=xy,
x=x,
y=y,
policy=policy,
cost=cost,
a=a,
b=b,
**kwargs,
)

@MUCDK
Copy link
Collaborator

MUCDK commented Jun 17, 2024

so you would then throw NotImplementedError for all functions which are specific to the fused term?

@selmanozleyen
Copy link
Collaborator Author

But this problem also exists in current code. I can currently run

gwp[('0','1')].set_x(...)

because gwp[('0','1')] is a OTProblem, gwp itself doesn't have set_xy and others. If you are talking about other methods, I didn't notice any method that only FGWProblem itself implements except these


    @property
    def _base_problem_type(self) -> Type[B]:
        return OTProblem  # type: ignore[return-value]

    @property
    def _valid_policies(self) -> Tuple[Policy_t, ...]:
        return _constants.SEQUENTIAL, _constants.EXPLICIT, _constants.STAR  # type: ignore[return-value]

which are the same for both. So moving these to the parent class should work always.

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

No branches or pull requests

2 participants