예제 #1
0
void ParamItem::paramSliderReleased() {
	int sliderCurrent = ui->paramSlider->sliderPosition();
	Q_ASSERT(0 <= sliderCurrent && sliderCurrent <= maxValue);

	double min = getDoubleField(1);
	double max = getDoubleField(3);
	double current = double(sliderCurrent)/maxValue*(max - min) + min;

	setField(2, current);

	update();
}
예제 #2
0
void ParamItem::update() {
	double min = getDoubleField(1);
	double current = getDoubleField(2);
	double max = getDoubleField(3);
	Q_ASSERT(min <= max);
	Q_ASSERT(min <= current && current <= max);

	ui->paramName->setText(getStringField(0));

	ui->MinLabel->setText(QString::number(min));

	ui->CurrentValueEdit->setText(QString::number(current));

	ui->MaxLabel->setText(QString::number(max));

	int sliderCurrent = qRound64((current - min) / (max - min) * maxValue);
	Q_ASSERT(0 <= sliderCurrent && sliderCurrent <= maxValue);
	ui->paramSlider->setValue(sliderCurrent);
}
예제 #3
0
	double boundClosedGap(int inst, int iter) {
 		if ((inst < _sol->getNumInstances()) && (iter < getIter(inst)) )
			return 
			fabs(computeBoundClosedGap(getDoubleField(inst,iter,F_RES_UBOUND)
						,_sol->getDoubleField(inst,SOLUTIONS_RLT)
					,_sol->getDoubleField(inst,SOLUTIONS_OPT)));
		else {
			printf("boundClosedGapF_res1:: ERROR\n");
			return -COIN_DBL_MAX;
		}
	}
예제 #4
0
void ParamItem::currentEditEditingFinished() {
	double min = getDoubleField(1);
	double current = ui->CurrentValueEdit->text().toDouble();
	double max = getDoubleField(3);

	if(current < min){
		current = min;
	}

	if(current > max){
		current = max;
	}

	// Snap it to slider resolution.
	int sliderCurrent = qRound64((current - min) / (max - min) * maxValue);
	current = double(sliderCurrent)/maxValue*(max - min) + min;

	setField(2, current);

	update();
}
예제 #5
0
	void fprint(FILE *out) {
		for (int i=0;i<getNumInstances();i++) {
			fprintf(out,"%13s\t%10.2f\t%10.2f\t%5.2f\t%5.2f\t%5.2f\t%7.2f\t%7.2f\t%7.2f\n"
				,getInstanceName(i)
				,getDoubleField(i,SOLUTIONS_RLT)
				,getDoubleField(i,SOLUTIONS_OPT)
				,getDoubleField(i,SOLUTIONS_V1GAP)
				,getDoubleField(i,SOLUTIONS_V2GAP)
				,getDoubleField(i,SOLUTIONS_V3GAP)
				,getDoubleField(i,SOLUTIONS_V1TIME)
				,getDoubleField(i,SOLUTIONS_V2TIME)
				,getDoubleField(i,SOLUTIONS_V3TIME));
		}
	}
예제 #6
0
파일: field.c 프로젝트: achun2080/knife
jobject getFieldValue(JNIEnv * env, jobject obj, jclass fieldClass,
		jfieldID fieldId) {
	char* signature;
	(*jvmti)->GetClassSignature(jvmti, fieldClass, &signature, 0 );
	if (strcmp(signature, "Z") == 0) {
		return getBooleanField(env, obj, fieldId);
	} else if (strcmp(signature, "B") == 0) {
		return getByteField(env, obj, fieldId);
	} else if (strcmp(signature, "C") == 0) {
		return getCharField(env, obj, fieldId);
	} else if (strcmp(signature, "S") == 0) {
		return getShortField(env, obj, fieldId);
	} else if (strcmp(signature, "I") == 0) {
		return getIntField(env, obj, fieldId);
	} else if (strcmp(signature, "J") == 0) {
		return getLongField(env, obj, fieldId);
	} else if (strcmp(signature, "F") == 0) {
		return getFloatField(env, obj, fieldId);
	} else if (strcmp(signature, "D") == 0) {
		return getDoubleField(env, obj, fieldId);
	} else {
		return getObjectField(env, obj, fieldId);
	}
}
예제 #7
0
	void fprint(FILE* out) {
		for (int i=0;i<_sol->getNumInstances();i++) {
			for (int k=0;k<getIter(i);k++) {
				fprintf(out,"%13s\t%10.2f\t%3d\t%7.2f\t%5d\t%5d"
					,_sol->getInstanceName(i)
					,getDoubleField(i,k,F_RES_UBOUND)
					,getIntField(i,k,F_RES_ITER)
					,getDoubleField(i,k,F_RES_TIME)
					,getIntField(i,k,F_RES_TOTCONS)
					,getIntField(i,k,F_RES_ITERGENCONS));
				if (getDoubleField(i,k,F_RES_CURRHEUR) <= -COIN_DBL_MAX)
					fprintf(out,"\t%10s","N/A");
				else
					fprintf(out,"\t%10.2f",getDoubleField(i,k,F_RES_CURRHEUR));

				if (getDoubleField(i,k,F_RES_BESTHEUR) <= -COIN_DBL_MAX)
					fprintf(out,"\t%10s","N/A");
				else
					fprintf(out,"\t%10.2f",getDoubleField(i,k,F_RES_BESTHEUR));
				fprintf(out,"\n");
			}
		}
	}