Exemple #1
0
void
ZoneViewlet::setNote(int index, synthclone::MIDIData note)
{
    assert((index >= 0) && (index < tableModel.rowCount()));
    setModelData(index, ZONETABLECOLUMN_NOTE, static_cast<int>(note));
    setModelData(index, ZONETABLECOLUMN_NOTE,
                 synthclone::getMIDINoteString(note), Qt::DisplayRole);
}
Exemple #2
0
void
ZoneViewlet::setVelocity(int index, synthclone::MIDIData velocity)
{
    assert((index >= 0) && (index < tableModel.rowCount()));
    int intVelocity = static_cast<int>(velocity);
    setModelData(index, ZONETABLECOLUMN_VELOCITY, intVelocity);
    setModelData(index, ZONETABLECOLUMN_VELOCITY, intVelocity, Qt::DisplayRole);
}
Exemple #3
0
void
ZoneViewlet::setSampleTime(int index, synthclone::SampleTime sampleTime)
{
    assert((index >= 0) && (index < tableModel.rowCount()));
    setModelData(index, ZONETABLECOLUMN_SAMPLE_TIME, sampleTime);
    setModelData(index, ZONETABLECOLUMN_SAMPLE_TIME,
                 tr("%1 seconds").arg(sampleTime), Qt::DisplayRole);
}
Exemple #4
0
void
ZoneViewlet::setChannel(int index, synthclone::MIDIData channel)
{
    assert((index >= 0) && (index < tableModel.rowCount()));
    int intChannel = static_cast<int>(channel);
    setModelData(index, ZONETABLECOLUMN_CHANNEL, intChannel);
    setModelData(index, ZONETABLECOLUMN_CHANNEL, intChannel, Qt::DisplayRole);
}
Exemple #5
0
void
ZoneViewlet::setAftertouch(int index, synthclone::MIDIData aftertouch)
{
    assert((index >= 0) && (index < tableModel.rowCount()));
    int intAftertouch = static_cast<int>(aftertouch);
    setModelData(index, ZONETABLECOLUMN_AFTERTOUCH, intAftertouch);
    QVariant value;
    if (aftertouch == synthclone::MIDI_VALUE_NOT_SET) {
        value = tr("(not set)");
    } else {
        value = intAftertouch;
    }
    setModelData(index, ZONETABLECOLUMN_AFTERTOUCH, value, Qt::DisplayRole);
}
Exemple #6
0
void
ZoneViewlet::setChannelPressure(int index, synthclone::MIDIData pressure)
{
    assert((index >= 0) && (index < tableModel.rowCount()));
    int intPressure = static_cast<int>(pressure);
    setModelData(index, ZONETABLECOLUMN_CHANNEL_PRESSURE, intPressure);
    QVariant value;
    if (pressure == synthclone::MIDI_VALUE_NOT_SET) {
        value = tr("(not set)");
    } else {
        value = intPressure;
    }
    setModelData(index, ZONETABLECOLUMN_CHANNEL_PRESSURE, value,
                 Qt::DisplayRole);
}
void ListInfoWidget::setSongViewValue(const int &index)
{
    tempEdit->setHidden(true);
    if(!values.isEmpty())
        values.clear();
    if(index == 0)
        _sql->getMediaLanguage(values);
    else if(index == 1)
        _sql->getMediaType(values);
    else if(index == 2)
        _sql->getMediaResolution(values);
    else if(index == 3)
        _sql->getMediaQuality(values);
    else if(index == 4)
        _sql->getMediaSource(values);
    else if(index == 5)
        _sql->getMediaVersion(values);
    else if(index == 6)
        _sql->getMediaRthym(values);
    else if(index == 7)
        _sql->getMediaPitch(values);
    else
        return;

    setModelData(values);
}
Exemple #8
0
void
ZoneViewlet::setWetSampleProfile(int index, const SampleProfile *profile)
{
    assert((index >= 0) && (index < tableModel.rowCount()));
    setModelData(index, ZONETABLECOLUMN_WET_SAMPLE,
                 generateSampleProfile(profile), Qt::UserRole);
}
void QItemDelegate_QtDShell::__override_setModelData(QWidget*  editor0, QAbstractItemModel*  model1, const QModelIndex&  index2, bool static_call) const
{
    if (static_call) {
        QItemDelegate::setModelData((QWidget* )editor0, (QAbstractItemModel* )model1, (const QModelIndex& )index2);
    } else {
        setModelData((QWidget* )editor0, (QAbstractItemModel* )model1, (const QModelIndex& )index2);
    }
}
Exemple #10
0
void SpinBoxDelegate::commitCurrentEditor( QAbstractItemModel * model)
{
	if( currentEditor == NULL || !bIsEditorCreated )
		return;

	setModelData( currentEditor, model, currentModelIndex );
	
}
Exemple #11
0
void
ZoneViewlet::setStatus(int index, synthclone::Zone::Status status)
{
    assert((index >= 0) && (index < tableModel.rowCount()));
    bool disabled = true;
    QString statusStr;

    switch (status) {
    case synthclone::Zone::STATUS_EFFECT_JOB_QUEUE:
        statusStr = tr("In effect job queue ...");
        break;
    case synthclone::Zone::STATUS_EFFECTS:
        statusStr = tr("Applying effects ...");
        break;
    case synthclone::Zone::STATUS_NORMAL:
        disabled = false;
        statusStr = "";
        break;
    case synthclone::Zone::STATUS_SAMPLER_PLAYING_DRY_SAMPLE:
        statusStr = tr("Playing dry sample ...");
        break;
    case synthclone::Zone::STATUS_SAMPLER_PLAYING_WET_SAMPLE:
        statusStr = tr("Playing wet sample ...");
        break;
    case synthclone::Zone::STATUS_SAMPLER_SAMPLING:
        statusStr = tr("Sampling ...");
        break;
    case synthclone::Zone::STATUS_SAMPLER_JOB_QUEUE:
        statusStr = tr("In sampler job queue ...");
        break;
    case synthclone::Zone::STATUS_TARGETS:
        statusStr = tr("Building targets ...");
    }
    setModelData(index, ZONETABLECOLUMN_STATUS, statusStr, Qt::DisplayRole);
    if (disabled) {
        disableRow(index);
        setModelData(index, ZONETABLECOLUMN_STATUS,
                     QPixmap(":/synthclone/images/16x16/locked.png"),
                     Qt::DecorationRole);
    } else {
        enableRow(index);
        setModelData(index, ZONETABLECOLUMN_STATUS, QVariant(),
                     Qt::DecorationRole);
    }
}
Exemple #12
0
void
ZoneViewlet::setWetSampleStale(int index, bool stale)
{
    assert((index >= 0) && (index < tableModel.rowCount()));
    const QPalette &palette = tableView->palette();
    setModelData(index, ZONETABLECOLUMN_WET_SAMPLE,
                 stale ? palette.alternateBase() : palette.base(),
                 Qt::BackgroundRole);
}
Exemple #13
0
void
ZoneViewlet::setControlValue(int index, synthclone::MIDIData control,
                             synthclone::MIDIData value)
{
    assert((index >= 0) && (index < tableModel.rowCount()));
    assert(control < 0x80);
    assert((value < 0x80) || (value == synthclone::MIDI_VALUE_NOT_SET));
    int column = ZONETABLECOLUMN_CONTROL_0 + static_cast<int>(control);
    int intValue = static_cast<int>(value);
    setModelData(index, column, intValue);
    QVariant varValue;
    if (value == synthclone::MIDI_VALUE_NOT_SET) {
        varValue = tr("(not set)");
    } else {
        varValue = intValue;
    }
    setModelData(index, column, varValue, Qt::DisplayRole);
}
void GroupItem::recalculateGroupValues( const QModelIndex & self )
{
	QAbstractItemModel * model = const_cast<QAbstractItemModel*>(self.model());
	for( int i = model->columnCount(self) - 1; i >= 0; --i ) {
		QModelIndex ci = self.sibling(self.row(),i);
		QString val = calculateGroupValue( self, i );
		if( !val.isEmpty() )
			setModelData( ci, val, Qt::DisplayRole );
	}
}
void ListInfoWidget::setSingerViewValue(const int &index)
{
    tempEdit->setHidden(true);
    if(!values.isEmpty())
        values.clear();
    if(index == 0)
        _sql->getNation(values);
    else
        return;

    setModelData(values);
}
Exemple #16
0
bool ListData::replyFinished()
{
    if(m_replyType->type == 1)    //有数据返回
    {
        setModelData();
        return true;
    }
    else
    {
        return true;
    }
    return false;
}
void ListInfoWidget::setListViewValue(const int &index)
{
    tempEdit->setHidden(true);
    if(!values.isEmpty())
        values.clear();
    if(index == 0)
        _sql->getMediaListHot(values);
    else if(index == 1)
        _sql->getMediaListNet(values);
    else
        return;

    setModelData(values);
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ComparisonSelectionItemDelegate::arrayNameChangedData(int i)
{
  ComparisonSelectionTableModel* tableModel = qobject_cast<ComparisonSelectionTableModel*>(parent());
  QWidget* w = qobject_cast<QWidget*>(sender());
  if(tableModel && w)
  {
    QString objName = w->objectName();
    QStringList tokens = objName.split(',');
    int row = tokens[0].toInt();
    int col = tokens[1].toInt();
    QModelIndex index = tableModel->index(row, col);
    setModelData(w, tableModel, index);
  }
}
Exemple #19
0
void ConfigDialog::loadProblems()
{
    for (auto i:Global::problemOrder) problemList.append(Global::problems[i].name);
    QStringList tmp=QDir(Global::dataPath).entryList(QDir::Dirs|QDir::NoDotAndDotDot);
    for (auto i:tmp) if (!problemList.count(i)) problemList.append(i);
    num=problemList.size();

    model.setRowCount(5);
    model.setVerticalHeaderLabels({"题目类型","时间限制","内存限制","比较方式","清空原配置"});
    model.verticalHeaderItem(0)->setToolTip("试题的类型。");
    model.verticalHeaderItem(1)->setToolTip("试题每个测试点拥有的运行时间上限(仅限传统型试题)。单位: 秒(s)");
    model.verticalHeaderItem(2)->setToolTip("试题每个测试点拥有的运行内存上限(仅限传统型试题)。单位: 兆字节(MB)");
    model.verticalHeaderItem(3)->setToolTip("选手程序输出文件(或答案文件)与标准输出文件的比较方式。");
    model.verticalHeaderItem(4)->setToolTip("清空原来的所有配置。");
    for(int i=0; i<5; i++) model.verticalHeaderItem(i)->setTextAlignment(Qt::AlignCenter);

    model.setColumnCount(num);
    model.setHorizontalHeaderLabels(problemList);
    ui->tableView->setModel(&model);
    ui->tableView->setItemDelegate(&delegate);
    delegate.problemList=problemList;
    ui->tableView->horizontalHeader()->setTextElideMode(Qt::ElideRight);

    for (int i=0; i<num; i++)
    {
        model.horizontalHeaderItem(i)->setToolTip(problemList[i]);
        for (int j=0; j<5; j++) model.setData(model.index(j,i),Qt::AlignCenter,Qt::TextAlignmentRole);
        setModelData(i);
        for (int j=0; j<4; j++) model.item(j,i)->setToolTip(model.item(j,i)->text());
    }

    int w=num*ui->tableView->horizontalHeader()->defaultSectionSize()+ui->tableView->verticalHeader()->width()+2;
    int h=5*ui->tableView->verticalHeader()->defaultSectionSize()+ui->tableView->horizontalHeader()->height()+2;
    w=min(max(w,ui->tableView->minimumWidth()),ui->tableView->maximumWidth());
    if (num>12) h+=17;
    ui->tableView->setFixedSize(w,h);
    this->setFixedSize(w+22,h+100);
    //qDebug()<<w<<h;
}
void DhQAbstractItemDelegate::DvhsetModelData(QWidget* x1, QAbstractItemModel* x2, const QModelIndex& x3) const {
  return setModelData(x1, x2, x3);
}
/* This Method is being called when the user *writes* something and press enter or tab,
 * and it`s also called when the mouse walks over the list of choices from the ComboBox,
 * One thing is important, if the user writes a *new* cylinder or weight type, it will
 * be ADDED to the list, and the user will need to fill the other data.
 */
void ComboBoxDelegate::testActivation(const QString &currText)
{
	currCombo.activeText = currText.isEmpty() ? currCombo.comboEditor->currentText() : currText;
	setModelData(currCombo.comboEditor, currCombo.model, QModelIndex());
}
Exemple #22
0
void ComboBoxDelegate::testActivation(const QString& s)
{
	currCombo.activeText = s;
	setModelData(currCombo.comboEditor, currCombo.model, QModelIndex());
}
Exemple #23
0
void WatchTreeView::collapseNode(const QModelIndex &idx)
{
    setModelData(LocalsExpandedRole, false, idx);
}
Exemple #24
0
void WatchTreeView::expandNode(const QModelIndex &idx)
{
    setModelData(LocalsExpandedRole, true, idx);
}
Exemple #25
0
void SpinBoxDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
{
	QSpinBox* spinBox = static_cast< QSpinBox* >(editor);
	spinBox->interpretText();
	setModelData(model, index, spinBox->value());
}
Exemple #26
0
void CSVWorld::DialogueDelegateDispatcher::editorDataCommited(QWidget* editor, const QModelIndex& index, CSMWorld::ColumnBase::Display display)
{
    setModelData(editor, mTable, index, display);
}
Exemple #27
0
int main(int argc, char** argv) {

    int ITER;
    double **REFINE;

    setAnalysis(argc,argv,ITER,REFINE);

    for(int i = 0; i < ITER; i++) {

        //Model Dimension:
        int Nnodes, Nelems, Nfaces, Ngauss, Nfree, Nzeros;

        //Model Variables:
        int    **Elements, **vecK, **Boundaries, **MeshRefine, *Restraints, *Dofs, *row, *col;
        double **GaussPoints, **Coordinates, *Stiffness, *Force, *etaK, etamax;

        //------------------------------------------------------------------------------------------------------------------------------
        // PRE-ANALYSIS :
        //------------------------------------------------------------------------------------------------------------------------------
        //Reads information:
        setModelData(Coordinates,Elements,vecK,Boundaries,MeshRefine,GaussPoints,Restraints,Nnodes,Nelems,Nfaces,Ngauss,etaK);
        setModelDofs(Elements,Restraints,Dofs,Nnodes,Nelems,Nfree,Nzeros);
        allocateModel(Stiffness,Force,row,col,Nfree,Nzeros);

        //------------------------------------------------------------------------------------------------------------------------------
        // RUN-ANALYSIS :
        //------------------------------------------------------------------------------------------------------------------------------
        //FEM Assembly:
        setForceVector(Coordinates,Elements,GaussPoints,Force,Dofs,Nelems,Ngauss);
        setStiffnessMatrix(Coordinates,Elements,Stiffness,row,col,Dofs,Nelems);

        //FEM Solution:
        MUMPSSolver(Nfree,Nzeros,row,col,Stiffness,Force,0);

        //------------------------------------------------------------------------------------------------------------------------------
        // POST-ANALYSIS:
        //------------------------------------------------------------------------------------------------------------------------------
        //Error Approximation:
        etamax = setTotalError(REFINE,Coordinates,Elements,GaussPoints,Force,Dofs,Nnodes,Nelems,Ngauss,i,etaK,vecK);

        //Mark the refining elemenents in MeshRefine, based on the etaK
        //markRefine(MeshRefine,etaK,Nelems,etamax);
        for (int j=0; j<Nelems; j++) {
            if (etaK[j]>=0.5*etamax) {
                MeshRefine[j][0]=1;
            }
            else {
                MeshRefine[j][0]=0;
            }
        }

        //Save the Solution:
        saveModelData(REFINE,ITER,Coordinates,Elements,Force,Dofs,Nnodes,Nelems);

        //Mesh Refinement:
        if(i < ITER - 1)
            setMeshRefiner(Coordinates,Elements,MeshRefine,Boundaries,Nnodes,Nelems,Nfaces);
        //Free Memory:
        //------------------------------------------------------------------------------------------------------------------------------------
        // FREE DOFS VECTOR DATA:
        //------------------------------------------------------------------------------------------------------------------------------------
        delete[] Dofs;
        //------------------------------------------------------------------------------------------------------------------------------------
        // FREE STIFFNESS MATRIX DATA:
        //------------------------------------------------------------------------------------------------------------------------------------
        delete[] row;
        delete[] col;
        delete[] Stiffness;
        //------------------------------------------------------------------------------------------------------------------------------------
        // FREE FORCE VECTOR DATA:
        //------------------------------------------------------------------------------------------------------------------------------------
        delete[] Force;
        //freeModelData(Coordinates,Elements,GaussPoints,MeshRefine,Boundaries,Restraints,Nnodes,Nelems,Nfaces,Ngauss);
        //for (int i=0;i<Nelems;i++){
        //std::cout<< i << "\t"<<vecK[i][0]<< "\t"<<vecK[i][1]<< "\t"<<vecK[i][2]<< "\t"<<vecK[i][3]<<std::endl;
        //}

        //------------------------------------------------------------------------------------------------------------------------------------
        // FREE COORDINATES DATA:
        //------------------------------------------------------------------------------------------------------------------------------------
        for(int i = 0; i < Nnodes; i++) {
            delete[] Coordinates[i];
        }
        delete[] Coordinates;

        //------------------------------------------------------------------------------------------------------------------------------------
        // FREE ELEMENTS DATA:
        //------------------------------------------------------------------------------------------------------------------------------------
        for(int i = 0; i < Nelems; i++) {
            delete[] Elements[i];
        }
        delete[] Elements;

        //------------------------------------------------------------------------------------------------------------------------------------
        // FREE GAUSS POINTS DATA:
        //------------------------------------------------------------------------------------------------------------------------------------
        for(int i = 0; i < Ngauss; i++) {
            delete[] GaussPoints[i];
        }
        delete[] GaussPoints;

        //------------------------------------------------------------------------------------------------------------------------------------
        // FREE REFINEMENT DATA:
        //------------------------------------------------------------------------------------------------------------------------------------
        for(int i = 0; i < Nelems; i++) {
            delete[] MeshRefine[i];
        }
        delete[] MeshRefine;

        //------------------------------------------------------------------------------------------------------------------------------------
        // FREE BOUNDARY DATA:
        //------------------------------------------------------------------------------------------------------------------------------------
        for(int i = 0; i < Nfaces; i++) {
            delete[] Boundaries[i];
        }
        delete[] Boundaries;

        //------------------------------------------------------------------------------------------------------------------------------------
        // FREE RESTRAINT DATA:
        //------------------------------------------------------------------------------------------------------------------------------------
        delete[] Restraints;

        delete vecK;
        delete etaK;
    }

    return 0;

}
// This 'reverts' the model data to what we actually choosed,
// becaus e a TAB is being understood by Qt as 'cancel' while
// we are on a QComboBox ( but not on a QLineEdit.
void ComboBoxDelegate::fixTabBehavior()
{
	if (keyboardFinished) {
		setModelData(0, 0, QModelIndex());
	}
}
Exemple #29
0
/** For parallel code, only the master calls this function.
 *  1) Read in the instance data
 *  2) Set colMatrix_, varLB_, varUB_, conLB_, conUB
 *     numCols_, numRows_
 *  3) Set objCoef_ and objSense_
 *  4) Set colType_ ('C', 'I', or 'B')
 *  5) Create variables and constraints
 *  6) Set numCoreVariables_ and numCoreConstraints_
 */
void
VrpModel::readInstance(const char* dataFile)
{

    int msgLevel = AlpsPar_->entry(AlpsParams::msgLevel);

   static char keywords[KEY_NUM][22] = {
      "NAME", 
      "NAME:",                 /* This section lists the names of the */
      "TYPE",                  /* possible fields in the data file    */
      "TYPE:",
      "COMMENT",
      "COMMENT:",
      "DIMENSION",
      "DIMENSION:",
      "CAPACITY",
      "CAPACITY:",
      "EDGE_WEIGHT_TYPE",
      "EDGE_WEIGHT_TYPE:",
      "EDGE_WEIGHT_FORMAT", 
      "EDGE_WEIGHT_FORMAT:", 
      "DISPLAY_DATA_TYPE",
      "DISPLAY_DATA_TYPE:",
      "EDGE_WEIGHT_SECTION", 
      "EDGE_WEIGHT_SECTION:", 
      "DISPLAY_DATA_SECTION", 
      "DISPLAY_DATA_SECTION:",
      "NODE_COORD_SECTION",
      "NODE_COORD_SECTION:",
      "NODE_COORD_TYPE",
      "NODE_COORD_TYPE:",
      "DEPOT_SECTION",
      "DEPOT_SECTION:",
      "CAPACITY_VOL",
      "CAPACITY_VOL:",
      "DEMAND_SECTION",
      "DEMAND_SECTION:",
      "TIME_WINDOW_SECTION",
      "TIME_WINDOW_SECTION:",
      "STANDTIME_SECTION",
      "STANDTIME_SECTION:",
      "PICKUP_SECTION",
      "PICKUP_SECTION:",
      "EOF",
      "EOF.",
      "NUMBER_OF_TRUCKS",
      "NUMBER_OF_TRUCKS:",
      "",
      "",
      "NO_MORE_TYPE"
   };
   
#define NCTYPE_NUM 3
   
   static char nctypes[NCTYPE_NUM][14] = {
      "TWOD_COORDS",
      "THREED_COORDS",     /*This section lists the possible node*/
      "NO_COORDS"          /*coordinate data types               */
   };
   
#define WTYPE_NUM 10
   
   static char wtypes[WTYPE_NUM][9] = {
      "EXPLICIT",
      "EUC_2D",            /*This is a list of the possible data types for */
      "EUC_3D",            /*edge weights                                  */
      "MAX_2D",
      "MAX_3D",
      "MAN_2D",
      "MAN_3D",
      "CEIL_2D",
      "GEO",
      "ATT"
   };
   
#define WFORMAT_NUM 9
   
   static char wformats[WFORMAT_NUM][20] = {
      "UPPER_ROW",
      "LOWER_ROW",          /*This is a list of the possible formats that*/
      "UPPER_DIAG_ROW",     /*the edge weight matrix could be given in   */
      "LOWER_DIAG_ROW",     /*if it is given explicitly                  */
      "UPPER_COL",
      "LOWER_COL",
      "UPPER_DIAG_COL",
      "LOWER_DIAG_COL",
      "FULL_MATRIX"
   };
   
#define DTYPE_NUM 3
   
   static char dtypes[DTYPE_NUM][14] = {
      "COORD_DISPLAY",
      "TWOD_DISPLAY",     /*This is a list of the various display data*/
      "NO_DISPLAY"        /*types                                     */
   };
   
   char line[LENGTH], line1[LENGTH], key[30], tmp[80];
   int wformat=-1, dtype=-1, nctype=-1;
   double fdummy;
   int i, j = 0;
   int l, m;
   FILE *f;
   int node;
   double deg, min, coord_x, coord_y, coord_z;
   double x, y;
   int capacity_vol = false;
   int k; 
   numroutes_ = VrpPar_->entry(VrpParams::numRoutes);
   
   if (!strcmp(dataFile, "")){
      printf("\nVrp I/O: No problem data file specified\n\n");
      exit(1);
   }
   
   if ((f = fopen(dataFile, "r")) == NULL){
      fprintf(stderr, "Vrp I/O: file '%s' can't be opened\n", dataFile);
      exit(1);
   }
   
   /*This loop reads in the next line of the data file and compares it
     to the list of possible keywords to determine what data will follow.
     It then reads the data into the appropriate field and iterates */
   
   while(NULL != fgets( line1, LENGTH, f)){
      strcpy(key,"");
      sscanf(line1,"%s",key); /*read in next keyword*/
      
      for (k = 0; k < KEY_NUM; k++) /*which data field comes next?*/
	 if (strcmp(keywords[k], key) == 0) break;
      
      if (k == KEY_NUM){
	 continue;
	 fprintf(stderr, "Unknown keyword! bye.\n");
	 exit(1); /*error check for acceptable data field*/
      }
      
      k >>= 1; /* This is a bit shift operation that divides k by 2    */
      /* since in the list of keywords, there are two possible*/
      /* formats for the keyword                              */
      
      if (strchr(line1,':')){
	 strcpy(line, strchr(line1, ':')+1);
      }
      
      switch (k){
	 
       case 0: /* NAME */
	 if (!sscanf(line, "%s", name_))
	    fprintf(stderr, "\nVrp I/O: error reading NAME\n\n");

	 if (msgLevel > 0) {
	     printf("PROBLEM NAME: \t\t%s\n", name_);
	 }
	 break;
       case 1 : /*TYPE*/
	 sscanf(line, "%s", tmp);
	 if (strcmp("CVRP", tmp) != 0){
	   if (strcmp("TSP", tmp) == 0){
	      VrpPar_->setEntry(VrpParams::tspProb, true);
	   }else{
	      fprintf(stderr, "This is not a recognized file type!\n");
	      exit(1);
	   }
	 }
	 if (msgLevel > 0) {
	     printf("TYPE: \t\t\t%s\n", tmp);
	 }
       case 2 : /*COMMENT*/
#if 0
	 if (!strncpy(tmp, line, 80))
	    fprintf(stderr, "\nVrp I/O: error reading COMMENT\n\n");
	 printf("DESCRIPTION: \t\t%s\n", tmp);
#endif
	 break;
       case 3 : /* DIMENSION */
	 if (!sscanf(line, "%i", &k)){
	    fprintf(stderr, "Vrp I/O: error reading DIMENSION\n\n");
	    exit(1);
	 }
	 vertnum_ = (int) k;
	 edgenum_ = (int) vertnum_ * (vertnum_ - 1)/2;
	 if (msgLevel > 0) {
	     printf("DIMENSION: \t\t%i\n", k);
	 }
	 break;
       case 4 : /*CAPACITY*/
	 if (!sscanf(line, "%i", &k)){
	    fprintf(stderr, "Vrp I/O: error reading CAPACITY\n\n");
	    exit(1);
	 }
	 capacity_ = (int) k;
	 break;
       case 5 : /* EDGE_WEIGHT_TYPE */
	 sscanf(line, "%s", tmp);
	 for (wtype_ = 0; wtype_ < WTYPE_NUM; (wtype_)++)
	    if (strcmp(wtypes[wtype_], tmp) == 0) break;
	 if (wtype_ == WTYPE_NUM) {
	    fprintf(stderr, "Unknown weight type : %s !!!\n", tmp);
	    exit(1);
	 }
	 break;
       case 6 : /* EDGE_WEIGHT_FORMAT */
	 sscanf(line, "%s", tmp);
	 for (wformat = 0; wformat < WFORMAT_NUM; wformat++)
	    if (strcmp(wformats[wformat], tmp) == 0) break;
	 if (wformat == WFORMAT_NUM) {
	    fprintf(stderr, "Unknown weight type : %s !!!\n", tmp);
	    exit(1);
	 }
	 break;
       case 7 : /* DISPLAY_DATA_TYPE */
	 sscanf(line, "%s", tmp);
	 for (dtype = 0; dtype < DTYPE_NUM; dtype++)
	    if (strcmp(dtypes[dtype], tmp) == 0) break;
	 if (dtype == DTYPE_NUM) {
	    fprintf(stderr, "Unknown display type : %s !!!\n", tmp);
	    exit(1);
	 }
	 break;
       case 8: /* EDGE_WEIGHT_SECTION */
	 /*------------------------break if not EXPLICIT -*/
	 if (wtype_ != _EXPLICIT) break; 
	 switch (wformat){
	  case 1 : /* LOWER_ROW */
	  case 4 : /* UPPER_COL */
	  case 3 : /* LOWER_DIAG_ROW */
	  case 6 : /* UPPER_DIAG_COL */
	    for (i = 0; i < vertnum_; i++){
	       for (j = 0; j < i; j++){
		  if (!fscanf(f,"%lf", &fdummy)){
		     fprintf(stderr, "Not enough data -- DIMENSION or "
			     "EDGE_WEIGHT_TYPE declared wrong\n");
		     exit(1);
		  } else {
		     if (VrpPar_->entry(VrpParams::tspProb)){
			edges_.push_back(new VrpVariable(i, j, (int) fdummy,
					 1));
		     }else{
			edges_.push_back(new VrpVariable(i, j, (int) fdummy,
					 j ? 1 : 2));
		     }			
		  }
	       }
	       if ((wformat==3 || wformat==6) && 
		   !fscanf(f,"%lf", &fdummy)){
		  fprintf(stderr, "Not enough data -- DIMENSION or "
			  "EDGE_WEIGHT_TYPE declared wrong\n");
		  exit(1);
	       }
	    }
	    if (fscanf(f,"%lf", &fdummy)){
	       fprintf(stderr, "Too much data -- DIMENSION or "
		       "EDGE_WEIGHT_TYPE declared wrong\n");
	       exit(1);
	    }
	    break;
         case 0 : /* UPPER_ROW */
         case 2 : /* UPPER_DIAG_ROW */ 
         {
             
             // Deem not to be able solve large problem
             int ** lowDiag = new int* [vertnum_];
             for (i = 0; i < vertnum_; ++i) {
                 lowDiag[i] = new int [vertnum_];
             }
             for (i = 0; i < vertnum_; i++){
                 if (wformat == 2) {
                     if (!fscanf(f,"%lf", &fdummy)){
                         fprintf(stderr, "Not enough data -- DIMENSION or "
                                 "EDGE_WEIGHT_TYPE declared wrong");
                         exit(1);
                     }
                 }
                 for (j= i + 1; j < vertnum_; j++){
                     if (!fscanf(f,"%lf", &fdummy)){
                         fprintf(stderr, "Not enough data -- DIMENSION or "
                                 "EDGE_WEIGHT_TYPE declared wrong");
                         exit(1);
                     } else {
                         // Create lower diag 
                         lowDiag[j][i] = (int) fdummy;
                     }
                 }
             }
             if (fscanf(f,"%lf", &fdummy)){
                 fprintf(stderr, "Too much data -- DIMENSION or "
                         "EDGE_WEIGHT_TYPE declared wrong\n");
                 exit(1);
             }
             // Create edges
             for (i = 1, k = 0; i < vertnum_; i++){
                 for (j = 0; j < i; j++){
		     if (VrpPar_->entry(VrpParams::tspProb)){
			edges_.push_back(new VrpVariable(i, j, lowDiag[i][j],
					 1));
		     }else{
			edges_.push_back(new VrpVariable(i, j, lowDiag[i][j],
					 j ? 1 : 2));
		     }			
                 }
             }
             // Free lowDiag
             for (i = 0; i < vertnum_; ++i) {
                 delete [] lowDiag[i];
             }
             delete [] lowDiag;
             break;
         }
         case 5 : /* LOWER_COL */
         case 7 : /* LOWER_DIAG_COL */
	    for (i = 0; i < vertnum_; i++){
	       if (wformat==7) 
		  if (!fscanf(f,"%lf", &fdummy)){
		     fprintf(stderr, "Not enough data -- DIMENSION or "
			     "EDGE_WEIGHT_TYPE declared wrong");
		     exit(1);
		  }
	       for (j= i + 1; j < vertnum_; j++){
		  if (!fscanf(f,"%lf", &fdummy)){
		     fprintf(stderr, "Not enough data -- DIMENSION or "
			     "EDGE_WEIGHT_TYPE declared wrong");
		     exit(1);
		  } else {
		     if (VrpPar_->entry(VrpParams::tspProb)){
			edges_.push_back(new VrpVariable(i, j, (int) fdummy,
					 1));
		     }else{
			edges_.push_back(new VrpVariable(i, j, (int) fdummy,
					 j ? 1 : 2));
		     }			
		  }
	       }
	    }
	    if (fscanf(f,"%lf", &fdummy)){
	       fprintf(stderr, "Too much data -- DIMENSION or "
		       "EDGE_WEIGHT_TYPE declared wrong\n");
	       exit(1);
	    }
	    break;
	  case 8 : /* FULL_MATRIX */
	    for (i = 0; i < vertnum_; i++){
                for (j = 0; j < i; j++){
                    if(!fscanf(f,"%lf", &fdummy)){
                        fprintf(stderr, "Not enough data -- DIMENSION or "
                                "EDGE_WEIGHT_TYPE declared wrong");
                        exit(1);
                    }
		    if (VrpPar_->entry(VrpParams::tspProb)){
		       edges_.push_back(new VrpVariable(i, j, (int) fdummy,
					1));
		    }else{
		       edges_.push_back(new VrpVariable(i, j, (int) fdummy,
					j ? 1 : 2));
		    }			
                }
		for (j = i; j < vertnum_; j++){
                   if(!fscanf(f,"%lf", &fdummy)){
		      fprintf(stderr, "Not enough data -- DIMENSION or "
			      "EDGE_WEIGHT_TYPE declared wrong");
		      exit(1);
                   }
               }
#if 0 // BUG: can read upper diag
	       for (j = 0; j <= i; j++)
		  if(!fscanf(f,"%lf", &fdummy)){
		     fprintf(stderr, "Not enough data -- DIMENSION or "
			     "EDGE_WEIGHT_TYPE declared wrong");
		     exit(1);
		  }
	       for (j = i + 1; j < vertnum_; j++){
		  if(!fscanf(f,"%lf", &fdummy)){
		     fprintf(stderr, "Not enough data -- DIMENSION or "
			     "EDGE_WEIGHT_TYPE declared wrong");
		     exit(1);
		  }
		  if (VrpPar_->entry(VrpParams::tspProb)){
		     edges_.push_back(new VrpVariable(i, j, (int) fdummy,
				      1));
		  }else{
		     edges_.push_back(new VrpVariable(i, j, (int) fdummy,
				      j ? 1 : 2));
		  }			
	       }
#endif

	    }
	    if (fscanf(f,"%lf", &fdummy)){
	       fprintf(stderr, "Too much data -- DIMENSION or "
		       "EDGE_WEIGHT_TYPE declared wrong\n");
	       exit(1);
	    }
	    break;
	 }
	 break;
       case 9 : /* DISPLAY_DATA_SECTION */
	 /*--------------------- break if NO_DISPLAY -*/
	 if (dtype != 1){
	    fprintf(stderr, "DISPLAY_DATA_SECTION exists"
		    "but not TWOD_DISPLAY!\n");
	    exit(1);
	 }
	 /* posx, posy -*/
	 posx_ = new int[vertnum_];
	 posy_ = new int[vertnum_];
	 for (i = 0; i < vertnum_; i++){
	    if ((k = fscanf(f,"%i%lf%lf", &node, &x, &y)) != 3){
	       fprintf(stderr, "\nVrp I/O: error reading DISPLAY_DATA\n");
	       break;
	    }
	    posx_[node-1] = (int)(x + 0.5);
	    posy_[node-1] = (int)(y + 0.5);
	 }
	 if (fscanf(f,"%lf", &fdummy)){
	    fprintf(stderr, "\nVrp I/O: too much display data\n");
	    break;
	 }
	 break;
       case 10 : /* NODE_COORD_SECTION */
	 if (nctype == -1) nctype = 0;  /*if not given: TWOD_COORDS*/
	 if (dtype == -1 && ((wtype_ == _EUC_2D) || /*display type*/
			     (wtype_ == _MAX_2D) ||	 /*not defd yet*/
			     (wtype_ == _MAN_2D)   ))/*&& can disp.*/
	    dtype = 0;				    /* COORD_DISPLAY */
	 if (dtype == 0){
	    posx_ = new int[vertnum_];
	    posy_ = new int[vertnum_];
	 }
	 coordx_ = new double[vertnum_];
	 coordy_ = new double[vertnum_];
	 if (nctype == 1)
	    coordz_ = new double[vertnum_];
	 for (i=0; i<vertnum_; i++){
	    if (nctype == 0)	     /* TWOD_COORDS */
	       if (fscanf(f,"%i%lf%lf", &node, &coord_x, &coord_y) != 3){
		  fprintf(stderr, "\nVrp I/O: error reading NODE_COORD\n\n");
		  exit(1);
	       }
	    if (nctype == 1)	     /* THREED_COORDS */
	       if (fscanf(f,"%i%lf%lf%lf", &node, &coord_x, &coord_y,
			  &coord_z) != 4){
		  fprintf(stderr, "\nVrp I/O: error reading NODE_COORD\n\n");
		  exit(1);
	       }
	    coordx_[node-1] = coord_x;
	    coordy_[node-1] = coord_y;
	    /*since position is an integer and coord is a double, I must
	      round off here if dtype is EXPLICIT*/
	    if (dtype == 0){
	       posx_[node-1] = (int)coord_x;
	       posy_[node-1] = (int)coord_y;
	    }
	    if (nctype == 1) coordz_[node-1] = coord_z;
	    if (wtype_ == _GEO){ /* GEO */
	       /*--- latitude & longitude for node ------------*/
                deg = (int)(coordx_[node-1]);
                //deg = VrpRoundToNearest(coordx_[node-1]);
	       min = coordx_[node-1] - deg;
	       coordx_[node-1] = MY_PI * (deg + 5.0*min/3.0 ) / 180.0;
	       deg = (int)(coordy_[node-1]);
               //deg = floor(coordy_[node-1]);
               //deg = VrpRoundToNearest(coordy_[node-1]);
	       min = coordy_[node-1] - deg;
	       coordy_[node-1] = MY_PI * (deg + 5.0*min/3.0 ) / 180.0;
	    }
	 }
	 if (fscanf(f,"%i%lf%lf%lf", &node, &coord_x, &coord_y, &coord_z)){
	    fprintf(stderr, "\nVrp I/O: too much data in NODE_COORD\n\n");
	    exit(1);
	 }
	 break;
       case 11: /* NODE_COORD_TYPE */
	 sscanf(line, "%s", tmp);
	 for (nctype = 0; nctype < NCTYPE_NUM; nctype++)
	    if (strcmp(nctypes[nctype], tmp) == 0) break;
	 if (nctype == NCTYPE_NUM) {
	    fprintf(stderr, "Unknown node_coord_type : %s !!!\n", tmp);
	    exit(1);
	 }
	 break;
       case 12: /*DEPOT_SECTION*/
	 fscanf(f, "%i", &k);
	 if (k != 1){
	    fprintf(stderr, "Error in data: depot must be node 1");
	    exit(1);
	 }
	 depot_ = k - 1;
	 while (-1 != k) fscanf(f, "%i", &k);
	 break;
       case 13: /*CAPACITY_VOL*/
	 sscanf(line, "%i", &k);
	 capacity_vol = true;
	 break;
       case 14: /*DEMAND_SECTION*/
	 demand_ = new int[vertnum_];
	 for (i = 0; i < vertnum_; i++){
	    if (capacity_vol){
	       if (fscanf(f, "%i%i%i", &k, &l, &m) != 3){
		  fprintf(stderr,"\nVrp I/O: error reading DEMAND_SECTION\n\n");
		  exit(1);
	       }
	    }
	    else if (fscanf(f, "%i%i", &k, &l) != 2){
	       fprintf(stderr, "\nVrp I/O: error reading DEMAND_SECTION\n\n");
	       exit(1);
	    }
	    demand_[k-1] = l;
	    demand_[0] += l;
	 }
	 if (fscanf(f, "%i%i", &k, &l)){
	    fprintf(stderr, "\nVrp I/O: too much data in DEMAND_SECTION\n\n");
	    exit(1);
	 }
	 break;
       case 15: /*TIME_WINDOW_SECTION*/	/*These sections are not used*/
	 while (fscanf(f, "%d %*d:%*d %*d:%*d", &k));
	 break;
       case 16: /*STANDTIME_SECTION*/
	 while (fscanf(f, "%d%*d", &k));
	 break;
       case 17: /*PICKUP_SECTION*/	
	 while (fscanf(f, "%d%*d%*d", &k));
	 break;
       case 18: /*  EOF	*/
	 break;
       case 19: /*  NUMBER_OF_TRUCKS  */
	 if (!sscanf(line, "%i", &k)){
	    fprintf(stderr, "Vrp I/O: error reading NO_OF_TRUCKS\n\n");
	    exit(1);
	 }
	 numroutes_ = (int) k;
       default:
	 break;
      }
   }
   
   if (f != stdin)
      fclose(f);
   
   /*calculate all distances explicitly and then use distance type EXPLICIT*/
   if (wtype_ != _EXPLICIT){
      for (i = 1, k = 0; i < vertnum_; i++){
	 for (j = 0; j < i; j++){
	    if (VrpPar_->entry(VrpParams::tspProb)){
	       edges_.push_back(new VrpVariable(i, j, computeCost(i, j),
				1));
	    }else{
	       edges_.push_back(new VrpVariable(i, j, computeCost(i, j),
				j ? 1 : 2));
	    }			
	 }
      }
      wtype_ = _EXPLICIT;
   }

   if (VrpPar_->entry(VrpParams::tspProb)){
      capacity_ = vertnum_;
      numroutes_ = 1;
      demand_ = new int[vertnum_];
      demand_[0] = vertnum_;
      for (i = vertnum_ - 1; i > 0; i--)
	 demand_[i] = 1;
   }

   //-------------------------------------------------------
   // 2) Set colMatrix_, varLB_, varUB_, conLB_, conUB
   //    numCols_, numRows_
   // 3) Set objCoef_ and objSense_
   // 4) Set colType_ ('C', 'I', or 'B')
   //-------------------------------------------------------
   
   setModelData(); 
   
   //-------------------------------------------------------
   // 5) Create variables and constraints
   // 6) Set numCoreVariables_ and numCoreConstraints_
   //-------------------------------------------------------
   
   for (k = 0; k < numCols_; ++k) {
       variables_.push_back(edges_[k]);
   }

#if 0
   std::cout << "numCols = " << numCols_
             << "; variables_.size() = " << variables_.size() << std::endl;
#endif

   for (k = 0; k < numRows_; ++k) {
       BlisConstraint *con = new BlisConstraint(conLB_[k], 
                                                conUB_[k], 
                                                conLB_[k], 
                                                conUB_[k]);
       con->setObjectIndex(k);
       con->setRepType(BCPS_CORE);
       con->setStatus(BCPS_NONREMOVALBE);
       constraints_.push_back(con);
       con = NULL;
   }
   
   // Set all objects as core
   numCoreVariables_ = numCols_;
   numCoreConstraints_ = numRows_;
   
   // Allocate space for network for later use
   n_ = new VrpNetwork(edgenum_, vertnum_);

   // Add VRP cut generator
   VrpCutGenerator *cg = new VrpCutGenerator(this, vertnum_);
   cg->setStrategy(BlisCutStrategyPeriodic);
   cg->setCutGenerationFreq(1);
   addCutGenerator(cg);

   // Add TSP heuristic
   if (numroutes_ == 1) {  // TSP
       VrpHeurTSP *heurTSP1 = new VrpHeurTSP(this,
					     "TSP Root",
					     BlisHeurStrategyBeforeRoot, 1);
       VrpHeurTSP *heurTSP2 = new VrpHeurTSP(this, 
					     "TSP",
					     BlisHeurStrategyPeriodic, 1);
       addHeuristic(heurTSP1);
       addHeuristic(heurTSP2);
   }
}