2017-03-11 16 views
0

過度に拘束された計画でVRPの増分スコアを作成したい。私は計画外のすべての顧客を含む1つの追加のダミー車を作成します。Optaplanner VRP増分スコア過拘束計画

optaplannerが他の車両に顧客を移動させたときに変数名前に変数名変更後に呼び出され、その顧客の車両は更新されません。それから私はその顧客のための乗り物を知らない、私はソフトコストを追加する必要があるかどうかわからない(ダミーの車のために私はコストを追加することができませんでした)。

この問題を解決するにはどうすればよいですか?

例:

Vehicle2にVehicle1からCustomer1を移動Optaplanner:

beforeVariableChanged: previousStandstill(Customer1), customer.GetVehicle() = Vehicle1 
beforeVariableChanged: nextCustomer(Customer0),  customer.GetVehicle() = Vehicle1 
afterVariableChanged: nextCustomer(Customer0),  customer.GetVehicle() = Vehicle1 
afterVariableChanged: previousStandstill(Customer1), customer.GetVehicle() = Vehicle1 
beforeVariableChanged: vehicle(Customer1),    customer.GetVehicle() = Vehicle1 
afterVariableChanged: vehicle(Customer1),    customer.GetVehicle() = Vehicle2 

私が取得する場合afterVariableChanged:previousStandstill(Customer1)、customer.GetVehicle()私は古い車の価値を持っていると私はドンの」ソフトコストを追加する必要があるかどうかを知る(ダミーの車両コストは無視される)。 afterVariableChanged - 実際の車両を得る方法はありますか?afterVariableChanged - vehicleではなくpreviousStandstillです。あなたはAnchorShadowVariableでvechicleフィールドを注釈を付けた場合

答えて

1

チェック:

@AnchorShadowVariable(sourceVariableName = "previousStandstill") 
public VehicleNode getVehicleNode() { 
    return vehicleNode; 
} 

注釈はvechicleフィールドを更新するOptaplannerに言うこと。

+0

はい、私はAnchorShadowVariableを持っています。問題は、顧客の車両変数が、afterVariableChangedを変数名previousStandstill – Kapeciu

+0

で呼び出した後に更新され、この注釈を含むクラスにPlanningEntity注釈も含まれているかどうかです。これはうまくいくはずです。 –

+0

はい、そうです。問題は、車両のフィールドが更新される時です。 – Kapeciu

関連する問題