mck- / Open-VRP

Open-source framework for modeling Vehicle Routing Problems.
310 stars 86 forks source link

define-problem macro to accept single values AND lists #13

Closed mck- closed 12 years ago

mck- commented 12 years ago

Currently, all key attributes only accept lists (that are of equal length to either node-coords or fleet-size). e.g. :capacities has to be a list of equal length to fleet-size, with each element setting each vehicle's capacity. Same applies for :speeds.

It'd be nice if you could also provide a single value, which would create a homogenous fleet.

8fac15c2836 was an attempt that failed in lexical environments.

Fiddling with nested backquotes for a few days, I decided to ask for help. Though the answer was helpful, it couldn't apply cleanly to this rather large macro.

Anyone up for the challenge?

mck- commented 12 years ago

Very nice Jorge!

mck- commented 12 years ago

Sorry Jorge, it doesn't seem to work in lexical closures, e.g. when called like:

(let ((x (list 1 2 3)))
   (define-problem "test" *node-coords* 3 :capacities x))

I've tried to fix it, but still failed to.. I'm reading LoL, trying to seek the answer ;)

mck- commented 12 years ago

Great! This time it seems to work in lexical closures as well! It seems that the issue is truly solved!