Segregation of granular mixtures in presence of compaction