integrate weight functions into agent.cpp