optimization - difficulty with element method constraint programming -


i'm having hard time regarding how model constraint. i'm trying solve transportation problem , 1 of constraints follows:

t[s[i]] >= t[i] + traveltime (i, s[i]) 

which t time @ node visited , s successor variable of node ( t , s variables).

i have travel time matrix :

int time = traveltime(int origin, int destination)  

which defines travel time between pair of nodes. have defined constraint below:

for (int : set){   ilointexpr expr = model.linearintexpr();   expr = model.sum(model.element(t, s[i]), model.prod(t[i], -1));   ilointexpr next = model.element(range(0, nbnodes), s[i]);   model.addge(expr, traveltime(i, next)); } 

***range function generates [0,1, ... ,nbnodes] , [size(s) = size(t) = nbnodes]

now problem next returning ilointexpr , want int pass traveltime(int, int), , ilointexpr not castable int. can possible solution problem. appreciate in regard.


Comments