pdebug(print_resource("Coloring", lh_resource, FALSE));
pdebug_action(print_resource("Coloring", lh_resource, FALSE));
color_resource(resource_t *lh_resource){	int lpc = 0;	pdebug(print_resource("Coloring", lh_resource, FALSE));		lh_resource->constraints = g_slist_sort(lh_resource->constraints, sort_cons_strength);	pdebug(cl_log(LOG_DEBUG, "=== Pre-processing"));	//------ Pre-processing	for(; lpc < g_slist_length(lh_resource->constraints); lpc++) {		color_t *other_color = NULL;		color_t *local_color = NULL;		rsc_constraint_t *constraint = (rsc_constraint_t*)			g_slist_nth_data(lh_resource->constraints, lpc);		pdebug(print_cons("Processing constraint", constraint, FALSE));		if(constraint->is_placement == FALSE) {			continue;		}		if(constraint->type != rsc_to_rsc) {			continue;		}		if(constraint->rsc_rh == NULL) {			cl_log(LOG_ERR, "rsc_rh was NULL for %s", constraint->id);			continue;		}		other_color = constraint->rsc_rh->color;		local_color = find_color(lh_resource->candidate_colors, other_color);		strict_preproc(constraint, local_color, other_color);			}		// filter out nodes with a negative weight	filter_nodes(lh_resource);  	/* Choose a color from the candidates or,	 *  create a new one if no color is suitable 	 * (this may need modification pending further napkin drawings)	 */	choose_color(lh_resource, lh_resource->candidate_colors);	  	pdebug(cl_log(LOG_DEBUG, "* Colors %d, Nodes %d",		      g_slist_length(colors),		      max_valid_nodes));		if(lh_resource->provisional		&& g_slist_length(colors) < max_valid_nodes) {		// Create new color		pdebug(cl_log(LOG_DEBUG, "Create a new color"));		current_color = create_color(lh_resource->allowed_nodes, FALSE);		lh_resource->color = current_color;		lh_resource->provisional = FALSE;	} else if(lh_resource->provisional) {		cl_log(LOG_ERR, "Could not color resource %s", lh_resource->id);		print_resource("ERROR: No color", lh_resource, FALSE);		lh_resource->color = no_color;		lh_resource->provisional = FALSE;			}		pdebug(print_resource("Post-processing", lh_resource, FALSE));	//------ Post-processing	for(lpc = 0; lh_resource->color != no_color		    && lpc < g_slist_length(lh_resource->constraints);lpc++) {		color_t *local_color = lh_resource->color;		color_t *other_color = NULL;		rsc_constraint_t *constraint = (rsc_constraint_t*)			g_slist_nth_data(lh_resource->constraints, lpc);		if(constraint->is_placement == FALSE) {			continue;		} else if(constraint->type != rsc_to_rsc) {			continue;		}				other_color = find_color(constraint->rsc_rh->candidate_colors,					 local_color);		strict_postproc(constraint, local_color, other_color);	}		pdebug(print_resource("Colored", lh_resource, FALSE));}