Reputation: 7248
I am building an OptaPlan solution for an optimization problem.
I have an List<Integer>
called weights
These are the only planning variable
in my model, all others are shadow.
I want to make sure that sum of weights (weights[0] + weights[1] + weights[2]... = 1000)
, While variables other than weights (shadow
) will make sure whats the best solution (Using SimpleScore
).
Using a simple EasyScoreCalculator
might produce a huge set to search for my problem. I believe penalizing score every time for weights[0] + weights[1] + weights[2]... != 1000
is an un-optimized (slow) method.
Whats the best way to do this.
Upvotes: 0
Views: 93
Reputation: 27337
You should penalize the difference between that sum and 1000. So for example, if the weight sum in 920, penalize -80. If the weight it 1019, penalize -19.
Take a look at the cloud balancing problem, I suspect you'll need to just sum all the weights of the items that have @PlanningVariable Boolean included equal to true.
Upvotes: 1