vrp-tabu-search
Version:
Tabu Search Algorithm for Vehicle Routing Problem
87 lines (70 loc) • 1.85 kB
JavaScript
var util = require('util');
var assert = require('assert');
var defineClass = require('simple-cls').defineClass;
var OSolution = require('./OSolution.js');
var OProblem = defineClass({
name : "OProblem",
/**
initialize with problem instance data
**/
construct: function (nodes, data, capacity, solution, minimization) {
this.nodes = nodes;
this.data = data;
this.capacity = capacity;
this.solution = solution;
this.minimization = minimization;
},
variables: {
// node list
nodes: null,
// cost matrix
data: null,
// capacity of vehicle
capacity: 0,
// initialization solution
solution: null,
// minimization
minimization: false
},
statics: {
/**
consumes a raw content and parse the problem instance data
subclass will implement this parsing function and return a data object that can be used by the problem instance
@return data - the problem instance data
**/
parseData : function(raw){assert.ok(null,"not implemented"); },
/**
check if a given data object is valid
**/
validData : function(data){assert.ok(null,"not implemented");}
},
methods : {
/**
check if a given solution to the problem satisfies all constraints
**/
valid: function (solution) {
assert.ok(null, 'not implemented');
},
/**
definition of the objective function
@return the solution quality value for the solution
**/
fitness: function (solution) {
assert.ok(null, 'not implemented');
},
demand: function (route) {
assert.ok(null, 'not implemented');
},
/**
utility function for generating a random solution
@return a solution instance
**/
randsol: function () {
assert.ok(null, 'not implemented');
},
initSolution: function (sol) {
assert.ok(null, 'not implemented');
}
}
});
module.exports = exports = OProblem;