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

Bug @value_range_provider type must match @planning_variable type #101

Open
Christopher-Chianelli opened this issue Sep 6, 2022 · 0 comments

Comments

@Christopher-Chianelli
Copy link
Contributor

Currently, the following code with throw a class cast exception:

@optapy.problem_fact
class Slot:
    pass


@optapy.planning_entity
class Task:
    # ...
    @optapy.planning_variable(Slot, value_range_providers=['value_range_provider']
    def get_value(self):
        return self.value


@optapy.planning_solution
class Solution:
    # ...
    @optapy.planning_entity_collection(Task)
    @optapy.value_range_provider('value_range_provider')
    def get_tasks(self):
        return self.tasks

That is, although Task is a subclass of Slot, specifying it as the type of a value range causes an exception. Ideally,
@value_range_provider would allow specifying subclasses of the @planning_variable type

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

1 participant