예제 #1
0
void
MILPP::initialize(int nr_cols, int nr_rows)
{
  cons_matrix_.resize(nr_rows, nr_cols);

  col_to_row_mapping_.resize(nr_cols);
  for (int i = 0; i < get_num_cols(); i++)
    {
      col_to_row_mapping_[i] = new set<int>();
    }
  row_to_col_mapping_.resize(nr_rows);
  for (int i = 0; i < get_num_rows(); i++)
    {
      row_to_col_mapping_[i] = new set<int>();
    }

  /* Compute problem parameters and set default values if required */
  obj_coefs_.resize(nr_cols);
  cols_lower_bounds_.resize(nr_cols);
  cols_upper_bounds_.resize(nr_cols);

  /* Allocate rows related variables */
  rows_lower_bounds_.resize(nr_rows);
  rows_upper_bounds_.resize(nr_rows);
  rows_senses_.resize(nr_rows);

  /* Initialize cols related arrays */
  for (int i = 0; i < get_num_cols(); i++)
    {
      set_col_lower_bound(i, 0.);
      set_col_upper_bound(i, 1.);
      set_obj_coef(i, 0.);
    }

  /* Initialize rows related arrays */
  for (int i = 0; i < get_num_rows(); i++)
    {
      set_row_lower_bound(i, 0.);
      /* The actual upper bound values will be assigned later. */
      set_row_upper_bound(i, 0.);
      /* Set default row sense */
      set_row_sense(i, ROW_SENSE_LOWER);
    }
}
예제 #2
0
파일: MtxLP.cpp 프로젝트: kierzek/MUFINS
void MtxLP::setObjective(double coef){
    int ncols = get_num_cols();
    for (int i = 1; i <= ncols; i++)
        set_obj_coef(i, coef);
}
예제 #3
0
파일: MtxLP.cpp 프로젝트: kierzek/MUFINS
void MtxLP::emptyObjective(){
    int ncols = get_num_cols();
    for (int i = 1; i <= ncols; i++)
        set_obj_coef(i, 0.0);
}
예제 #4
0
파일: MtxLP.cpp 프로젝트: kierzek/MUFINS
void MtxLP::setObjCoef(string name, double coef){
    int n = ncol(name);
    if (n == 0)
        throw runtime_error(string("no such column ") + name);
    set_obj_coef(ncol(name), coef);
}