Bug `@value_range_provider` type must match `@planning_variable` type
Christopher-Chianelli opened this issue · comments
Christopher Chianelli commented
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