ILOCPLEXGOAL2(SemiContGoal, IloNumVarArray, scVars, IloNumArray, scLbs) { IloInt besti = -1; IloNum maxObjCoef = -IloInfinity; IloInt i; // From among all variables that do not respect their minimum // usage levels, select the one with maximum objective coefficient. for (i = 0; i < scVars.getSize(); i++) { IloNum val = getValue(scVars[i]); if ( val >= 1e-5 && val <= scLbs[i] - 1e-5 ) { if ( getObjCoef(scVars[i]) >= maxObjCoef ) { besti = i; maxObjCoef = getObjCoef(scVars[i]); } } } // If any are found, branch to enforce the condition that // the variable must either be 0.0 or greater than // the minimum usage level. if ( besti != -1 ) { return AndGoal ( OrGoal ( scVars[besti] <= 0.0, scVars[besti] >= scLbs[besti] ), this ); } else if ( !isIntegerFeasible() ) { return AndGoal( BranchAsCplexGoal(getEnv()), this ); } return 0; }
void MtxLP::updateObjCoef(string col, double coef){ coef += getObjCoef(col); setObjCoef(col, coef); }