Beispiel #1
0
void CONSTR_FIX_allocate(Constr* c) {

  // Local variables
  int num_constr;
  int num_vars;
  int A_nnz;

  // Constr data
  num_vars = NET_get_num_vars(CONSTR_get_network(c));
  num_constr = CONSTR_get_A_row(c);
  A_nnz = CONSTR_get_A_nnz(c);

  // J f
  CONSTR_set_J(c,MAT_new(0,num_vars,0));
  CONSTR_set_f(c,VEC_new(0));

  // G l u
  CONSTR_set_G(c,MAT_new(0,num_vars,0));
  CONSTR_set_l(c,VEC_new(0));
  CONSTR_set_u(c,VEC_new(0));

  // b
  CONSTR_set_b(c,VEC_new(num_constr));

  // A
  CONSTR_set_A(c,MAT_new(num_constr, // size1 (rows)
			 num_vars,   // size2 (cols)
			 A_nnz)); // nnz
}
Beispiel #2
0
void CONSTR_DC_FLOW_LIM_allocate(Constr* c) {
  
  // Local variables
  Net* net;
  int num_br;
  int num_vars;
  int Gcounter;

  net = CONSTR_get_network(c);
  num_br = NET_get_num_branches(net);
  num_vars = NET_get_num_vars(net);
  Gcounter = CONSTR_get_Gcounter(c);
  
  // J f
  CONSTR_set_J(c,MAT_new(0,num_vars,0));
  CONSTR_set_f(c,VEC_new(0));
  
  // A b
  CONSTR_set_A(c,MAT_new(0,num_vars,0));
  CONSTR_set_b(c,VEC_new(0));
  
  // h
  CONSTR_set_l(c,VEC_new(num_br));
  CONSTR_set_u(c,VEC_new(num_br));

  // G
  CONSTR_set_G(c,MAT_new(num_br,      // size1 (rows)
			 num_vars,    // size2 (cols)
			 Gcounter));  // nnz
}
Beispiel #3
0
void CONSTR_LOAD_PF_allocate(Constr* c) {

  // Local variables
  int num_constr;
  int num_vars;
  int A_nnz;

  num_vars = NET_get_num_vars(CONSTR_get_network(c));
  num_constr = CONSTR_get_A_row(c);
  A_nnz = CONSTR_get_A_nnz(c);

  // J f
  CONSTR_set_J(c,MAT_new(0,num_vars,0));
  CONSTR_set_f(c,VEC_new(0));

  // A b
  CONSTR_set_A(c,MAT_new(num_constr, // rows
			 num_vars,   // cols
			 A_nnz));    // nnz
  CONSTR_set_b(c,VEC_new(num_constr));

  // G l u
  CONSTR_set_l(c,VEC_new(0));
  CONSTR_set_u(c,VEC_new(0));
  CONSTR_set_G(c,MAT_new(0,        // rows
			 num_vars, // cols
			 0));      // nnz
}
Beispiel #4
0
void CONSTR_BOUND_allocate(Constr* c) {

  // Local variables
  int Jcounter;
  Mat* H_array;
  Mat* H;
  int num_vars;
  int i;
  
  Jcounter = CONSTR_get_Jcounter(c);
  num_vars = NET_get_num_vars(CONSTR_get_network(c));

  // A b
  CONSTR_set_A(c,MAT_new(0,num_vars,0));
  CONSTR_set_b(c,VEC_new(0));
  
  // f
  CONSTR_set_f(c,VEC_new(Jcounter));

  // J
  CONSTR_set_J(c,MAT_new(Jcounter,   // size1 (rows)
			 num_vars,   // size2 (cols)
			 Jcounter)); // nnz
  
  // H
  H_array = MAT_array_new(Jcounter);
  CONSTR_set_H_array(c,H_array,Jcounter);
  for (i = 0; i < Jcounter; i++) {
    H = MAT_array_get(H_array,i);
    MAT_set_nnz(H,1);
    MAT_set_size1(H,num_vars);
    MAT_set_size2(H,num_vars);
    MAT_set_row_array(H,(int*)calloc(1,sizeof(int)));
    MAT_set_col_array(H,(int*)calloc(1,sizeof(int)));
    MAT_set_data_array(H,(REAL*)malloc(1*sizeof(REAL)));
  }

  // H combined
  CONSTR_set_H_combined(c,MAT_new(num_vars,   // size1 (rows)
				  num_vars,   // size2 (cols)
				  Jcounter)); // nnz
}
Beispiel #5
0
void CONSTR_PAR_GEN_Q_allocate(Constr *c) {
  
  // Local variables
  int num_constr;
  int num_vars;
  int Acounter;
  
  num_vars = NET_get_num_vars(CONSTR_get_network(c));
  num_constr = CONSTR_get_Aconstr_index(c);
  Acounter = CONSTR_get_Acounter(c);

  // J f
  CONSTR_set_J(c,MAT_new(0,num_vars,0));
  CONSTR_set_f(c,VEC_new(0));

  // b
  CONSTR_set_b(c,VEC_new(num_constr));

  // A
  CONSTR_set_A(c,MAT_new(num_constr, // size1 (rows)
			 num_vars,   // size2 (rows)
			 Acounter)); // nnz
}