예제 #1
0
 public VariableGenerator(InstanceGenerator.InstanceGeneratorMain pInstData, Gurobi.GRBModel pModel)
 {
     InstData    = pInstData;
     Model       = pModel;
     depot_usage = new GRBVar[InstData.getInstanceConfig().n_depots, InstData.getInstanceConfig().time_periods];
     customer_depot_designation = new GRBVar[InstData.getInstanceConfig().n_nodes, InstData.getInstanceConfig().n_depots, InstData.getInstanceConfig().time_periods];
     group_is_serviced          = new GRBVar[InstData.getInstanceConfig().number_of_priority_groups, InstData.getInstanceConfig().time_periods];
 }
예제 #2
0
        static void Main(string[] args)
        {
            InstanceGeneratorConfig instanceGeneratorConfig = new InstanceGeneratorConfig();
            InstanceGeneratorMain   IG = new InstanceGeneratorMain(instanceGeneratorConfig);

            IG.create_instance();
            InstanceDrawing instanceDrawing = new InstanceDrawing(IG, new DrawingSettings());

            instanceDrawing.draw("instance.bmp");
            return;
        }
예제 #3
0
        public InstanceDrawing(InstanceGeneratorMain pinstanceGenerator, DrawingSettings pdrawingSettings)
        {
            this.instanceGenerator = pinstanceGenerator;
            this.drawingSettings   = pdrawingSettings;

            this.image = new Bitmap((int)(instanceGenerator.getInstanceConfig().x_dim *drawingSettings.board_radius_factor), (int)(instanceGenerator.getInstanceConfig().y_dim *drawingSettings.board_radius_factor));
            Color color = ColorProgression.getColor(OBJECT_COLOR.NEUTRAL_BLACK);

            this.pen      = new Pen(color);
            this.brush    = new SolidBrush(color);
            this.graphics = Graphics.FromImage(this.image);
        }
예제 #4
0
        static int Main(string[] args)
        {
            try
            {
                ArgParser.parse_args(args);

                InstanceGeneratorConfig instanceGeneratorConfig = ArgParser.getInstanceGeneratorConfig();
                InstanceGeneratorMain   instanceGenerator       = new InstanceGenerator.InstanceGeneratorMain(instanceGeneratorConfig);
                instanceGenerator.create_instance();

                PMedian pMedianProblem = new PMedian(instanceGenerator, ArgParser.getDrawingPath() + "PMEDIAN");
                pMedianProblem.setup_problem();
                pMedianProblem.solve_instance(ArgParser.getModelRuntime());
                pMedianProblem.publish_model();

                if (ArgParser.getDrawingPath() != null)
                {
                    InstanceDrawing instanceDrawing = new InstanceDrawing(instanceGenerator, new DrawingSettings());
                    instanceDrawing.draw(ArgParser.getDrawingPath() + "instance");
                    pMedianProblem.draw_solution(instanceDrawing, ArgParser.getDrawingPath() + "solution");
                }

                if (ArgParser.results_filename != null)
                {
                    pMedianProblem.write_results_to_file(ArgParser.results_filename);
                }

                return(0);
                //else
                //{
                //    PMedianController.folder_cleanup(".bmp", ".lp", ".sol");

                //    InstanceGenerator.InstanceGeneratorMain instanceGenerator = new InstanceGenerator.InstanceGeneratorMain(new InstanceGeneratorConfig());
                //    instanceGenerator.create_instance();
                //    InstanceDrawing instanceDrawing = new InstanceDrawing(instanceGenerator, new DrawingSettings());
                //    instanceDrawing.draw("instance");
                //    PMedian pMedianProblem = new PMedian(instanceGenerator, "PMedian");
                //    pMedianProblem.setup_problem();
                //    pMedianProblem.solve_instance(7200);
                //    pMedianProblem.publish_model();
                //    pMedianProblem.draw_solution(instanceDrawing, "solution");

                //    return 0;
                //}
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                ArgParser.getHelp();
                return(1);
            }
        }
예제 #5
0
 public PMedian(InstanceGenerator.InstanceGeneratorMain pInstance, string pfilename = "PMEDIAN", string presults_filename = null)
     : base(new GRBEnv(pfilename + ".log"))
 {
     Instance = pInstance;
     filename = pfilename;
 }