maintenance_problem_test.cpp 1.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
#include <fstream>
#include <cstdlib>

#include "./Specialization/LP_Problems/Maintenance_Problem.h"
#include "./Specialization/LP_Problems/maintenance_problem_generator.h"

int main(){

  maintenance_problem_generator mpg (
    random_graph_generator<CircSelectNodeFields, CircSelectEdgeFields>(
      {{Flow, Attribute(max, 0)}, {Demand, Attribute(fix, 0)}, {Capacity, Attribute(fix, 1)}, {Critical, Attribute(fix, 0)}},
      {},
14 15 16
      4,
      random_attribute_generator<CircSelectEdgeFields>({ {Capacity, {Integral, 0, 5}} }),
      4,
17 18
      random_attribute_generator<CircSelectNodeFields>({})
    ),
19
    3, 2
20 21 22
  );

  while(true){
Jonas Seidel's avatar
Jonas Seidel committed
23
    system("killall graph_display");
24 25 26
    Maintenance_Problem mp;
    mpg >> mp;

Jonas Seidel's avatar
Jonas Seidel committed
27 28 29
    std::ofstream ofs_graph("./.data/Maintenance_Problem/mp.netw");
    ofs_graph << mp.network() << std::endl;
    ofs_graph.close();
Jonas Seidel's avatar
Jonas Seidel committed
30
    system("cd ../display/graph_display/ && (./graph_display --file ../../discrete_optimization_library/.data/Maintenance_Problem/mp.netw &) && cd ../../discrete_optimization_library");
Jonas Seidel's avatar
Jonas Seidel committed
31 32 33

    std::ofstream ofs_program("./.data/Maintenance_Problem/mp.lp");
    ofs_program << mp << std::endl;
34
    std::cout << mp << std::endl;
Jonas Seidel's avatar
Jonas Seidel committed
35
    ofs_program.close();
36

37 38 39 40 41
    system("polymake --script .data/Maintenance_Problem/pm_script_lp2facets");

    std::cin.ignore();
  }
}