Skip to content

Neighbourhood API example gets a variable of the wrong type #2293

@MarkRdgOx

Description

@MarkRdgOx

Describe the bug
In the Neighbourhoods section, in section 4, the example defineNeighbourhood function obtains a variable metamodel via:

var timeslotVariable = builder.getSolutionMetaModel().entity(Lesson.class).variable("timeslot", Timeslot.class);

.. and passes it to the constructor of the TimeslotChangeMoveProvider listed in section 3.1.

However, in the actual API, this returns a variable of type VariableMetaModel, rather than the PlanningVariableMetaModel which is required by the TimeslotChangeMoveProvider constructor.

Expected behavior
The example should compile.

Actual behavior
The example fails with a type error.

Additional Information
The correct call appears to be builder.getSolutionMetaModel().genuineEntity(Lesson.class).basicVariable<Timeslot>("timeslot").

Metadata

Metadata

Assignees

Labels

component/docsImprovements or additions to documentation

Type

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions