public static MDDManager getProxy(MDDStore store, List<?> customOrder) {
		MDDVariable[] rawVariables = store.getAllVariables();
		
		// build order mapping
		boolean sameOrder = rawVariables.length == customOrder.size();
		int[] custom2store = new int[customOrder.size()];
		for (int i=0 ; i<custom2store.length ; i++) {
			custom2store[i] = -1;
		}
		int i = 0;
		for (Object v: customOrder) {
			MDDVariable var = store.getVariableForKey(v);
			if (var.order != i) {
				sameOrder = false;
			}
			custom2store[i] = var.order;
			i++;
		}
		
		if (sameOrder) {
			// no order mapping is needed
			return store;
		}
		
		// save the order mapping and compute the reverse one
		int[] store2custom = new int[rawVariables.length];
		for (i=0 ; i<store2custom.length ; i++) {
			store2custom[i] = -1;
		}
		i=0;
		for (int k: custom2store) {
			if (k >= 0) {
				store2custom[k] = i;
			}
			i++;
		}
		return new MDDManagerProxy(store, custom2store, store2custom);
	}