#include "Include/model_from_solver_generator.h"
#include "Include/objects.h"

void generate_model_close_trains_solver(ModelRoot *model) {

  Train *train0 = &train0_obj;
  Train *train1 = &train1_obj;
  Train *train2 = &train2_obj;
  Train *train3 = &train3_obj;
  Train *train4 = &train4_obj;
  SimpleSegment *simplesegment5 = &simplesegment5_obj;
  SimpleSegment *simplesegment6 = &simplesegment6_obj;
  SimpleSegment *simplesegment7 = &simplesegment7_obj;
  SimpleSegment *simplesegment8 = &simplesegment8_obj;
  SimpleSegment *simplesegment9 = &simplesegment9_obj;
  SimpleSegment *simplesegment10 = &simplesegment10_obj;
  SimpleSegment *simplesegment11 = &simplesegment11_obj;
  SimpleSegment *simplesegment12 = &simplesegment12_obj;
  SimpleSegment *simplesegment13 = &simplesegment13_obj;
  SimpleSegment *simplesegment14 = &simplesegment14_obj;
  SimpleSegment *simplesegment4 = &simplesegment4_obj;
  SimpleSegment *simplesegment3 = &simplesegment3_obj;
  SimpleSegment *simplesegment2 = &simplesegment2_obj;
  SimpleSegment *simplesegment1 = &simplesegment1_obj;
  SimpleSegment *simplesegment0 = &simplesegment0_obj;
  Turnout *turnout0 = &turnout0_obj;
  Turnout *turnout1 = &turnout1_obj;
  Turnout *turnout2 = &turnout2_obj;
  Turnout *turnout3 = &turnout3_obj;
  Turnout *turnout4 = &turnout4_obj;
  

  ((Segment *) simplesegment5)->segment_id = 5;
  ((Segment *) simplesegment5)->connected_to[0] = (Segment *) turnout0;
  ((Segment *) simplesegment5)->connected_to[1] = (Segment *) turnout4;
  ((Segment *) simplesegment5)->connected_to_count = 2;
  ((Segment *) simplesegment5)->train =  train2 ;
  model->segments[5] = (Segment *) simplesegment5;

  ((Segment *) simplesegment6)->segment_id = 6;
  ((Segment *) simplesegment6)->connected_to[0] = (Segment *) simplesegment3;
  ((Segment *) simplesegment6)->connected_to[1] = (Segment *) simplesegment0;
  ((Segment *) simplesegment6)->connected_to_count = 2;
  ((Segment *) simplesegment6)->train =  NULL;
  model->segments[6] = (Segment *) simplesegment6;

  ((Segment *) simplesegment7)->segment_id = 7;
  ((Segment *) simplesegment7)->connected_to[0] = (Segment *) simplesegment8;
  ((Segment *) simplesegment7)->connected_to[1] = (Segment *) simplesegment11;
  ((Segment *) simplesegment7)->connected_to_count = 2;
  ((Segment *) simplesegment7)->train =  NULL;
  model->segments[7] = (Segment *) simplesegment7;

  ((Segment *) simplesegment8)->segment_id = 8;
  ((Segment *) simplesegment8)->connected_to[0] = (Segment *) simplesegment7;
  ((Segment *) simplesegment8)->connected_to[1] = (Segment *) simplesegment1;
  ((Segment *) simplesegment8)->connected_to_count = 2;
  ((Segment *) simplesegment8)->train =  NULL;
  model->segments[8] = (Segment *) simplesegment8;

  ((Segment *) simplesegment9)->segment_id = 9;
  ((Segment *) simplesegment9)->connected_to[0] = (Segment *) simplesegment11;
  ((Segment *) simplesegment9)->connected_to[1] = (Segment *) simplesegment3;
  ((Segment *) simplesegment9)->connected_to_count = 2;
  ((Segment *) simplesegment9)->train =  NULL;
  model->segments[9] = (Segment *) simplesegment9;

  ((Segment *) simplesegment10)->segment_id = 10;
  ((Segment *) simplesegment10)->connected_to_count = 0;
  ((Segment *) simplesegment10)->train =  NULL;
  model->segments[10] = (Segment *) simplesegment10;

  ((Segment *) simplesegment11)->segment_id = 11;
  ((Segment *) simplesegment11)->connected_to[0] = (Segment *) simplesegment7;
  ((Segment *) simplesegment11)->connected_to[1] = (Segment *) simplesegment9;
  ((Segment *) simplesegment11)->connected_to_count = 2;
  ((Segment *) simplesegment11)->train =  NULL;
  model->segments[11] = (Segment *) simplesegment11;

  ((Segment *) simplesegment12)->segment_id = 12;
  ((Segment *) simplesegment12)->connected_to[0] = (Segment *) simplesegment13;
  ((Segment *) simplesegment12)->connected_to[1] = (Segment *) simplesegment4;
  ((Segment *) simplesegment12)->connected_to_count = 2;
  ((Segment *) simplesegment12)->train =  NULL;
  model->segments[12] = (Segment *) simplesegment12;

  ((Segment *) simplesegment13)->segment_id = 13;
  ((Segment *) simplesegment13)->connected_to[0] = (Segment *) simplesegment12;
  ((Segment *) simplesegment13)->connected_to[1] = (Segment *) simplesegment1;
  ((Segment *) simplesegment13)->connected_to_count = 2;
  ((Segment *) simplesegment13)->train =  NULL;
  model->segments[13] = (Segment *) simplesegment13;

  ((Segment *) simplesegment14)->segment_id = 14;
  ((Segment *) simplesegment14)->connected_to[0] = (Segment *) simplesegment4;
  ((Segment *) simplesegment14)->connected_to_count = 1;
  ((Segment *) simplesegment14)->train =  NULL;
  model->segments[14] = (Segment *) simplesegment14;

  ((Segment *) simplesegment4)->segment_id = 4;
  ((Segment *) simplesegment4)->connected_to[0] = (Segment *) simplesegment12;
  ((Segment *) simplesegment4)->connected_to[1] = (Segment *) simplesegment14;
  ((Segment *) simplesegment4)->connected_to_count = 2;
  ((Segment *) simplesegment4)->train =  NULL;
  model->segments[4] = (Segment *) simplesegment4;

  ((Segment *) simplesegment3)->segment_id = 3;
  ((Segment *) simplesegment3)->connected_to[0] = (Segment *) simplesegment6;
  ((Segment *) simplesegment3)->connected_to[1] = (Segment *) simplesegment9;
  ((Segment *) simplesegment3)->connected_to_count = 2;
  ((Segment *) simplesegment3)->train =  NULL;
  model->segments[3] = (Segment *) simplesegment3;

  ((Segment *) simplesegment2)->segment_id = 2;
  ((Segment *) simplesegment2)->connected_to[0] = (Segment *) turnout1;
  ((Segment *) simplesegment2)->connected_to[1] = (Segment *) turnout2;
  ((Segment *) simplesegment2)->connected_to_count = 2;
  ((Segment *) simplesegment2)->train =  NULL;
  model->segments[2] = (Segment *) simplesegment2;

  ((Segment *) simplesegment1)->segment_id = 1;
  ((Segment *) simplesegment1)->connected_to[0] = (Segment *) simplesegment8;
  ((Segment *) simplesegment1)->connected_to[1] = (Segment *) simplesegment13;
  ((Segment *) simplesegment1)->connected_to_count = 2;
  ((Segment *) simplesegment1)->train =  NULL;
  model->segments[1] = (Segment *) simplesegment1;

  ((Segment *) simplesegment0)->segment_id = 0;
  ((Segment *) simplesegment0)->connected_to[0] = (Segment *) simplesegment6;
  ((Segment *) simplesegment0)->connected_to_count = 1;
  ((Segment *) simplesegment0)->train =  NULL;
  model->segments[0] = (Segment *) simplesegment0;

  ((Segment *) turnout0)->segment_id = 0;
  ((Segment *) turnout0)->connected_to[0] = (Segment *) simplesegment5;
  ((Segment *) turnout0)->connected_to[1] = (Segment *) turnout4;
  ((Segment *) turnout0)->connected_to_count = 2;
  ((Segment *) turnout0)->train =  train0 ;
  model->segments[15] = (Segment *) turnout0;
  turnout0->straight = (Segment *) simplesegment10;
  turnout0->divergent = (Segment *) turnout4;
  model->turnouts[0] = turnout0;

  ((Segment *) turnout1)->segment_id = 1;
  ((Segment *) turnout1)->connected_to[0] = (Segment *) turnout3;
  ((Segment *) turnout1)->connected_to[1] = (Segment *) simplesegment2;
  ((Segment *) turnout1)->connected_to_count = 2;
  ((Segment *) turnout1)->train =  train4 ;
  model->segments[16] = (Segment *) turnout1;
  turnout1->straight = (Segment *) turnout3;
  turnout1->divergent = (Segment *) simplesegment14;
  model->turnouts[1] = turnout1;

  ((Segment *) turnout2)->segment_id = 2;
  ((Segment *) turnout2)->connected_to[0] = (Segment *) turnout3;
  ((Segment *) turnout2)->connected_to[1] = (Segment *) simplesegment2;
  ((Segment *) turnout2)->connected_to_count = 2;
  ((Segment *) turnout2)->train =  train1 ;
  model->segments[17] = (Segment *) turnout2;
  turnout2->straight = (Segment *) turnout3;
  turnout2->divergent = (Segment *) simplesegment10;
  model->turnouts[2] = turnout2;

  ((Segment *) turnout3)->segment_id = 3;
  ((Segment *) turnout3)->connected_to[0] = (Segment *) turnout1;
  ((Segment *) turnout3)->connected_to[1] = (Segment *) turnout2;
  ((Segment *) turnout3)->connected_to_count = 2;
  ((Segment *) turnout3)->train =  NULL;
  model->segments[18] = (Segment *) turnout3;
  turnout3->straight = (Segment *) turnout2;
  turnout3->divergent = (Segment *) turnout4;
  model->turnouts[3] = turnout3;

  ((Segment *) turnout4)->segment_id = 4;
  ((Segment *) turnout4)->connected_to[0] = (Segment *) simplesegment5;
  ((Segment *) turnout4)->connected_to[1] = (Segment *) turnout0;
  ((Segment *) turnout4)->connected_to_count = 2;
  ((Segment *) turnout4)->train =  train3 ;
  model->segments[19] = (Segment *) turnout4;
  turnout4->straight = (Segment *) turnout3;
  turnout4->divergent = (Segment *) simplesegment5;
  model->turnouts[4] = turnout4;

  train0->train_id = 0;
  train0->speed = 76.0;
  train0->location = (Segment *) turnout0;
  model->trains[0] = train0;

  train1->train_id = 1;
  train1->speed = 0.0;
  train1->location = (Segment *) turnout2;
  model->trains[1] = train1;

  train2->train_id = 2;
  train2->speed = 58.0;
  train2->location = (Segment *) simplesegment5;
  model->trains[2] = train2;

  train3->train_id = 3;
  train3->speed = 2.0;
  train3->location = (Segment *) turnout4;
  model->trains[3] = train3;

  train4->train_id = 4;
  train4->speed = 66.0;
  train4->location = (Segment *) turnout1;
  model->trains[4] = train4;

  model->segment_count = 15;
  model->turnout_count = 5;
  model->train_count = 5;
}
void generate_model_misaligned_turnout_solver(ModelRoot *model) {

  Train *train0 = &train0_obj;
  Train *train1 = &train1_obj;
  Train *train2 = &train2_obj;
  Train *train3 = &train3_obj;
  Train *train4 = &train4_obj;
  SimpleSegment *simplesegment5 = &simplesegment5_obj;
  SimpleSegment *simplesegment6 = &simplesegment6_obj;
  SimpleSegment *simplesegment7 = &simplesegment7_obj;
  SimpleSegment *simplesegment8 = &simplesegment8_obj;
  SimpleSegment *simplesegment9 = &simplesegment9_obj;
  SimpleSegment *simplesegment10 = &simplesegment10_obj;
  SimpleSegment *simplesegment11 = &simplesegment11_obj;
  SimpleSegment *simplesegment12 = &simplesegment12_obj;
  SimpleSegment *simplesegment13 = &simplesegment13_obj;
  SimpleSegment *simplesegment14 = &simplesegment14_obj;
  SimpleSegment *simplesegment4 = &simplesegment4_obj;
  SimpleSegment *simplesegment3 = &simplesegment3_obj;
  SimpleSegment *simplesegment2 = &simplesegment2_obj;
  SimpleSegment *simplesegment1 = &simplesegment1_obj;
  SimpleSegment *simplesegment0 = &simplesegment0_obj;
  Turnout *turnout0 = &turnout0_obj;
  Turnout *turnout1 = &turnout1_obj;
  Turnout *turnout2 = &turnout2_obj;
  Turnout *turnout3 = &turnout3_obj;
  Turnout *turnout4 = &turnout4_obj;
  

  ((Segment *) simplesegment5)->segment_id = 5;
  ((Segment *) simplesegment5)->connected_to[0] = (Segment *) simplesegment4;
  ((Segment *) simplesegment5)->connected_to[1] = (Segment *) simplesegment2;
  ((Segment *) simplesegment5)->connected_to_count = 2;
  ((Segment *) simplesegment5)->train =  NULL;
  model->segments[5] = (Segment *) simplesegment5;

  ((Segment *) simplesegment6)->segment_id = 6;
  ((Segment *) simplesegment6)->connected_to[0] = (Segment *) simplesegment14;
  ((Segment *) simplesegment6)->connected_to[1] = (Segment *) simplesegment2;
  ((Segment *) simplesegment6)->connected_to_count = 2;
  ((Segment *) simplesegment6)->train =  NULL;
  model->segments[6] = (Segment *) simplesegment6;

  ((Segment *) simplesegment7)->segment_id = 7;
  ((Segment *) simplesegment7)->connected_to[0] = (Segment *) simplesegment9;
  ((Segment *) simplesegment7)->connected_to[1] = (Segment *) simplesegment12;
  ((Segment *) simplesegment7)->connected_to_count = 2;
  ((Segment *) simplesegment7)->train =  NULL;
  model->segments[7] = (Segment *) simplesegment7;

  ((Segment *) simplesegment8)->segment_id = 8;
  ((Segment *) simplesegment8)->connected_to[0] = (Segment *) turnout0;
  ((Segment *) simplesegment8)->connected_to[1] = (Segment *) turnout2;
  ((Segment *) simplesegment8)->connected_to_count = 2;
  ((Segment *) simplesegment8)->train =  NULL;
  model->segments[8] = (Segment *) simplesegment8;

  ((Segment *) simplesegment9)->segment_id = 9;
  ((Segment *) simplesegment9)->connected_to[0] = (Segment *) simplesegment7;
  ((Segment *) simplesegment9)->connected_to_count = 1;
  ((Segment *) simplesegment9)->train =  NULL;
  model->segments[9] = (Segment *) simplesegment9;

  ((Segment *) simplesegment10)->segment_id = 10;
  ((Segment *) simplesegment10)->connected_to[0] = (Segment *) simplesegment12;
  ((Segment *) simplesegment10)->connected_to[1] = (Segment *) simplesegment4;
  ((Segment *) simplesegment10)->connected_to_count = 2;
  ((Segment *) simplesegment10)->train =  NULL;
  model->segments[10] = (Segment *) simplesegment10;

  ((Segment *) simplesegment11)->segment_id = 11;
  ((Segment *) simplesegment11)->connected_to[0] = (Segment *) turnout3;
  ((Segment *) simplesegment11)->connected_to[1] = (Segment *) simplesegment3;
  ((Segment *) simplesegment11)->connected_to_count = 2;
  ((Segment *) simplesegment11)->train =  NULL;
  model->segments[11] = (Segment *) simplesegment11;

  ((Segment *) simplesegment12)->segment_id = 12;
  ((Segment *) simplesegment12)->connected_to[0] = (Segment *) simplesegment7;
  ((Segment *) simplesegment12)->connected_to[1] = (Segment *) simplesegment10;
  ((Segment *) simplesegment12)->connected_to_count = 2;
  ((Segment *) simplesegment12)->train =  NULL;
  model->segments[12] = (Segment *) simplesegment12;

  ((Segment *) simplesegment13)->segment_id = 13;
  ((Segment *) simplesegment13)->connected_to[0] = (Segment *) turnout4;
  ((Segment *) simplesegment13)->connected_to[1] = (Segment *) simplesegment0;
  ((Segment *) simplesegment13)->connected_to_count = 2;
  ((Segment *) simplesegment13)->train =  NULL;
  model->segments[13] = (Segment *) simplesegment13;

  ((Segment *) simplesegment14)->segment_id = 14;
  ((Segment *) simplesegment14)->connected_to[0] = (Segment *) simplesegment6;
  ((Segment *) simplesegment14)->connected_to[1] = (Segment *) turnout3;
  ((Segment *) simplesegment14)->connected_to_count = 2;
  ((Segment *) simplesegment14)->train =  NULL;
  model->segments[14] = (Segment *) simplesegment14;

  ((Segment *) simplesegment4)->segment_id = 4;
  ((Segment *) simplesegment4)->connected_to[0] = (Segment *) simplesegment5;
  ((Segment *) simplesegment4)->connected_to[1] = (Segment *) simplesegment10;
  ((Segment *) simplesegment4)->connected_to_count = 2;
  ((Segment *) simplesegment4)->train =  NULL;
  model->segments[4] = (Segment *) simplesegment4;

  ((Segment *) simplesegment3)->segment_id = 3;
  ((Segment *) simplesegment3)->connected_to[0] = (Segment *) turnout1;
  ((Segment *) simplesegment3)->connected_to[1] = (Segment *) simplesegment11;
  ((Segment *) simplesegment3)->connected_to_count = 2;
  ((Segment *) simplesegment3)->train =  NULL;
  model->segments[3] = (Segment *) simplesegment3;

  ((Segment *) simplesegment2)->segment_id = 2;
  ((Segment *) simplesegment2)->connected_to[0] = (Segment *) simplesegment5;
  ((Segment *) simplesegment2)->connected_to[1] = (Segment *) simplesegment6;
  ((Segment *) simplesegment2)->connected_to_count = 2;
  ((Segment *) simplesegment2)->train =  NULL;
  model->segments[2] = (Segment *) simplesegment2;

  ((Segment *) simplesegment1)->segment_id = 1;
  ((Segment *) simplesegment1)->connected_to[0] = (Segment *) turnout1;
  ((Segment *) simplesegment1)->connected_to_count = 1;
  ((Segment *) simplesegment1)->train =  train0 ;
  model->segments[1] = (Segment *) simplesegment1;

  ((Segment *) simplesegment0)->segment_id = 0;
  ((Segment *) simplesegment0)->connected_to[0] = (Segment *) turnout4;
  ((Segment *) simplesegment0)->connected_to[1] = (Segment *) simplesegment13;
  ((Segment *) simplesegment0)->connected_to_count = 2;
  ((Segment *) simplesegment0)->train =  train3 ;
  model->segments[0] = (Segment *) simplesegment0;

  ((Segment *) turnout0)->segment_id = 0;
  ((Segment *) turnout0)->connected_to[0] = (Segment *) simplesegment8;
  ((Segment *) turnout0)->connected_to_count = 1;
  ((Segment *) turnout0)->train =  train4 ;
  model->segments[15] = (Segment *) turnout0;
  turnout0->straight = (Segment *) turnout2;
  turnout0->divergent = (Segment *) simplesegment8;
  model->turnouts[0] = turnout0;

  ((Segment *) turnout1)->segment_id = 1;
  ((Segment *) turnout1)->connected_to[0] = (Segment *) simplesegment3;
  ((Segment *) turnout1)->connected_to[1] = (Segment *) simplesegment1;
  ((Segment *) turnout1)->connected_to_count = 2;
  ((Segment *) turnout1)->train =  NULL;
  model->segments[16] = (Segment *) turnout1;
  turnout1->straight = (Segment *) turnout0;
  turnout1->divergent = (Segment *) simplesegment1;
  model->turnouts[1] = turnout1;

  ((Segment *) turnout2)->segment_id = 2;
  ((Segment *) turnout2)->connected_to[0] = (Segment *) simplesegment8;
  ((Segment *) turnout2)->connected_to_count = 1;
  ((Segment *) turnout2)->train =  train1 ;
  model->segments[17] = (Segment *) turnout2;
  turnout2->straight = (Segment *) turnout0;
  turnout2->divergent = (Segment *) turnout4;
  model->turnouts[2] = turnout2;

  ((Segment *) turnout3)->segment_id = 3;
  ((Segment *) turnout3)->connected_to[0] = (Segment *) simplesegment11;
  ((Segment *) turnout3)->connected_to[1] = (Segment *) simplesegment14;
  ((Segment *) turnout3)->connected_to_count = 2;
  ((Segment *) turnout3)->train =  NULL;
  model->segments[18] = (Segment *) turnout3;
  turnout3->straight = (Segment *) simplesegment1;
  turnout3->divergent = (Segment *) simplesegment11;
  model->turnouts[3] = turnout3;

  ((Segment *) turnout4)->segment_id = 4;
  ((Segment *) turnout4)->connected_to[0] = (Segment *) simplesegment13;
  ((Segment *) turnout4)->connected_to[1] = (Segment *) simplesegment0;
  ((Segment *) turnout4)->connected_to_count = 2;
  ((Segment *) turnout4)->train =  train2 ;
  model->segments[19] = (Segment *) turnout4;
  turnout4->straight = (Segment *) turnout2;
  turnout4->divergent = (Segment *) simplesegment0;
  model->turnouts[4] = turnout4;

  train0->train_id = 0;
  train0->speed = 76.0;
  train0->location = (Segment *) simplesegment1;
  model->trains[0] = train0;

  train1->train_id = 1;
  train1->speed = 0.0;
  train1->location = (Segment *) turnout2;
  model->trains[1] = train1;

  train2->train_id = 2;
  train2->speed = 58.0;
  train2->location = (Segment *) turnout4;
  model->trains[2] = train2;

  train3->train_id = 3;
  train3->speed = 2.0;
  train3->location = (Segment *) simplesegment0;
  model->trains[3] = train3;

  train4->train_id = 4;
  train4->speed = 66.0;
  train4->location = (Segment *) turnout0;
  model->trains[4] = train4;

  model->segment_count = 15;
  model->turnout_count = 5;
  model->train_count = 5;
}
void generate_model_end_of_siding_solver(ModelRoot *model) {

  Train *train0 = &train0_obj;
  Train *train1 = &train1_obj;
  Train *train2 = &train2_obj;
  Train *train3 = &train3_obj;
  Train *train4 = &train4_obj;
  SimpleSegment *simplesegment0 = &simplesegment0_obj;
  SimpleSegment *simplesegment1 = &simplesegment1_obj;
  SimpleSegment *simplesegment2 = &simplesegment2_obj;
  SimpleSegment *simplesegment3 = &simplesegment3_obj;
  SimpleSegment *simplesegment4 = &simplesegment4_obj;
  SimpleSegment *simplesegment5 = &simplesegment5_obj;
  SimpleSegment *simplesegment6 = &simplesegment6_obj;
  SimpleSegment *simplesegment7 = &simplesegment7_obj;
  SimpleSegment *simplesegment8 = &simplesegment8_obj;
  SimpleSegment *simplesegment9 = &simplesegment9_obj;
  SimpleSegment *simplesegment10 = &simplesegment10_obj;
  SimpleSegment *simplesegment11 = &simplesegment11_obj;
  SimpleSegment *simplesegment12 = &simplesegment12_obj;
  SimpleSegment *simplesegment13 = &simplesegment13_obj;
  SimpleSegment *simplesegment14 = &simplesegment14_obj;
  Turnout *turnout0 = &turnout0_obj;
  Turnout *turnout1 = &turnout1_obj;
  Turnout *turnout2 = &turnout2_obj;
  Turnout *turnout3 = &turnout3_obj;
  Turnout *turnout4 = &turnout4_obj;
  

  ((Segment *) simplesegment0)->segment_id = 0;
  ((Segment *) simplesegment0)->connected_to[0] = (Segment *) turnout2;
  ((Segment *) simplesegment0)->connected_to_count = 1;
  ((Segment *) simplesegment0)->train =  NULL;
  model->segments[0] = (Segment *) simplesegment0;

  ((Segment *) simplesegment1)->segment_id = 1;
  ((Segment *) simplesegment1)->connected_to[0] = (Segment *) simplesegment8;
  ((Segment *) simplesegment1)->connected_to[1] = (Segment *) simplesegment10;
  ((Segment *) simplesegment1)->connected_to_count = 2;
  ((Segment *) simplesegment1)->train =  NULL;
  model->segments[1] = (Segment *) simplesegment1;

  ((Segment *) simplesegment2)->segment_id = 2;
  ((Segment *) simplesegment2)->connected_to[0] = (Segment *) simplesegment4;
  ((Segment *) simplesegment2)->connected_to[1] = (Segment *) simplesegment5;
  ((Segment *) simplesegment2)->connected_to_count = 2;
  ((Segment *) simplesegment2)->train =  train1 ;
  model->segments[2] = (Segment *) simplesegment2;

  ((Segment *) simplesegment3)->segment_id = 3;
  ((Segment *) simplesegment3)->connected_to[0] = (Segment *) turnout1;
  ((Segment *) simplesegment3)->connected_to_count = 1;
  ((Segment *) simplesegment3)->train =  NULL;
  model->segments[3] = (Segment *) simplesegment3;

  ((Segment *) simplesegment4)->segment_id = 4;
  ((Segment *) simplesegment4)->connected_to[0] = (Segment *) simplesegment2;
  ((Segment *) simplesegment4)->connected_to_count = 1;
  ((Segment *) simplesegment4)->train =  NULL;
  model->segments[4] = (Segment *) simplesegment4;

  ((Segment *) simplesegment5)->segment_id = 5;
  ((Segment *) simplesegment5)->connected_to[0] = (Segment *) simplesegment2;
  ((Segment *) simplesegment5)->connected_to_count = 1;
  ((Segment *) simplesegment5)->train =  NULL;
  model->segments[5] = (Segment *) simplesegment5;

  ((Segment *) simplesegment6)->segment_id = 6;
  ((Segment *) simplesegment6)->connected_to[0] = (Segment *) turnout2;
  ((Segment *) simplesegment6)->connected_to_count = 1;
  ((Segment *) simplesegment6)->train =  NULL;
  model->segments[6] = (Segment *) simplesegment6;

  ((Segment *) simplesegment7)->segment_id = 7;
  ((Segment *) simplesegment7)->connected_to[0] = (Segment *) simplesegment8;
  ((Segment *) simplesegment7)->connected_to_count = 1;
  ((Segment *) simplesegment7)->train =  NULL;
  model->segments[7] = (Segment *) simplesegment7;

  ((Segment *) simplesegment8)->segment_id = 8;
  ((Segment *) simplesegment8)->connected_to[0] = (Segment *) simplesegment1;
  ((Segment *) simplesegment8)->connected_to[1] = (Segment *) simplesegment7;
  ((Segment *) simplesegment8)->connected_to_count = 2;
  ((Segment *) simplesegment8)->train =  NULL;
  model->segments[8] = (Segment *) simplesegment8;

  ((Segment *) simplesegment9)->segment_id = 9;
  ((Segment *) simplesegment9)->connected_to[0] = (Segment *) simplesegment13;
  ((Segment *) simplesegment9)->connected_to_count = 1;
  ((Segment *) simplesegment9)->train =  NULL;
  model->segments[9] = (Segment *) simplesegment9;

  ((Segment *) simplesegment10)->segment_id = 10;
  ((Segment *) simplesegment10)->connected_to[0] = (Segment *) simplesegment1;
  ((Segment *) simplesegment10)->connected_to[1] = (Segment *) turnout3;
  ((Segment *) simplesegment10)->connected_to_count = 2;
  ((Segment *) simplesegment10)->train =  NULL;
  model->segments[10] = (Segment *) simplesegment10;

  ((Segment *) simplesegment11)->segment_id = 11;
  ((Segment *) simplesegment11)->connected_to[0] = (Segment *) simplesegment12;
  ((Segment *) simplesegment11)->connected_to[1] = (Segment *) simplesegment14;
  ((Segment *) simplesegment11)->connected_to_count = 2;
  ((Segment *) simplesegment11)->train =  train3 ;
  model->segments[11] = (Segment *) simplesegment11;

  ((Segment *) simplesegment12)->segment_id = 12;
  ((Segment *) simplesegment12)->connected_to[0] = (Segment *) simplesegment11;
  ((Segment *) simplesegment12)->connected_to_count = 1;
  ((Segment *) simplesegment12)->train =  NULL;
  model->segments[12] = (Segment *) simplesegment12;

  ((Segment *) simplesegment13)->segment_id = 13;
  ((Segment *) simplesegment13)->connected_to[0] = (Segment *) simplesegment9;
  ((Segment *) simplesegment13)->connected_to[1] = (Segment *) turnout4;
  ((Segment *) simplesegment13)->connected_to_count = 2;
  ((Segment *) simplesegment13)->train =  train4 ;
  model->segments[13] = (Segment *) simplesegment13;

  ((Segment *) simplesegment14)->segment_id = 14;
  ((Segment *) simplesegment14)->connected_to[0] = (Segment *) simplesegment11;
  ((Segment *) simplesegment14)->connected_to_count = 1;
  ((Segment *) simplesegment14)->train =  NULL;
  model->segments[14] = (Segment *) simplesegment14;

  ((Segment *) turnout0)->segment_id = 0;
  ((Segment *) turnout0)->connected_to[0] = (Segment *) turnout1;
  ((Segment *) turnout0)->connected_to_count = 1;
  ((Segment *) turnout0)->train =  NULL;
  model->segments[15] = (Segment *) turnout0;
  turnout0->straight = (Segment *) simplesegment5;
  turnout0->divergent = (Segment *) turnout1;
  model->turnouts[0] = turnout0;

  ((Segment *) turnout1)->segment_id = 1;
  ((Segment *) turnout1)->connected_to[0] = (Segment *) turnout0;
  ((Segment *) turnout1)->connected_to[1] = (Segment *) simplesegment3;
  ((Segment *) turnout1)->connected_to_count = 2;
  ((Segment *) turnout1)->train =  train2 ;
  model->segments[16] = (Segment *) turnout1;
  turnout1->straight = (Segment *) simplesegment0;
  turnout1->divergent = (Segment *) turnout0;
  model->turnouts[1] = turnout1;

  ((Segment *) turnout2)->segment_id = 2;
  ((Segment *) turnout2)->connected_to[0] = (Segment *) simplesegment0;
  ((Segment *) turnout2)->connected_to[1] = (Segment *) simplesegment6;
  ((Segment *) turnout2)->connected_to_count = 2;
  ((Segment *) turnout2)->train =  train0 ;
  model->segments[17] = (Segment *) turnout2;
  turnout2->straight = (Segment *) turnout4;
  turnout2->divergent = (Segment *) simplesegment0;
  model->turnouts[2] = turnout2;

  ((Segment *) turnout3)->segment_id = 3;
  ((Segment *) turnout3)->connected_to[0] = (Segment *) simplesegment10;
  ((Segment *) turnout3)->connected_to_count = 1;
  ((Segment *) turnout3)->train =  NULL;
  model->segments[18] = (Segment *) turnout3;
  turnout3->straight = (Segment *) turnout0;
  turnout3->divergent = (Segment *) simplesegment12;
  model->turnouts[3] = turnout3;

  ((Segment *) turnout4)->segment_id = 4;
  ((Segment *) turnout4)->connected_to[0] = (Segment *) simplesegment13;
  ((Segment *) turnout4)->connected_to_count = 1;
  ((Segment *) turnout4)->train =  NULL;
  model->segments[19] = (Segment *) turnout4;
  turnout4->straight = (Segment *) turnout2;
  turnout4->divergent = (Segment *) simplesegment9;
  model->turnouts[4] = turnout4;

  train0->train_id = 0;
  train0->speed = 76.0;
  train0->location = (Segment *) turnout2;
  model->trains[0] = train0;

  train1->train_id = 1;
  train1->speed = 0.0;
  train1->location = (Segment *) simplesegment2;
  model->trains[1] = train1;

  train2->train_id = 2;
  train2->speed = 58.0;
  train2->location = (Segment *) turnout1;
  model->trains[2] = train2;

  train3->train_id = 3;
  train3->speed = 2.0;
  train3->location = (Segment *) simplesegment11;
  model->trains[3] = train3;

  train4->train_id = 4;
  train4->speed = 66.0;
  train4->location = (Segment *) simplesegment13;
  model->trains[4] = train4;

  model->segment_count = 15;
  model->turnout_count = 5;
  model->train_count = 5;
}
void generate_model_train_locations_solver(ModelRoot *model) {

  Train *train0 = &train0_obj;
  Train *train1 = &train1_obj;
  Train *train2 = &train2_obj;
  Train *train3 = &train3_obj;
  Train *train4 = &train4_obj;
  SimpleSegment *simplesegment5 = &simplesegment5_obj;
  SimpleSegment *simplesegment6 = &simplesegment6_obj;
  SimpleSegment *simplesegment7 = &simplesegment7_obj;
  SimpleSegment *simplesegment8 = &simplesegment8_obj;
  SimpleSegment *simplesegment9 = &simplesegment9_obj;
  SimpleSegment *simplesegment10 = &simplesegment10_obj;
  SimpleSegment *simplesegment11 = &simplesegment11_obj;
  SimpleSegment *simplesegment12 = &simplesegment12_obj;
  SimpleSegment *simplesegment13 = &simplesegment13_obj;
  SimpleSegment *simplesegment14 = &simplesegment14_obj;
  SimpleSegment *simplesegment4 = &simplesegment4_obj;
  SimpleSegment *simplesegment3 = &simplesegment3_obj;
  SimpleSegment *simplesegment2 = &simplesegment2_obj;
  SimpleSegment *simplesegment1 = &simplesegment1_obj;
  SimpleSegment *simplesegment0 = &simplesegment0_obj;
  Turnout *turnout0 = &turnout0_obj;
  Turnout *turnout1 = &turnout1_obj;
  Turnout *turnout2 = &turnout2_obj;
  Turnout *turnout3 = &turnout3_obj;
  Turnout *turnout4 = &turnout4_obj;
  

  ((Segment *) simplesegment5)->segment_id = 5;
  ((Segment *) simplesegment5)->connected_to[0] = (Segment *) simplesegment14;
  ((Segment *) simplesegment5)->connected_to[1] = (Segment *) simplesegment3;
  ((Segment *) simplesegment5)->connected_to_count = 2;
  ((Segment *) simplesegment5)->train =  NULL;
  model->segments[5] = (Segment *) simplesegment5;

  ((Segment *) simplesegment6)->segment_id = 6;
  ((Segment *) simplesegment6)->connected_to[0] = (Segment *) simplesegment12;
  ((Segment *) simplesegment6)->connected_to[1] = (Segment *) simplesegment1;
  ((Segment *) simplesegment6)->connected_to_count = 2;
  ((Segment *) simplesegment6)->train =  NULL;
  model->segments[6] = (Segment *) simplesegment6;

  ((Segment *) simplesegment7)->segment_id = 7;
  ((Segment *) simplesegment7)->connected_to[0] = (Segment *) turnout3;
  ((Segment *) simplesegment7)->connected_to[1] = (Segment *) simplesegment1;
  ((Segment *) simplesegment7)->connected_to_count = 2;
  ((Segment *) simplesegment7)->train =  train0 ;
  model->segments[7] = (Segment *) simplesegment7;

  ((Segment *) simplesegment8)->segment_id = 8;
  ((Segment *) simplesegment8)->connected_to[0] = (Segment *) simplesegment4;
  ((Segment *) simplesegment8)->connected_to[1] = (Segment *) simplesegment2;
  ((Segment *) simplesegment8)->connected_to_count = 2;
  ((Segment *) simplesegment8)->train =  NULL;
  model->segments[8] = (Segment *) simplesegment8;

  ((Segment *) simplesegment9)->segment_id = 9;
  ((Segment *) simplesegment9)->connected_to[0] = (Segment *) simplesegment4;
  ((Segment *) simplesegment9)->connected_to[1] = (Segment *) simplesegment0;
  ((Segment *) simplesegment9)->connected_to_count = 2;
  ((Segment *) simplesegment9)->train =  NULL;
  model->segments[9] = (Segment *) simplesegment9;

  ((Segment *) simplesegment10)->segment_id = 10;
  ((Segment *) simplesegment10)->connected_to[0] = (Segment *) turnout0;
  ((Segment *) simplesegment10)->connected_to[1] = (Segment *) turnout1;
  ((Segment *) simplesegment10)->connected_to_count = 2;
  ((Segment *) simplesegment10)->train =  train4 ;
  model->segments[10] = (Segment *) simplesegment10;

  ((Segment *) simplesegment11)->segment_id = 11;
  ((Segment *) simplesegment11)->connected_to[0] = (Segment *) turnout3;
  ((Segment *) simplesegment11)->connected_to[1] = (Segment *) turnout4;
  ((Segment *) simplesegment11)->connected_to_count = 2;
  ((Segment *) simplesegment11)->train =  NULL;
  model->segments[11] = (Segment *) simplesegment11;

  ((Segment *) simplesegment12)->segment_id = 12;
  ((Segment *) simplesegment12)->connected_to[0] = (Segment *) simplesegment6;
  ((Segment *) simplesegment12)->connected_to[1] = (Segment *) turnout2;
  ((Segment *) simplesegment12)->connected_to_count = 2;
  ((Segment *) simplesegment12)->train =  NULL;
  model->segments[12] = (Segment *) simplesegment12;

  ((Segment *) simplesegment13)->segment_id = 13;
  ((Segment *) simplesegment13)->connected_to[0] = (Segment *) simplesegment14;
  ((Segment *) simplesegment13)->connected_to[1] = (Segment *) simplesegment2;
  ((Segment *) simplesegment13)->connected_to_count = 2;
  ((Segment *) simplesegment13)->train =  NULL;
  model->segments[13] = (Segment *) simplesegment13;

  ((Segment *) simplesegment14)->segment_id = 14;
  ((Segment *) simplesegment14)->connected_to[0] = (Segment *) simplesegment5;
  ((Segment *) simplesegment14)->connected_to[1] = (Segment *) simplesegment13;
  ((Segment *) simplesegment14)->connected_to_count = 2;
  ((Segment *) simplesegment14)->train =  NULL;
  model->segments[14] = (Segment *) simplesegment14;

  ((Segment *) simplesegment4)->segment_id = 4;
  ((Segment *) simplesegment4)->connected_to[0] = (Segment *) simplesegment8;
  ((Segment *) simplesegment4)->connected_to[1] = (Segment *) simplesegment9;
  ((Segment *) simplesegment4)->connected_to_count = 2;
  ((Segment *) simplesegment4)->train =  NULL;
  model->segments[4] = (Segment *) simplesegment4;

  ((Segment *) simplesegment3)->segment_id = 3;
  ((Segment *) simplesegment3)->connected_to[0] = (Segment *) simplesegment5;
  ((Segment *) simplesegment3)->connected_to[1] = (Segment *) turnout4;
  ((Segment *) simplesegment3)->connected_to_count = 2;
  ((Segment *) simplesegment3)->train =  NULL;
  model->segments[3] = (Segment *) simplesegment3;

  ((Segment *) simplesegment2)->segment_id = 2;
  ((Segment *) simplesegment2)->connected_to[0] = (Segment *) simplesegment8;
  ((Segment *) simplesegment2)->connected_to[1] = (Segment *) simplesegment13;
  ((Segment *) simplesegment2)->connected_to_count = 2;
  ((Segment *) simplesegment2)->train =  NULL;
  model->segments[2] = (Segment *) simplesegment2;

  ((Segment *) simplesegment1)->segment_id = 1;
  ((Segment *) simplesegment1)->connected_to[0] = (Segment *) simplesegment6;
  ((Segment *) simplesegment1)->connected_to[1] = (Segment *) simplesegment7;
  ((Segment *) simplesegment1)->connected_to_count = 2;
  ((Segment *) simplesegment1)->train =  NULL;
  model->segments[1] = (Segment *) simplesegment1;

  ((Segment *) simplesegment0)->segment_id = 0;
  ((Segment *) simplesegment0)->connected_to[0] = (Segment *) simplesegment9;
  ((Segment *) simplesegment0)->connected_to_count = 1;
  ((Segment *) simplesegment0)->train =  NULL;
  model->segments[0] = (Segment *) simplesegment0;

  ((Segment *) turnout0)->segment_id = 0;
  ((Segment *) turnout0)->connected_to[0] = (Segment *) simplesegment10;
  ((Segment *) turnout0)->connected_to[1] = (Segment *) turnout1;
  ((Segment *) turnout0)->connected_to_count = 2;
  ((Segment *) turnout0)->train =  train2 ;
  model->segments[15] = (Segment *) turnout0;
  turnout0->straight = (Segment *) simplesegment10;
  turnout0->divergent = (Segment *) turnout2;
  model->turnouts[0] = turnout0;

  ((Segment *) turnout1)->segment_id = 1;
  ((Segment *) turnout1)->connected_to[0] = (Segment *) turnout0;
  ((Segment *) turnout1)->connected_to[1] = (Segment *) simplesegment10;
  ((Segment *) turnout1)->connected_to_count = 2;
  ((Segment *) turnout1)->train =  train3 ;
  model->segments[16] = (Segment *) turnout1;
  turnout1->straight = (Segment *) turnout2;
  turnout1->divergent = (Segment *) turnout0;
  model->turnouts[1] = turnout1;

  ((Segment *) turnout2)->segment_id = 2;
  ((Segment *) turnout2)->connected_to[0] = (Segment *) simplesegment12;
  ((Segment *) turnout2)->connected_to_count = 1;
  ((Segment *) turnout2)->train =  train1 ;
  model->segments[17] = (Segment *) turnout2;
  turnout2->straight = (Segment *) turnout0;
  turnout2->divergent = (Segment *) turnout1;
  model->turnouts[2] = turnout2;

  ((Segment *) turnout3)->segment_id = 3;
  ((Segment *) turnout3)->connected_to[0] = (Segment *) simplesegment7;
  ((Segment *) turnout3)->connected_to[1] = (Segment *) simplesegment11;
  ((Segment *) turnout3)->connected_to_count = 2;
  ((Segment *) turnout3)->train =  NULL;
  model->segments[18] = (Segment *) turnout3;
  turnout3->straight = (Segment *) simplesegment7;
  turnout3->divergent = (Segment *) turnout4;
  model->turnouts[3] = turnout3;

  ((Segment *) turnout4)->segment_id = 4;
  ((Segment *) turnout4)->connected_to[0] = (Segment *) simplesegment11;
  ((Segment *) turnout4)->connected_to[1] = (Segment *) simplesegment3;
  ((Segment *) turnout4)->connected_to_count = 2;
  ((Segment *) turnout4)->train =  NULL;
  model->segments[19] = (Segment *) turnout4;
  turnout4->straight = (Segment *) turnout3;
  turnout4->divergent = (Segment *) simplesegment11;
  model->turnouts[4] = turnout4;

  train0->train_id = 0;
  train0->speed = 76.0;
  train0->location = (Segment *) simplesegment7;
  model->trains[0] = train0;

  train1->train_id = 1;
  train1->speed = 0.0;
  train1->location = (Segment *) turnout2;
  model->trains[1] = train1;

  train2->train_id = 2;
  train2->speed = 58.0;
  train2->location = (Segment *) turnout0;
  model->trains[2] = train2;

  train3->train_id = 3;
  train3->speed = 2.0;
  train3->location = (Segment *) turnout1;
  model->trains[3] = train3;

  train4->train_id = 4;
  train4->speed = 66.0;
  train4->location = (Segment *) simplesegment10;
  model->trains[4] = train4;

  model->segment_count = 15;
  model->turnout_count = 5;
  model->train_count = 5;
}
void generate_model_modes3(ModelRoot *model) {

  Train *train0 = &train0_obj;
  Train *train1 = &train1_obj;
  Train *train2 = &train2_obj;
  Train *train3 = &train3_obj;
  SimpleSegment *simplesegment3 = &simplesegment3_obj;
  SimpleSegment *simplesegment2 = &simplesegment2_obj;
  SimpleSegment *simplesegment1 = &simplesegment1_obj;
  SimpleSegment *simplesegment0 = &simplesegment0_obj;
  SimpleSegment *simplesegment4 = &simplesegment4_obj;
  SimpleSegment *simplesegment5 = &simplesegment5_obj;
  SimpleSegment *simplesegment6 = &simplesegment6_obj;
  SimpleSegment *simplesegment7 = &simplesegment7_obj;
  SimpleSegment *simplesegment8 = &simplesegment8_obj;
  SimpleSegment *simplesegment9 = &simplesegment9_obj;
  SimpleSegment *simplesegment10 = &simplesegment10_obj;
  SimpleSegment *simplesegment11 = &simplesegment11_obj;
  SimpleSegment *simplesegment12 = &simplesegment12_obj;
  SimpleSegment *simplesegment13 = &simplesegment13_obj;
  SimpleSegment *simplesegment14 = &simplesegment14_obj;
  Turnout *turnout0 = &turnout0_obj;
  Turnout *turnout1 = &turnout1_obj;
  Turnout *turnout2 = &turnout2_obj;
  Turnout *turnout3 = &turnout3_obj;
  Turnout *turnout4 = &turnout4_obj;
  

  ((Segment *) simplesegment3)->segment_id = 3;
  ((Segment *) simplesegment3)->connected_to[0] = (Segment *) simplesegment2;
  ((Segment *) simplesegment3)->connected_to[1] = (Segment *) turnout0;
  ((Segment *) simplesegment3)->connected_to_count = 2;
  ((Segment *) simplesegment3)->train =  NULL;
  model->segments[3] = (Segment *) simplesegment3;

  ((Segment *) simplesegment2)->segment_id = 2;
  ((Segment *) simplesegment2)->connected_to[0] = (Segment *) simplesegment1;
  ((Segment *) simplesegment2)->connected_to[1] = (Segment *) simplesegment3;
  ((Segment *) simplesegment2)->connected_to_count = 2;
  ((Segment *) simplesegment2)->train =  train2 ;
  model->segments[2] = (Segment *) simplesegment2;

  ((Segment *) simplesegment1)->segment_id = 1;
  ((Segment *) simplesegment1)->connected_to[0] = (Segment *) simplesegment0;
  ((Segment *) simplesegment1)->connected_to[1] = (Segment *) simplesegment2;
  ((Segment *) simplesegment1)->connected_to_count = 2;
  ((Segment *) simplesegment1)->train =  NULL;
  model->segments[1] = (Segment *) simplesegment1;

  ((Segment *) simplesegment0)->segment_id = 0;
  ((Segment *) simplesegment0)->connected_to[0] = (Segment *) simplesegment1;
  ((Segment *) simplesegment0)->connected_to[1] = (Segment *) simplesegment10;
  ((Segment *) simplesegment0)->connected_to_count = 2;
  ((Segment *) simplesegment0)->train =  train3 ;
  model->segments[0] = (Segment *) simplesegment0;

  ((Segment *) simplesegment4)->segment_id = 4;
  ((Segment *) simplesegment4)->connected_to[0] = (Segment *) simplesegment5;
  ((Segment *) simplesegment4)->connected_to_count = 1;
  ((Segment *) simplesegment4)->train =  NULL;
  model->segments[4] = (Segment *) simplesegment4;

  ((Segment *) simplesegment5)->segment_id = 5;
  ((Segment *) simplesegment5)->connected_to[0] = (Segment *) simplesegment4;
  ((Segment *) simplesegment5)->connected_to_count = 1;
  ((Segment *) simplesegment5)->train =  train0 ;
  model->segments[5] = (Segment *) simplesegment5;

  ((Segment *) simplesegment6)->segment_id = 6;
  ((Segment *) simplesegment6)->connected_to_count = 0;
  ((Segment *) simplesegment6)->train =  NULL;
  model->segments[6] = (Segment *) simplesegment6;

  ((Segment *) simplesegment7)->segment_id = 7;
  ((Segment *) simplesegment7)->connected_to[0] = (Segment *) turnout4;
  ((Segment *) simplesegment7)->connected_to[1] = (Segment *) turnout3;
  ((Segment *) simplesegment7)->connected_to_count = 2;
  ((Segment *) simplesegment7)->train =  NULL;
  model->segments[7] = (Segment *) simplesegment7;

  ((Segment *) simplesegment8)->segment_id = 8;
  ((Segment *) simplesegment8)->connected_to_count = 0;
  ((Segment *) simplesegment8)->train =  NULL;
  model->segments[8] = (Segment *) simplesegment8;

  ((Segment *) simplesegment9)->segment_id = 9;
  ((Segment *) simplesegment9)->connected_to[0] = (Segment *) simplesegment10;
  ((Segment *) simplesegment9)->connected_to[1] = (Segment *) turnout2;
  ((Segment *) simplesegment9)->connected_to_count = 2;
  ((Segment *) simplesegment9)->train =  train1 ;
  model->segments[9] = (Segment *) simplesegment9;

  ((Segment *) simplesegment10)->segment_id = 10;
  ((Segment *) simplesegment10)->connected_to[0] = (Segment *) simplesegment9;
  ((Segment *) simplesegment10)->connected_to[1] = (Segment *) simplesegment0;
  ((Segment *) simplesegment10)->connected_to_count = 2;
  ((Segment *) simplesegment10)->train =  NULL;
  model->segments[10] = (Segment *) simplesegment10;

  ((Segment *) simplesegment11)->segment_id = 11;
  ((Segment *) simplesegment11)->connected_to[0] = (Segment *) simplesegment12;
  ((Segment *) simplesegment11)->connected_to[1] = (Segment *) turnout1;
  ((Segment *) simplesegment11)->connected_to_count = 2;
  ((Segment *) simplesegment11)->train =  NULL;
  model->segments[11] = (Segment *) simplesegment11;

  ((Segment *) simplesegment12)->segment_id = 12;
  ((Segment *) simplesegment12)->connected_to[0] = (Segment *) simplesegment11;
  ((Segment *) simplesegment12)->connected_to_count = 1;
  ((Segment *) simplesegment12)->train =  NULL;
  model->segments[12] = (Segment *) simplesegment12;

  ((Segment *) simplesegment13)->segment_id = 13;
  ((Segment *) simplesegment13)->connected_to[0] = (Segment *) simplesegment14;
  ((Segment *) simplesegment13)->connected_to_count = 1;
  ((Segment *) simplesegment13)->train =  NULL;
  model->segments[13] = (Segment *) simplesegment13;

  ((Segment *) simplesegment14)->segment_id = 14;
  ((Segment *) simplesegment14)->connected_to[0] = (Segment *) simplesegment13;
  ((Segment *) simplesegment14)->connected_to_count = 1;
  ((Segment *) simplesegment14)->train =  NULL;
  model->segments[14] = (Segment *) simplesegment14;

  ((Segment *) turnout0)->segment_id = 0;
  ((Segment *) turnout0)->connected_to[0] = (Segment *) simplesegment3;
  ((Segment *) turnout0)->connected_to_count = 1;
  ((Segment *) turnout0)->train =  NULL;
  model->segments[15] = (Segment *) turnout0;
  turnout0->straight = (Segment *) simplesegment4;
  turnout0->divergent = (Segment *) simplesegment6;
  model->turnouts[0] = turnout0;

  ((Segment *) turnout1)->segment_id = 1;
  ((Segment *) turnout1)->connected_to[0] = (Segment *) simplesegment11;
  ((Segment *) turnout1)->connected_to_count = 1;
  ((Segment *) turnout1)->train =  NULL;
  model->segments[16] = (Segment *) turnout1;
  turnout1->straight = (Segment *) simplesegment5;
  turnout1->divergent = (Segment *) simplesegment6;
  model->turnouts[1] = turnout1;

  ((Segment *) turnout2)->segment_id = 2;
  ((Segment *) turnout2)->connected_to[0] = (Segment *) simplesegment9;
  ((Segment *) turnout2)->connected_to_count = 1;
  ((Segment *) turnout2)->train =  NULL;
  model->segments[17] = (Segment *) turnout2;
  turnout2->straight = (Segment *) simplesegment8;
  turnout2->divergent = (Segment *) simplesegment12;
  model->turnouts[2] = turnout2;

  ((Segment *) turnout3)->segment_id = 3;
  ((Segment *) turnout3)->connected_to[0] = (Segment *) simplesegment7;
  ((Segment *) turnout3)->connected_to_count = 1;
  ((Segment *) turnout3)->train =  NULL;
  model->segments[18] = (Segment *) turnout3;
  turnout3->straight = (Segment *) turnout4;
  turnout3->divergent = (Segment *) simplesegment13;
  model->turnouts[3] = turnout3;

  ((Segment *) turnout4)->segment_id = 4;
  ((Segment *) turnout4)->connected_to[0] = (Segment *) simplesegment7;
  ((Segment *) turnout4)->connected_to_count = 1;
  ((Segment *) turnout4)->train =  NULL;
  model->segments[19] = (Segment *) turnout4;
  turnout4->straight = (Segment *) simplesegment8;
  turnout4->divergent = (Segment *) turnout3;
  model->turnouts[4] = turnout4;

  train0->train_id = 0;
  train0->speed = 76.0;
  train0->location = (Segment *) simplesegment5;
  model->trains[0] = train0;

  train1->train_id = 1;
  train1->speed = 0.0;
  train1->location = (Segment *) simplesegment9;
  model->trains[1] = train1;

  train2->train_id = 2;
  train2->speed = 58.0;
  train2->location = (Segment *) simplesegment2;
  model->trains[2] = train2;

  train3->train_id = 3;
  train3->speed = 2.0;
  train3->location = (Segment *) simplesegment0;
  model->trains[3] = train3;

  model->segment_count = 15;
  model->turnout_count = 5;
  model->train_count = 4;
}
