private static ArrayList<ArrayList<Double>> collect_initial_conditions(String grid_file_address,FwyNetwork fwy) throws Exception {

        // create the list of initial densities to test
        ArrayList<ArrayList<Double>> all_ic = new ArrayList<ArrayList<Double>>();

        try {

            // read grid points
            ReadFile file = new ReadFile(grid_file_address);
            ArrayList<ArrayList<Double>> gridValues = file.getTextContents();
            for (ArrayList<Double> grid : gridValues)
                for (Double densityFraction :grid)
                    if (densityFraction > 1)
                        throw new Exception("Density fraction greater than 1\n");

            int i0,i1,i2;
            ArrayList<Double> grid0 = gridValues.get(0);
            ArrayList<Double> grid1 = gridValues.get(1);
            ArrayList<Double> grid2 = gridValues.get(2);
            double jam_density0 = fwy.get_njam_veh_per_link(ml_link_ids.get(0));
            double jam_density1 = fwy.get_njam_veh_per_link(ml_link_ids.get(1));
            double jam_density2 = fwy.get_njam_veh_per_link(ml_link_ids.get(2));

            for (i0=0; i0<grid0.size(); i0++)
                for (i1=0; i1<grid1.size(); i1++)
                    for (i2=0; i2<grid2.size(); i2++){
                        ArrayList<Double> one_ic = new ArrayList<Double>();
                        one_ic.add( grid0.get(i0) * jam_density0 );
                        one_ic.add( grid1.get(i1) * jam_density1 );
                        one_ic.add( grid2.get(i2) * jam_density2 );
                        all_ic.add(one_ic);
                    }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return all_ic;

    }