/** checks all constraints in conjunction constraints for feasibility */ static SCIP_RETCODE checkAllConss( SCIP* scip, /**< SCIP data structure */ SCIP_CONS** conss, /**< active conjunction constraints */ int nconss, /**< number of active conjunction constraints */ SCIP_SOL* sol, /**< solution to check */ SCIP_Bool checkintegrality, /**< has integrality to be checked? */ SCIP_Bool checklprows, /**< have current LP rows to be checked? */ SCIP_Bool printreason, /**< should the reason for the violation be printed? */ SCIP_RESULT* result /**< pointer to store the result */ ) { SCIP_CONSDATA* consdata; int c; int i; assert(result != NULL); for( c = 0; c < nconss && *result == SCIP_FEASIBLE; ++c ) { consdata = SCIPconsGetData(conss[c]); assert(consdata != NULL); /* check all constraints */ for( i = 0; i < consdata->nconss && *result == SCIP_FEASIBLE; ++i ) { SCIP_CALL( SCIPcheckCons(scip, consdata->conss[i], sol, checkintegrality, checklprows, printreason, result) ); assert(*result == SCIP_FEASIBLE || *result == SCIP_INFEASIBLE); } if( printreason && *result == SCIP_INFEASIBLE ) { SCIPinfoMessage(scip, NULL, "conjunction constraint %s is violated, at least the sub-constraint %s is violated by this given solution\n", SCIPconsGetName(conss[c]), SCIPconsGetName(consdata->conss[i-1])); SCIPdebug( SCIP_CALL( SCIPprintCons(scip, conss[c], NULL) ) ); } } return SCIP_OKAY; }
/** checks disjunction constraints if at least one is feasible */ static SCIP_RETCODE checkCons( SCIP* scip, /**< SCIP data structure */ SCIP_CONS* cons, /**< active disjunction constraint */ SCIP_SOL* sol, /**< solution to check */ SCIP_Bool checkintegrality, /**< has integrality to be checked? */ SCIP_Bool checklprows, /**< have current LP rows to be checked? */ SCIP_Bool printreason, /**< should the reason for the violation be printed? */ SCIP_RESULT* result /**< pointer to store the result */ ) { SCIP_CONSDATA* consdata; SCIP_CONS** conss; int nconss; int i; assert(result != NULL); consdata = SCIPconsGetData(cons); assert(consdata != NULL); conss = consdata->conss; assert(conss != NULL); nconss = consdata->nconss; assert(nconss > 0); *result = SCIP_INFEASIBLE; /* check all constraints */ for( i = 0; i < nconss && *result != SCIP_FEASIBLE; ++i ) { SCIP_CALL( SCIPcheckCons(scip, conss[i], sol, checkintegrality, checklprows, printreason, result) ); assert(*result == SCIP_FEASIBLE || *result == SCIP_INFEASIBLE); } return SCIP_OKAY; }