void FlowBasedGlobalConstraint::changeAfterProject(vector<int> &supports, vector<map<Value, Cost> > &deltas){ for (unsigned int i=0;i<supports.size();i++) { augmentStructure(*graph, cost, supports[i], deltas[i]); } graph->removeNegativeCycles(cost); }
void FlowBasedGlobalConstraint::changeAfterExtend(vector<int> &supports, vector<map<Value, Cost> > &deltas){ for (unsigned int i=0;i<supports.size();i++) { for (map<Value, Cost>::iterator v = deltas[i].begin();v != deltas[i].end();v++) v->second *= -1; augmentStructure(*graph, cost, supports[i], deltas[i]); for (map<Value, Cost>::iterator v = deltas[i].begin();v != deltas[i].end();v++) v->second *= -1; } graph->removeNegativeCycles(cost); for (int i=0;i<graph->size();i++) { for (int j=0;j<graph->size();j++) { zeroEdges[i][j] = false; } } }
void LinearConstraint::changeAfterExtend(vector<int> &supports, vector<map<Value, Cost> > &deltas){ bucost = cost; if (buObj == NULL){ buObj = new int[count]; } for (int i = 0; i < count; i++){ buObj[i] = mip.objCoeff(i); // retrieve unary cost } for (unsigned int i=0;i<supports.size();i++) { for (map<Value, Cost>::iterator v = deltas[i].begin();v != deltas[i].end();v++) v->second *= -1; augmentStructure(mip, cost, supports[i], deltas[i]); for (map<Value, Cost>::iterator v = deltas[i].begin();v != deltas[i].end();v++) v->second *= -1; } cost = solveMIP(mip); // solve }
//inline void buildGraph() {buildGraph(graph);} inline void augmentGraph(int varindex, map<Value, Cost> &delta) { augmentStructure(*graph, cost, varindex, delta); graph->removeNegativeCycles(cost); }
void LinearConstraint::changeAfterProject(vector<int> &supports, vector<map<Value, Cost> > &deltas){ for (unsigned int i=0;i<supports.size();i++) { augmentStructure(mip, cost, supports[i], deltas[i]); } }