0

I have extended my problem base from curriculumCourse example of optaplanner samples.

And since it was necessary to solve on-hand problem, I started to use 2 variables, both from "value range provider from entity".

Now I am trying to improve my solutions, and, when I check solution, I realized that there are some lectures which can be better (based on score), if they are simply swapped, or moved left or right, etc.

I am not sure if this approach will solve this, but I catched that, with nearbySelection, planner can "coarse-grain" moves, especially based on their similarity (custom DistanceMeter)

However, problem starts at this point, I couldnt configure nearbySelection properly, here is my latest configuration xml

<changeMoveSelector>
                <entitySelector id="entitySelector1">
                    <entityClass>....Lecture</entityClass>
                </entitySelector>
                <valueSelector>
                    <variableName>period</variableName>
                    <nearbySelection>
                        <originEntitySelector mimicSelectorRef="entitySelector1"/>
                        <nearbyDistanceMeterClass>.....LectureNearbyDistanceMeter</nearbyDistanceMeterClass>
                        <parabolicDistributionSizeMaximum>40</parabolicDistributionSizeMaximum>
                    </nearbySelection>
                </valueSelector>
            </changeMoveSelector>

If I dont provide variableName, then it doesnt work, since configurator cannot pick it automatically, however, I couldnt put variableName inside valueSelector, it complains about "java.lang.IllegalArgumentException: The valueSelector (org.optaplanner.core.impl.heuristic.selector.value.nearby.NearEntityNearbyValueSelector@2f66e802) has a variable property type (....Period) which is not a superclass of the originEntitySelector's entityClass (....Lecture)."

Can someone give me a clue, what I am doing wrong here ?

Serkan Kasapbaşı
  • 409
  • 1
  • 4
  • 12
  • Nearby selection can't take score into account (at least it hasn't been designed for it currently): the "distance" (which can be anything) is determined once in the beginning IIRC. – Geoffrey De Smet Aug 26 '15 at 15:19

1 Answers1

1

That exception occurs because it seems to expect a chained design (it expects that the planning value class is a superclass of the entity class). If I recall correctly, that limitation is probably fixed by upgrading to 6.3.0.CR1.

But a nearbyDistanceMeterClass can't take the current Score into account (= it can't be based on score). So it seems like you really just want to implement a custom move selector. See MoveListFactory in docs. Of course, getting that to do parabolic distribution, is hard...

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
  • I might misexplained my intention. I dont want to add score into account, for distance. My heuristic is something like, 2 lectures are near if their teacher is same, if their capacity is near, etc. Anyway, I dont want to upgrade at this point, will try to solve this "score trap" by other algorithms. thanks – Serkan Kasapbaşı Aug 27 '15 at 08:04
  • Upgrading to 6.3.0.CR1 shouldn't be painful. CR2 will go out soon and then Final should be around the corner. – Geoffrey De Smet Aug 27 '15 at 08:15