jMetal / jMetalSP

A framework for Big Data Optimization with multi-objective metaheuristics
MIT License
46 stars 26 forks source link

Don't get TSP example why there are update to cost/distance? #13

Open bronzels opened 3 years ago

bronzels commented 3 years ago

I tried to write a problem myself by referring to TSP as it is easier to understand, but don't get what this function is for.

To me distance/cost is fixed to TSP problem, only variables for permutation to change as solution to evaluate the by 2 object, this update function is called for what reason and when?

jmetalsp-problem\src\main\java\org\uma\jmetalsp\problem\tsp\DynamicMultiobjectiveTSP.java

@Override public void update(Observable<ObservedValue> observable, ObservedValue data) { if (data!=null && data.getValue().getMatrixIdentifier() == "COST") { updateCostValue(data.getValue().getX(),data.getValue().getY(),data.getValue().getValue()); } else if(data!=null && data.getValue().getMatrixIdentifier() == "VALUE"){ updateDistanceValue(data.getValue().getX(),data.getValue().getY(),data.getValue().getValue()); } }

bronzels commented 3 years ago

after more time spent on reading code, i got the idea of update is to use the streaming data source to add new cities or change connected/non-connected state between cities dynamically? but still i can't connect the dots: 1, if to add new cities, then why only distanceMatrix/costMatrix updated, numberOfCities remains same? 2, in updateDistanceValue/updateCostValue, why &&, should be || as a new city added, matric's x/y should be always 1 within length and another for new city is beyond length? if (distanceMatrix.length < row && distanceMatrix[row].length < col) {

bronzels commented 3 years ago

for adding new cities, besides adding into numberOfCities, also to call setNumberOfVariables to increase variables number? but is it feasible to add change variables in running state?

cbarba commented 3 years ago

JMealSP only allows updating the distance matrix or the cost matrix, it is not possible to add more cities during the running time. The idea in the problem design is that due to different causes (traffic issues, accidents, etc) the values of both matrices can change. Then those changes must be reflected in the algorithm performance and data. However, the problem can be updated for allowing modifying the number of cities during the running time. Still, you need to consider that you need to include new matrices and ensure that they change the correct one and inside their boundaries.

The number of variables is set when the algorithm starts its execution and cannot be modified