void print_cc(const list<Region *> &locregs,TRel &tr, const SS &initial, int KMAX,const set<string> &localEvs)
{
    int pnumber = 0;
    map<Region *, string> places;
    map<string,int> marking;
    map<string,EvTRel *> events_tr = tr.get_map_trs();
    cout << "# number of necessary regions: " << locregs.size() << endl;
    cout << ".inputs";
    map<string,EvTRel *>::iterator ittr;
    for(ittr = events_tr.begin(); ittr != events_tr.end(); ++ittr) if (localEvs.find(ittr->first) != localEvs.end())cout << " " << ittr->first;
    cout << endl << ".graph" << endl;

//	bool notsafe = false;
    list<Region *>::const_iterator itmr;
    for(itmr = locregs.begin(); itmr != locregs.end(); ++itmr)
    {
//(*itmr)->print();
        std::ostringstream o;
        if (!(o << pnumber++)) cout << "Problems when converting an integer to a string\n";
        places[*itmr] = "p" + o.str();
        if ((*itmr)->cardinality(initial))
        {
            marking[places[*itmr]] = (*itmr)->cardinality(initial);
//			if (marking[places[*itmr]] > 1) notsafe = true;
        }
    }

    // detecting redundant arcs
    map <EvTRel *, map<Region *,bool> > selfloop_red;
    // arcs from places to transitions
    map<string,map<string,bool> > eventtoplaces;
    for(ittr = events_tr.begin(); ittr != events_tr.end(); ++ittr)
    {

        if (localEvs.find(ittr->first) == localEvs.end()) continue;

        string event = ittr->first;
        SS er_event = tr.get_event_tr(event)->get_er();
        list<Region *> pre_regions = compute_preregions(locregs,tr,er_event);
        bool pre_arc_inserted = false;
        for(itmr = pre_regions.begin(); itmr != pre_regions.end(); ++itmr)
        {
            if (not essential_arc(pre_regions,selfloop_red[tr.get_event_tr(event)],*itmr,tr.get_event_tr(event)))
            {
                //				cout << "event " << event << " is not connected to " << places[*itmr] <<  " " << pre_regions.size() <<endl;
            }
            else
            {
                pre_arc_inserted = true;
                Region *r = *itmr;
                Region max_topset = r->compute_max_enabling_topset(er_event);
                int k = max_topset.topset_weight();
// 			cout << "arc " << places[r] << " -- " << k << " -->" << event << endl;
                cout << places[r] << " " << event;
                if (k>1) cout << "(" << k << ") ";
                cout << endl;
                int k1,k2;
                r->corner_gradients(event,tr, k1, k2);
                if (k1 != k2) r->print();
                assert(k1==k2);
                if (k1 > -k)
                {
//	cout << "# arc(II) " << event <<  " k: " << k << " k1: " << k1  << " -->" << places[r]  << endl;
//  r->print();
                    eventtoplaces[event][places[r]] = true;
                    cout << event << " " << places[r];
                    if (k+k1>1) cout << "(" << k+k1 << ") ";
                    cout << endl;
                }
            }
        }
        // events without pre-regions: this is an option for pn mining
        if (not pre_arc_inserted and (not er_event.is_empty())) cout << event << endl;
    }

    // arcs from transitions to places
    for(ittr = events_tr.begin(); ittr != events_tr.end(); ++ittr)
    {

        if (localEvs.find(ittr->first) == localEvs.end()) continue;

        string event = ittr->first;
        SS er_event = tr.get_event_tr(event)->get_er();
        SS sr_event = tr.get_event_tr(event)->get_sr();
        for(itmr = locregs.begin(); itmr != locregs.end(); ++itmr)
        {
            Region *r = *itmr;
            if (sr_event <= r->sup() and not eventtoplaces[event][places[r]]/*and er_event * r->sup() == mgr.bddZero()*/)
            {
                int k1,k2;
//				r->recheck_gradients(tr,false);
                r->corner_gradients(event,tr, k1, k2);
                assert(k1 == k2);
                if (k1>0)
                {
                    //cout << "arc " << event <<  " -- " << k1 << " -->" << places[r]  << endl;
                    cout << event << " " << places[r];
                    if (k1>1) cout << "(" << k1 << ") ";
                    cout << endl;
                }
            }
        }
    }

    if (KMAX > 1)
    {

        cout << ".capacity ";
        list<Region *>::const_iterator itmr;
        for(itmr = locregs.begin(); itmr != locregs.end(); ++itmr)
        {
            cout << " " << places[*itmr] << "=" << KMAX;
        }
        cout <<  endl;
    }

    cout << ".marking {";
    map<string,int>::const_iterator itmark;
    for(itmark = marking.begin(); itmark != marking.end(); ++itmark)
    {
        if (itmark->second > 1) cout << " " << itmark->first << "=" << itmark->second;
        else cout << " " << itmark->first;
    }
    cout << " }\n" << ".end" << endl;

}