1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

add Figliozzi utilities to benchmark VRP with time dependent costs

This commit is contained in:
oblonski 2014-09-17 13:00:35 +02:00
parent 8df550e0e6
commit 50f3efb098

View file

@ -1,54 +0,0 @@
/*******************************************************************************
* Copyright (C) 2014 Stefan Schroeder
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package jsprit.instance.reader;
import junit.framework.Assert;
import org.junit.Test;
import java.util.List;
public class FigliozziReaderTest {
@Test
public void factoryShouldReturnCorrectSpeedDistribution(){
List<Double> speedValues = Figliozzi.TimeDependentTransportCostsFactory.createSpeedValues(Figliozzi.TimeDependentTransportCostsFactory.SpeedDistribution.TD1a);
Assert.assertEquals(speedValues.get(0),1.,0.01);
Assert.assertEquals(speedValues.get(1),1.6,0.01);
Assert.assertEquals(speedValues.get(2),1.05,0.01);
Assert.assertEquals(5,speedValues.size());
}
@Test
public void whenAskingForTD1b_factoryShouldReturnCorrectSpeedDistribution(){
List<Double> speedValues = Figliozzi.TimeDependentTransportCostsFactory.createSpeedValues(Figliozzi.TimeDependentTransportCostsFactory.SpeedDistribution.TD1b);
Assert.assertEquals(speedValues.get(0),1.,0.01);
Assert.assertEquals(speedValues.get(1),2.,0.01);
Assert.assertEquals(speedValues.get(2),1.5,0.01);
Assert.assertEquals(5,speedValues.size());
}
@Test
public void whenAskingForTD1c_factoryShouldReturnCorrectSpeedDistribution(){
List<Double> speedValues = Figliozzi.TimeDependentTransportCostsFactory.createSpeedValues(Figliozzi.TimeDependentTransportCostsFactory.SpeedDistribution.TD1c);
Assert.assertEquals(speedValues.get(0),1.,0.01);
Assert.assertEquals(speedValues.get(1),2.5,0.01);
Assert.assertEquals(speedValues.get(2),1.75,0.01);
Assert.assertEquals(5,speedValues.size());
}
}