...
 
Commits (8)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.2.0, 2020-01-27T10:46:33. -->
<!-- Written by QtCreator 4.2.0, 2020-02-13T01:48:04. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......
......@@ -30,8 +30,8 @@ private slots:
void on_btnAplicar_clicked();
void onModelDataChanged();
void onTablaModelVerticalScrollChanged(int value);
void onTablaModelFamilyVerticalScrollChanged(int value);
void onTablaModelCellClicked(const QModelIndex &);
void onTablaModelFamilyVerticalScrollChanged(int value);
void onTablaModelFamilyCellClicked(const QModelIndex &);
void onCantidadValueChanged(int i);
......@@ -40,12 +40,11 @@ signals:
public:
explicit DataEditorWidget(QWidget *parent = 0);
~DataEditorWidget();
Simulation* getSimulacion() { return this->simulacion; }
bool getHuboCambios() { return this->huboCambios; }
~DataEditorWidget();
void nuevaSimulacion(QString ruta);
void actualizarNombreViviendas();
bool guardar();
......
data;
set C := c2 c0 c1;
set V := v0 v1 v2;
param p : v0 v1 v2 :=
c2 3 2 1
c0 1 2 3
c1 2 3 1
;
end;
\ No newline at end of file
data;
set C := c2 c0 c1;
set V := v0 v1 v2;
param S := 2;
param p : v0 v1 v2 :=
c2 3 2 1
c0 1 2 3
c1 2 3 1
;
end;
\ No newline at end of file
Reading model section from GLPK/Modelos/MTAV.mod...
GLPK/Modelos/MTAV.mod:29: warning: unexpected end of file; missing end statement inserted
29 lines were read
Reading data section from GLPK/Datos/MTAV_pref.dat...
GLPK/Datos/MTAV_pref.dat:13: warning: final NL missing before end of file
13 lines were read
Generating resultado...
Generating z_menorIgual...
Generating unicaAsignacionCoperativista_mayorIgual...
Generating unicaAsignacionCoperativista_menorIgual...
Generating unicaAsignacionCasa_mayorIgual...
Generating unicaAsignacionCasa_menorIgual...
Model has been successfully generated
lpx_simplex: original LP has 16 rows, 10 columns, 49 non-zeros
lpx_simplex: presolved LP has 15 rows, 10 columns, 48 non-zeros
lpx_adv_basis: size of triangular part = 15
* 8: objval = 2.000000000e+000 infeas = 0.000000000e+000 (0)
* 15: objval = 1.500000000e+000 infeas = 1.110223025e-016 (0)
OPTIMAL SOLUTION FOUND
Integer optimization begins...
Objective function is integral
+ 15: mip = not found yet >= -inf (1; 0)
+ 20: mip = 3.000000000e+000 >= 2.000000000e+000 33.3% (3; 0)
+ 24: mip = 2.000000000e+000 >= 2.000000000e+000 0.0% (4; 1)
+ 24: mip = 2.000000000e+000 >= tree is empty 0.0% (0; 9)
INTEGER OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 0.2M (178873 bytes)
lpx_print_mip: writing MIP problem solution to `GLPK/Soluciones/MTAV_pref.sol'...
set C;
/* cooperativistas */
set V;
/* viviendas */
param p{c in C, v in V};
/* prioridades de los cooperativistas por las viviendas */
var x{c in C, v in V}, binary;
/* indica si el cooperativista c es asignado a la vivienda v */
var z, integer;
/* variable auxiliar para representar la mínima satisfacción */
minimize resultado: z;
s.t. z_menorIgual{c in C}: z >= sum{v in V} p[c,v] * x[c,v];
/* busco que z sea menor o igual que la satisfacción de cada cooperativista c */
s.t. unicaAsignacionCoperativista_mayorIgual{c in C}: sum{v in V} x[c,v] >= 1;
s.t. unicaAsignacionCoperativista_menorIgual{c in C}: sum{v in V} x[c,v] <= 1;
/* el cooperativista c solo tiene una vivienda asignada */
s.t. unicaAsignacionCasa_mayorIgual{v in V}: sum{c in C} x[c,v] >= 1;
s.t. unicaAsignacionCasa_menorIgual{v in V}: sum{c in C} x[c,v] <= 1;
/* la vivienda v solo tiene un cooperativista asignado */
set C;
/* cooperativistas */
set V;
/* viviendas */
param S;
/* satisfacción */
param p{c in C, v in V};
/* prioridades de los cooperativistas por las viviendas */
var x{c in C, v in V}, binary;
/* indica si el cooperativista c es asignado a la vivienda v */
minimize s: sum{c in C, v in V} p[c,v] * x[c,v];
/* preferencias acumuladas */
s.t. unicaAsignacionCoperativista_mayorIgual{c in C}: sum{v in V} x[c,v] >= 1;
s.t. unicaAsignacionCoperativista_menorIgual{c in C}: sum{v in V} x[c,v] <= 1;
/* el cooperativista c solo tiene una vivienda asignada */
s.t. unicaAsignacionCasa_mayorIgual{v in V}: sum{c in C} x[c,v] >= 1;
s.t. unicaAsignacionCasa_menorIgual{v in V}: sum{c in C} x[c,v] <= 1;
/* la vivienda v solo tiene un cooperativista asignado */
s.t. z_menorIgual{c in C}: sum{v in V} p[c,v] * x[c,v] <= S;
/* nivel de satisfacción */
\ No newline at end of file
Problem: MTAV
Rows: 16
Columns: 10 (10 integer, 9 binary)
Non-zeros: 49
Status: INTEGER OPTIMAL
Objective: resultado = 2 (MINimum) 1.5 (LP)
No. Row name Activity Lower bound Upper bound
------ ------------ ------------- ------------- -------------
1 resultado 2
2 z_menorIgual[c2]
0 -0
3 z_menorIgual[c0]
1 -0
4 z_menorIgual[c1]
1 -0
5 unicaAsignacionCoperativista_mayorIgual[c2]
1 1
6 unicaAsignacionCoperativista_mayorIgual[c0]
1 1
7 unicaAsignacionCoperativista_mayorIgual[c1]
1 1
8 unicaAsignacionCoperativista_menorIgual[c2]
1 1
9 unicaAsignacionCoperativista_menorIgual[c0]
1 1
10 unicaAsignacionCoperativista_menorIgual[c1]
1 1
11 unicaAsignacionCasa_mayorIgual[v0]
1 1
12 unicaAsignacionCasa_mayorIgual[v1]
1 1
13 unicaAsignacionCasa_mayorIgual[v2]
1 1
14 unicaAsignacionCasa_menorIgual[v0]
1 1
15 unicaAsignacionCasa_menorIgual[v1]
1 1
16 unicaAsignacionCasa_menorIgual[v2]
1 1
No. Column name Activity Lower bound Upper bound
------ ------------ ------------- ------------- -------------
1 x[c2,v0] * 0 0 1
2 x[c2,v1] * 1 0 1
3 x[c2,v2] * 0 0 1
4 x[c0,v0] * 1 0 1
5 x[c0,v1] * 0 0 1
6 x[c0,v2] * 0 0 1
7 x[c1,v0] * 0 0 1
8 x[c1,v1] * 0 0 1
9 x[c1,v2] * 1 0 1
10 z * 2
End of output
Problem: MTAV_empate
Rows: 16
Columns: 9 (9 integer, 9 binary)
Non-zeros: 54
Status: INTEGER OPTIMAL
Objective: s = 4 (MINimum) 4 (LP)
No. Row name Activity Lower bound Upper bound
------ ------------ ------------- ------------- -------------
1 s 4
2 unicaAsignacionCoperativista_mayorIgual[c2]
1 1
3 unicaAsignacionCoperativista_mayorIgual[c0]
1 1
4 unicaAsignacionCoperativista_mayorIgual[c1]
1 1
5 unicaAsignacionCoperativista_menorIgual[c2]
1 1
6 unicaAsignacionCoperativista_menorIgual[c0]
1 1
7 unicaAsignacionCoperativista_menorIgual[c1]
1 1
8 unicaAsignacionCasa_mayorIgual[v0]
1 1
9 unicaAsignacionCasa_mayorIgual[v1]
1 1
10 unicaAsignacionCasa_mayorIgual[v2]
1 1
11 unicaAsignacionCasa_menorIgual[v0]
1 1
12 unicaAsignacionCasa_menorIgual[v1]
1 1
13 unicaAsignacionCasa_menorIgual[v2]
1 1
14 z_menorIgual[c2]
2 2
15 z_menorIgual[c0]
1 2
16 z_menorIgual[c1]
1 2
No. Column name Activity Lower bound Upper bound
------ ------------ ------------- ------------- -------------
1 x[c2,v0] * 0 0 1
2 x[c2,v1] * 1 0 1
3 x[c2,v2] * 0 0 1
4 x[c0,v0] * 1 0 1
5 x[c0,v1] * 0 0 1
6 x[c0,v2] * 0 0 1
7 x[c1,v0] * 0 0 1
8 x[c1,v1] * 0 0 1
9 x[c1,v2] * 1 0 1
End of output
SORTEO,test
CANTIDAD_VIVIENDAS,9
-,v1,v2,v3,v4,v5,v6,v7,v8,v9
M,1,2,3,4,5,6,7,8,9
S,2,3,1,7,3,6,5,4,7
A,6,2,1,2,4,3,5,6,7
P,2,8,9,7,6,4,5,3,1
O,1,4,5,2,3,6,7,8,9
I,4,5,7,6,3,2,8,9,1
U,9,8,7,6,5,1,2,3,4
Y,1,2,3,4,9,8,7,6,5
T,9,8,7,6,5,4,3,2,1
SORTEO,test
CANTIDAD_VIVIENDAS,3
-,v1,v2,v3
M,1,2,3
S,2,3,1
A,3,2,1
[General]
CANT_VIVIENDAS_DEFAULT=10
MAIN_WINDOW_GEOMETRY=@ByteArray(\x1\xd9\xd0\xcb\0\x2\0\0\0\0\0\xb1\0\0\0h\0\0\az\0\0\x3\x8e\0\0\0\xba\0\0\0\x8e\0\0\aq\0\0\x3\x85\0\0\0\0\0\0\0\0\a\x80)
CSV_DELIMITER=0
MAIN_WINDOW_STATE=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\0\0\0\x6\xb8\0\0\x2\x86\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1\0\0\0\x2\0\0\0\x1\0\0\0\x16\0m\0\x61\0i\0n\0T\0o\0o\0l\0\x42\0\x61\0r\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0)
CARGAR_ULTIMO_SORTEO=true
RUTA_ULTIMO_SORTEO=C:/Users/Marcos/Desktop/MTAV_Code/programa/debug/GLPK/prueba.csv
GUARDAR_AUTOMATICAMENTE_REPORTE=false
2019-11-29 20:27:50.138 INF: Inicio de la aplicación
2019-11-29 20:27:53.068 INF: "Nueva simulacion con ruta="
2019-12-02 23:20:45.634 INF: Inicio de la aplicación
2019-12-02 23:20:48.250 INF: "Nueva simulacion con ruta="
2020-01-27 01:46:02.989 INF: Inicio de la aplicación
2020-01-27 01:46:04.898 INF: "Nueva simulacion con ruta="
2020-01-27 01:46:24.919 WRN: "Datos invalidos para correr el proyecto: Nombre de sorteo vacio"
2020-01-27 01:46:28.213 INF: "Inicio de ejecucion del Proyecto=a"
2020-01-27 01:47:46.766 INF: Inicio de la aplicación
2020-01-27 01:47:47.210 INF: "Nueva simulacion con ruta="
2020-01-27 01:48:11.234 INF: "Inicio de ejecucion del Proyecto=12"
2020-01-27 01:48:15.093 CRT: function:0x18c5e294 line 0x18c5e28c GLPK MTAV ERROR en la salida
2020-01-27 01:48:15.140 CRT: function:0x18c5e1b4 line 0x18c5e1ac GLPK MTAV_Empate ERROR en la salida
2020-01-27 01:49:37.012 INF: Inicio de la aplicación
2020-01-27 01:49:38.921 INF: "Nueva simulacion con ruta="
2020-01-27 01:50:01.383 INF: "Inicio de ejecucion del Proyecto=122"
2020-01-27 01:55:46.311 INF: Inicio de la aplicación
2020-01-27 01:55:46.763 INF: "Nueva simulacion con ruta="
2020-01-27 01:56:29.752 INF: "Inicio de ejecucion del Proyecto=qwe"
2020-01-27 01:56:29.814 CRT: function:0x18cee7a4 line 0x18cee79c GLPK MTAV ERROR en la salida
2020-01-27 01:56:29.861 CRT: function:0x18cee814 line 0x18cee80c GLPK MTAV_Empate ERROR en la salida
2020-01-27 01:56:58.617 INF: Inicio de la aplicación
2020-01-27 01:57:00.574 INF: "Nueva simulacion con ruta="
2020-01-27 01:57:24.838 INF: "Inicio de ejecucion del Proyecto=3"
2020-01-27 01:58:50.615 CRT: function:0x1b082dfc line 0x1b082df4 GLPK MTAV ERROR en la salida
2020-01-27 01:58:50.677 CRT: function:0x18cc05f4 line 0x18cc05ec GLPK MTAV_Empate ERROR en la salida
2020-01-27 01:58:54.832 INF: "Inicio de ejecucion del Proyecto=3"
2020-01-27 01:59:11.673 INF: GLPK MTAV Status: FOUND
2020-01-27 01:59:16.440 CRT: function:0x1b193e74 line 0x1b193e6c GLPK MTAV_Empate ERROR en la salida
2020-01-27 08:21:13.506 INF: Inicio de la aplicación
2020-01-27 08:21:15.800 INF: "Nueva simulacion con ruta="
2020-01-27 08:21:42.918 WRN: "Datos invalidos para correr el proyecto: Nombre de sorteo vacio"
2020-01-27 08:21:47.693 INF: "Inicio de ejecucion del Proyecto=asfa"
2020-01-27 08:23:11.153 INF: GLPK MTAV Status: FOUND
2020-01-27 08:23:16.217 CRT: function:0x21538fc4 line 0x21538fbc GLPK MTAV_Empate ERROR en la salida
2020-01-27 08:28:14.753 INF: "Inicio de ejecucion del Proyecto=asfa"
2020-01-27 08:31:51.546 INF: GLPK MTAV Status: FOUND
2020-01-27 08:31:54.406 CRT: function:0x2155454c line 0x21554544 GLPK MTAV_Empate ERROR en la salida
2020-01-27 08:31:59.199 INF: "Inicio de ejecucion del Proyecto=asfa"
2020-01-27 08:32:06.400 INF: GLPK MTAV Status: FOUND
2020-01-27 08:36:11.832 INF: Inicio de la aplicación
2020-01-27 08:36:13.818 INF: "Nueva simulacion con ruta="
2020-01-27 08:36:36.845 INF: "Inicio de ejecucion del Proyecto=afsd"
2020-01-27 08:36:40.980 INF: GLPK MTAV Status: FOUND
2020-01-27 08:37:13.163 INF: GLPK MTAV_Empate Status: FOUND
2020-01-27 08:45:35.207 INF: Inicio de la aplicación
2020-01-27 08:45:37.191 INF: "Nueva simulacion con ruta="
2020-01-27 08:46:00.605 INF: "Inicio de ejecucion del Proyecto=ll"
2020-01-27 08:47:35.241 INF: Inicio de la aplicación
2020-01-27 08:47:37.225 INF: "Nueva simulacion con ruta="
2020-01-27 08:47:56.799 INF: "Inicio de ejecucion del Proyecto=k"
2020-01-27 08:48:10.265 INF: GLPK MTAV Status: FOUND
2020-01-27 08:56:04.300 INF: Inicio de la aplicación
2020-01-27 08:56:06.272 INF: "Nueva simulacion con ruta="
2020-01-27 08:56:24.779 INF: "Inicio de ejecucion del Proyecto=m"
2020-01-27 08:58:25.608 INF: GLPK MTAV Status: FOUND
2020-01-27 08:58:26.635 INF: GLPK MTAV_Empate Status: FOUND
2020-01-27 08:59:10.872 INF: "Nueva simulacion con ruta=C:/Users/Marcos/Desktop/MTAV_Code/programa/debug/GLPK/SORTEO COVITVUNO DOS DORMITORIOS.csv"
2020-01-27 08:59:16.578 INF: "Inicio de ejecucion del Proyecto=Sorteo COVITVUNO 2 dormitorios"
2020-01-27 09:01:35.182 CRT: function:0x1b0ac21c line 0x1b0ac214 GLPK MTAV ERROR en la salida
2020-01-27 09:01:36.855 WRN: QProcess::start: Process is already running
2020-01-27 09:01:36.856 INF: GLPK MTAV_Empate Status: FOUND
2020-01-27 09:01:52.728 INF: "Guardado de proyecto en: C:/Users/Marcos/Desktop/MTAV_Code/programa/debug/GLPK/prueba.csv"
2020-01-27 09:07:10.420 INF: Inicio de la aplicación
2020-01-27 09:07:12.395 INF: "Nueva simulacion con ruta=C:/Users/Marcos/Desktop/MTAV_Code/programa/debug/GLPK/prueba.csv"
2020-01-27 09:07:17.772 INF: "Inicio de ejecucion del Proyecto=Sorteo COVITVUNO 2 dormitorios"
2020-01-27 09:08:24.769 INF: Inicio de la aplicación
2020-01-27 09:08:26.730 INF: "Nueva simulacion con ruta=C:/Users/Marcos/Desktop/MTAV_Code/programa/debug/GLPK/prueba.csv"
2020-01-27 09:08:30.320 INF: "Inicio de ejecucion del Proyecto=Sorteo COVITVUNO 2 dormitorios"
2020-01-27 09:10:46.699 INF: GLPK MTAV Status: FOUND
2020-01-27 09:11:04.934 INF: GLPK MTAV_Empate Status: FOUND
/****************************************************************************
** Meta object code from reading C++ file 'configurationwidget.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../configurationwidget.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'configurationwidget.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.7.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_ConfigurationWidget_t {
QByteArrayData data[6];
char stringdata0[131];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_ConfigurationWidget_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_ConfigurationWidget_t qt_meta_stringdata_ConfigurationWidget = {
{
QT_MOC_LITERAL(0, 0, 19), // "ConfigurationWidget"
QT_MOC_LITERAL(1, 20, 21), // "on_btnGuardar_clicked"
QT_MOC_LITERAL(2, 42, 0), // ""
QT_MOC_LITERAL(3, 43, 22), // "on_btnCancelar_clicked"
QT_MOC_LITERAL(4, 66, 22), // "on_btnExaminar_clicked"
QT_MOC_LITERAL(5, 89, 41) // "on_checkGuardadoAutomaticoRep..."
},
"ConfigurationWidget\0on_btnGuardar_clicked\0"
"\0on_btnCancelar_clicked\0on_btnExaminar_clicked\0"
"on_checkGuardadoAutomaticoReporte_clicked"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_ConfigurationWidget[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
4, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 0, 34, 2, 0x08 /* Private */,
3, 0, 35, 2, 0x08 /* Private */,
4, 0, 36, 2, 0x08 /* Private */,
5, 0, 37, 2, 0x08 /* Private */,
// slots: parameters
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
0 // eod
};
void ConfigurationWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
ConfigurationWidget *_t = static_cast<ConfigurationWidget *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->on_btnGuardar_clicked(); break;
case 1: _t->on_btnCancelar_clicked(); break;
case 2: _t->on_btnExaminar_clicked(); break;
case 3: _t->on_checkGuardadoAutomaticoReporte_clicked(); break;
default: ;
}
}
Q_UNUSED(_a);
}
const QMetaObject ConfigurationWidget::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_ConfigurationWidget.data,
qt_meta_data_ConfigurationWidget, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
};
const QMetaObject *ConfigurationWidget::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *ConfigurationWidget::qt_metacast(const char *_clname)
{
if (!_clname) return Q_NULLPTR;
if (!strcmp(_clname, qt_meta_stringdata_ConfigurationWidget.stringdata0))
return static_cast<void*>(const_cast< ConfigurationWidget*>(this));
return QDialog::qt_metacast(_clname);
}
int ConfigurationWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4)
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 4)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 4;
}
return _id;
}
QT_END_MOC_NAMESPACE
/****************************************************************************
** Meta object code from reading C++ file 'dataeditorwidget.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../dataeditorwidget.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'dataeditorwidget.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.7.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_DataEditorWidget_t {
QByteArrayData data[14];
char stringdata0[257];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_DataEditorWidget_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_DataEditorWidget_t qt_meta_stringdata_DataEditorWidget = {
{
QT_MOC_LITERAL(0, 0, 16), // "DataEditorWidget"
QT_MOC_LITERAL(1, 17, 12), // "ruta_changed"
QT_MOC_LITERAL(2, 30, 0), // ""
QT_MOC_LITERAL(3, 31, 3), // "txt"
QT_MOC_LITERAL(4, 35, 21), // "on_btnSimular_clicked"
QT_MOC_LITERAL(5, 57, 21), // "on_btnAplicar_clicked"
QT_MOC_LITERAL(6, 79, 18), // "onModelDataChanged"
QT_MOC_LITERAL(7, 98, 33), // "onTablaModelVerticalScrollCha..."
QT_MOC_LITERAL(8, 132, 5), // "value"
QT_MOC_LITERAL(9, 138, 39), // "onTablaModelFamilyVerticalScr..."
QT_MOC_LITERAL(10, 178, 23), // "onTablaModelCellClicked"
QT_MOC_LITERAL(11, 202, 29), // "onTablaModelFamilyCellClicked"
QT_MOC_LITERAL(12, 232, 22), // "onCantidadValueChanged"
QT_MOC_LITERAL(13, 255, 1) // "i"
},
"DataEditorWidget\0ruta_changed\0\0txt\0"
"on_btnSimular_clicked\0on_btnAplicar_clicked\0"
"onModelDataChanged\0onTablaModelVerticalScrollChanged\0"
"value\0onTablaModelFamilyVerticalScrollChanged\0"
"onTablaModelCellClicked\0"
"onTablaModelFamilyCellClicked\0"
"onCantidadValueChanged\0i"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_DataEditorWidget[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
9, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
1, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 59, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
4, 0, 62, 2, 0x08 /* Private */,
5, 0, 63, 2, 0x08 /* Private */,
6, 0, 64, 2, 0x08 /* Private */,
7, 1, 65, 2, 0x08 /* Private */,
9, 1, 68, 2, 0x08 /* Private */,
10, 1, 71, 2, 0x08 /* Private */,
11, 1, 74, 2, 0x08 /* Private */,
12, 1, 77, 2, 0x08 /* Private */,
// signals: parameters
QMetaType::Int, QMetaType::QString, 3,
// slots: parameters
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void, QMetaType::Int, 8,
QMetaType::Void, QMetaType::Int, 8,
QMetaType::Void, QMetaType::QModelIndex, 2,
QMetaType::Void, QMetaType::QModelIndex, 2,
QMetaType::Void, QMetaType::Int, 13,
0 // eod
};
void DataEditorWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
DataEditorWidget *_t = static_cast<DataEditorWidget *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: { int _r = _t->ruta_changed((*reinterpret_cast< QString(*)>(_a[1])));
if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break;
case 1: _t->on_btnSimular_clicked(); break;
case 2: _t->on_btnAplicar_clicked(); break;
case 3: _t->onModelDataChanged(); break;
case 4: _t->onTablaModelVerticalScrollChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 5: _t->onTablaModelFamilyVerticalScrollChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 6: _t->onTablaModelCellClicked((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
case 7: _t->onTablaModelFamilyCellClicked((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
case 8: _t->onCantidadValueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
void **func = reinterpret_cast<void **>(_a[1]);
{
typedef int (DataEditorWidget::*_t)(QString );
if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&DataEditorWidget::ruta_changed)) {
*result = 0;
return;
}
}
}
}
const QMetaObject DataEditorWidget::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_DataEditorWidget.data,
qt_meta_data_DataEditorWidget, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
};
const QMetaObject *DataEditorWidget::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *DataEditorWidget::qt_metacast(const char *_clname)
{
if (!_clname) return Q_NULLPTR;
if (!strcmp(_clname, qt_meta_stringdata_DataEditorWidget.stringdata0))
return static_cast<void*>(const_cast< DataEditorWidget*>(this));
return QWidget::qt_metacast(_clname);
}
int DataEditorWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 9)
qt_static_metacall(this, _c, _id, _a);
_id -= 9;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 9)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 9;
}
return _id;
}
// SIGNAL 0
int DataEditorWidget::ruta_changed(QString _t1)
{
int _t0 = int();
void *_a[] = { const_cast<void*>(reinterpret_cast<const void*>(&_t0)), const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
return _t0;
}
QT_END_MOC_NAMESPACE
/****************************************************************************
** Meta object code from reading C++ file 'householdseditorwidget.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../householdseditorwidget.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'householdseditorwidget.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.7.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_HouseHoldsEditorWidget_t {
QByteArrayData data[4];
char stringdata0[69];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_HouseHoldsEditorWidget_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_HouseHoldsEditorWidget_t qt_meta_stringdata_HouseHoldsEditorWidget = {
{
QT_MOC_LITERAL(0, 0, 22), // "HouseHoldsEditorWidget"
QT_MOC_LITERAL(1, 23, 21), // "on_btnGuardar_clicked"
QT_MOC_LITERAL(2, 45, 0), // ""
QT_MOC_LITERAL(3, 46, 22) // "on_btnCancelar_clicked"
},
"HouseHoldsEditorWidget\0on_btnGuardar_clicked\0"
"\0on_btnCancelar_clicked"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_HouseHoldsEditorWidget[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
2, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 0, 24, 2, 0x08 /* Private */,
3, 0, 25, 2, 0x08 /* Private */,
// slots: parameters
QMetaType::Void,
QMetaType::Void,
0 // eod
};
void HouseHoldsEditorWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
HouseHoldsEditorWidget *_t = static_cast<HouseHoldsEditorWidget *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->on_btnGuardar_clicked(); break;
case 1: _t->on_btnCancelar_clicked(); break;
default: ;
}
}
Q_UNUSED(_a);
}
const QMetaObject HouseHoldsEditorWidget::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_HouseHoldsEditorWidget.data,
qt_meta_data_HouseHoldsEditorWidget, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
};
const QMetaObject *HouseHoldsEditorWidget::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *HouseHoldsEditorWidget::qt_metacast(const char *_clname)
{
if (!_clname) return Q_NULLPTR;
if (!strcmp(_clname, qt_meta_stringdata_HouseHoldsEditorWidget.stringdata0))
return static_cast<void*>(const_cast< HouseHoldsEditorWidget*>(this));
return QDialog::qt_metacast(_clname);
}
int HouseHoldsEditorWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 2)
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 2)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 2;
}
return _id;
}
QT_END_MOC_NAMESPACE
/****************************************************************************
** Meta object code from reading C++ file 'mainwindow.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../mainwindow.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'mainwindow.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.7.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_MainWindow_t {
QByteArrayData data[14];
char stringdata0[296];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_MainWindow_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = {
{
QT_MOC_LITERAL(0, 0, 10), // "MainWindow"
QT_MOC_LITERAL(1, 11, 24), // "on_actionNuevo_triggered"
QT_MOC_LITERAL(2, 36, 0), // ""
QT_MOC_LITERAL(3, 37, 24), // "on_actionAbrir_triggered"
QT_MOC_LITERAL(4, 62, 26), // "on_actionGuardar_triggered"
QT_MOC_LITERAL(5, 89, 24), // "on_actionAyuda_triggered"
QT_MOC_LITERAL(6, 114, 35), // "on_actionAbrir_datos_GLPK_tri..."
QT_MOC_LITERAL(7, 150, 24), // "on_actionSalir_triggered"
QT_MOC_LITERAL(8, 175, 35), // "on_actionEditar_viviendas_tri..."
QT_MOC_LITERAL(9, 211, 32), // "on_actionConfiguraci_n_triggered"
QT_MOC_LITERAL(10, 244, 22), // "on_changeStatusBarText"
QT_MOC_LITERAL(11, 267, 4), // "text"
QT_MOC_LITERAL(12, 272, 10), // "closeEvent"
QT_MOC_LITERAL(13, 283, 12) // "QCloseEvent*"
},
"MainWindow\0on_actionNuevo_triggered\0"
"\0on_actionAbrir_triggered\0"
"on_actionGuardar_triggered\0"
"on_actionAyuda_triggered\0"
"on_actionAbrir_datos_GLPK_triggered\0"
"on_actionSalir_triggered\0"
"on_actionEditar_viviendas_triggered\0"
"on_actionConfiguraci_n_triggered\0"
"on_changeStatusBarText\0text\0closeEvent\0"
"QCloseEvent*"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_MainWindow[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
10, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 0, 64, 2, 0x08 /* Private */,
3, 0, 65, 2, 0x08 /* Private */,
4, 0, 66, 2, 0x08 /* Private */,
5, 0, 67, 2, 0x08 /* Private */,
6, 0, 68, 2, 0x08 /* Private */,
7, 0, 69, 2, 0x08 /* Private */,
8, 0, 70, 2, 0x08 /* Private */,
9, 0, 71, 2, 0x08 /* Private */,
10, 1, 72, 2, 0x08 /* Private */,
12, 1, 75, 2, 0x08 /* Private */,
// slots: parameters
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void, QMetaType::QString, 11,
QMetaType::Void, 0x80000000 | 13, 2,
0 // eod
};
void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
MainWindow *_t = static_cast<MainWindow *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->on_actionNuevo_triggered(); break;
case 1: _t->on_actionAbrir_triggered(); break;
case 2: _t->on_actionGuardar_triggered(); break;
case 3: _t->on_actionAyuda_triggered(); break;
case 4: _t->on_actionAbrir_datos_GLPK_triggered(); break;
case 5: _t->on_actionSalir_triggered(); break;
case 6: _t->on_actionEditar_viviendas_triggered(); break;
case 7: _t->on_actionConfiguraci_n_triggered(); break;
case 8: _t->on_changeStatusBarText((*reinterpret_cast< QString(*)>(_a[1]))); break;
case 9: _t->closeEvent((*reinterpret_cast< QCloseEvent*(*)>(_a[1]))); break;
default: ;
}
}
}
const QMetaObject MainWindow::staticMetaObject = {
{ &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow.data,
qt_meta_data_MainWindow, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
};
const QMetaObject *MainWindow::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *MainWindow::qt_metacast(const char *_clname)
{
if (!_clname) return Q_NULLPTR;
if (!strcmp(_clname, qt_meta_stringdata_MainWindow.stringdata0))
return static_cast<void*>(const_cast< MainWindow*>(this));
return QMainWindow::qt_metacast(_clname);
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 10)
qt_static_metacall(this, _c, _id, _a);
_id -= 10;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 10)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 10;
}
return _id;
}
QT_END_MOC_NAMESPACE
/****************************************************************************
** Meta object code from reading C++ file 'simulationresultwidget.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../simulationresultwidget.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'simulationresultwidget.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.7.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_SimulationResultWidget_t {
QByteArrayData data[4];
char stringdata0[72];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_SimulationResultWidget_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_SimulationResultWidget_t qt_meta_stringdata_SimulationResultWidget = {
{
QT_MOC_LITERAL(0, 0, 22), // "SimulationResultWidget"
QT_MOC_LITERAL(1, 23, 26), // "on_btnExportarAPdf_clicked"
QT_MOC_LITERAL(2, 50, 0), // ""
QT_MOC_LITERAL(3, 51, 20) // "on_btnCerrar_clicked"
},
"SimulationResultWidget\0"
"on_btnExportarAPdf_clicked\0\0"
"on_btnCerrar_clicked"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_SimulationResultWidget[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
2, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 0, 24, 2, 0x08 /* Private */,
3, 0, 25, 2, 0x08 /* Private */,
// slots: parameters
QMetaType::Void,
QMetaType::Void,
0 // eod
};
void SimulationResultWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
SimulationResultWidget *_t = static_cast<SimulationResultWidget *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->on_btnExportarAPdf_clicked(); break;
case 1: _t->on_btnCerrar_clicked(); break;
default: ;
}
}
Q_UNUSED(_a);
}
const QMetaObject SimulationResultWidget::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_SimulationResultWidget.data,
qt_meta_data_SimulationResultWidget, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
};
const QMetaObject *SimulationResultWidget::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *SimulationResultWidget::qt_metacast(const char *_clname)
{
if (!_clname) return Q_NULLPTR;
if (!strcmp(_clname, qt_meta_stringdata_SimulationResultWidget.stringdata0))
return static_cast<void*>(const_cast< SimulationResultWidget*>(this));
return QDialog::qt_metacast(_clname);
}
int SimulationResultWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 2)
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 2)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 2;
}
return _id;
}
QT_END_MOC_NAMESPACE
This diff is collapsed.
......@@ -6,6 +6,7 @@
#include <QCoreApplication>
#include <QMessageBox>
#include <QDebug>
#include "mainwindow.h"
GLPK::GLPK(Simulation* & simulacion)
{
......@@ -83,10 +84,14 @@ void GLPK::ejecutar(QProcess* process){
output = process->readAllStandardOutput();
if (output.contains("FOUND"))
if (output.contains("FOUND")) {
// ventana_expectativa();
Sleep(1000);
qInfo() << "GLPK MTAV_Empate Status: FOUND";
else
}
else {
qCritical() << "GLPK MTAV_Empate ERROR en la salida";
}
procesarSolucionEmpate(MTAV_empate_nombre);
}
......@@ -96,7 +101,6 @@ QString GLPK::generarEntradaGLPK_MTAV(){
QString strC = "";
QString strV = "";
QString strP = "";
QList<int> cRandom;
......
#include "householdseditorwidget.h"
#include "ui_householdseditorwidget.h"
// CONSTRUCTOR
HouseHoldsEditorWidget::HouseHoldsEditorWidget(QWidget *parent) :
QDialog(parent),
ui(new Ui::houseHoldsEditorWidget)
......@@ -9,11 +10,13 @@ HouseHoldsEditorWidget::HouseHoldsEditorWidget(QWidget *parent) :
ui->setupUi(this);
}
// DESTRUCTOR
HouseHoldsEditorWidget::~HouseHoldsEditorWidget()
{
delete ui;
}
// METHODS
void HouseHoldsEditorWidget::abrirDialog(Simulation * simulacion){
tablaModel = new QStandardItemModel(simulacion->getCantidad(), 1,this);
......
......@@ -12,7 +12,7 @@
#include <QCloseEvent>
// CONSTRUCTOR
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
......@@ -44,9 +44,9 @@ MainWindow::MainWindow(QWidget *parent) :
this->houseHoldsEditor = new HouseHoldsEditorWidget();
this->configEditor = new ConfigurationWidget();
// connect(this->houseHoldsEditor, SIGNAL(simulationChanged(Simulation*)), this, SLOT(on_simulacionNombreViviendas_changed(Simulation*)));
connect(this->dataEditor, SIGNAL(ruta_changed(QString)), this, SLOT(on_changeStatusBarText(QString)));
// Initial Simulation setup
if (settings.value("CARGAR_ULTIMO_SORTEO").toBool()
&& QFile::exists(settings.value("RUTA_ULTIMO_SORTEO").toString())){
this->dataEditor->nuevaSimulacion(settings.value("RUTA_ULTIMO_SORTEO").toString());
......@@ -56,18 +56,21 @@ MainWindow::MainWindow(QWidget *parent) :
this->dataEditor->nuevaSimulacion(NULL);
}
} else
this->dataEditor->nuevaSimulacion(QString::null);
this->dataEditor->nuevaSimulacion(NULL);
setCentralWidget(this->dataEditor);
QDir::setCurrent(QCoreApplication::applicationDirPath());
}
// DESTRUCTOR
MainWindow::~MainWindow()
{
delete ui;
}
// METHODS
// ToolBar buttons
void MainWindow::on_actionNuevo_triggered()
{
if (this->chequeoGuardar())
......
......@@ -14,6 +14,7 @@
#include <QDir>
// CONSTRUCTORS
Simulation::Simulation(int viviendas): settings(QCoreApplication::applicationDirPath() + "/config.ini", QSettings::IniFormat)
{
this->cantidad = viviendas;
......@@ -28,6 +29,8 @@ Simulation::Simulation() : settings(QCoreApplication::applicationDirPath() + "/c
}
// METHODS
void Simulation::setPreferencias(QHash<int, QStringList> preferencias)
{
this->preferencias.clear();
......@@ -137,14 +140,11 @@ void Simulation::guardar()
if (settings.value("CSV_DELIMITER").toInt() == 1) delimiter = ";";
QFile fileSimulacion(this->ruta);
fileSimulacion.open(QIODevice::ReadWrite);
QTextStream streamSimulacion(&fileSimulacion);
streamSimulacion << "SORTEO" << delimiter << this->nombre << "\n";
streamSimulacion << "CANTIDAD_VIVIENDAS" << delimiter << QString::number(this->cantidad) << "\n";
streamSimulacion << "-";
for (int i=0; i < this->viviendasMapeo.count(); i++){
......@@ -275,6 +275,25 @@ QString Simulation::generarReporte(QString ruta)
return fileName;
}
void Simulation::interpretarBloques(int* prefs, int maxima_pref, int fila) {
int acumulados[maxima_pref] = { 1 };
for (int k=1; k < maxima_pref; k++){
acumulados[k] = acumulados[k-1] + prefs[k-1];
}
QHash<int, QStringList> preferencias = this->getPreferencias();
for (int j=1; j < this->cantidad + 1; j++){
int pref = preferencias[fila].at(j).toInt();
if (pref > 1) {
preferencias[fila][j] = QString::number(acumulados[pref-1]);
}
}
this->setPreferencias(preferencias);
}
QString Simulation::validar()
{
QString error = QString("");
......@@ -290,8 +309,6 @@ QString Simulation::validar()
// - que cada fila tenga todas las preferencias elegidas y que no se repitan
QStringList familias;
for (int i=0; i < this->preferencias.count(); i++){
QString familiaNombre = this->preferencias[i].at(0);
......@@ -313,7 +330,8 @@ QString Simulation::validar()
familias.append(familiaNombre);
bool viviendaSeleccionada[this->cantidad] = { 0 };
int preferenciasSeleccionadas[this->cantidad] = { 0 };
int maxima_pref = 0;
for (int j=1; j < this->cantidad + 1; j++){
QString viviendaPref = preferencias[i].at(j);
......@@ -324,30 +342,38 @@ QString Simulation::validar()
}
bool esNumero = false;
viviendaPref.toInt(&esNumero);
int preferencia = viviendaPref.toInt(&esNumero);
if (!esNumero){
if ((!esNumero) || (preferencia < 1)){
error = "La familia " + preferencias[i].at(0) + " tiene entre sus preferencias la preferencia: " + viviendaPref + ", la cual no es correcta. (Debe ser un número entre 1 y " + QString::number(this->cantidad) + ")";
return error;
}
if (!(preferenciasMapeoNumero.contains(viviendaPref))){
if (!(preferenciasMapeoNumero.contains(viviendaPref))){
error = "La familia " + preferencias[i].at(0) + " tiene entre sus preferencias la preferencia: " + viviendaPref + ", la cual no es correcta";
return error;
}
if (viviendaPref.toInt() > this->cantidad) {
if (preferencia > this->cantidad) {
error = "La familia " + preferencias[i].at(0) + " tiene entre sus preferencias la preferencia: " + viviendaPref + ", siendo que la preferencia mayor es: " + QString::number(this->cantidad);
return error;
}
if (viviendaSeleccionada[preferenciasMapeoNumero[viviendaPref]]){
error = "La familia " + preferencias[i].at(0) + ", tiene mas de una vez asignada la preferencia: " + viviendaPref;
return error;
if (preferencia > maxima_pref){
maxima_pref = preferencia;
}
viviendaSeleccionada[preferenciasMapeoNumero[viviendaPref]] = true;
preferenciasSeleccionadas[preferencia-1]++;
}
for (int k=0; k < maxima_pref -1; k++){
if (preferenciasSeleccionadas[k] == 0) {
error = QString("La familia " + familiaNombre + " ha omitido la preferencia %1").arg(k+1);
return error;
}
}
interpretarBloques(preferenciasSeleccionadas, maxima_pref, i);
}
}
return error;
......
......@@ -9,7 +9,7 @@ class Simulation
{
private:
QString nombre;
QString ruta;
QString ruta; // Path to file
int cantidad;
QHash<int, QStringList> preferencias;
QHash<QString, int> preferenciasMapeoNumero;
......@@ -24,6 +24,8 @@ public:
Simulation();
Simulation(int viviendas);
// Unless setPreferencias, trivial getters & setters
void setNombre(QString nombre) { this->nombre = nombre; }
void setCantidad(int cantidad) { this->cantidad = cantidad; }
void setRuta(QString ruta) { this->ruta = ruta; }
......@@ -44,11 +46,13 @@ public:
QHash<int, QString> getViviendasMapeo() { return this->viviendasMapeo; }
QHash<int, QString> getAsignaciones() { return this->asignaciones; }
// Methods
static Simulation* cargar(QString ruta);
QString generarReporte(QString ruta);
QString validar();
void guardar();
void interpretarBloques(int* prefs, int maxima_pref, int fila);
};
#endif // SIMULATION_H
......@@ -9,6 +9,7 @@
#include <QStandardItem>
#include <QList>
// CONSTRUCTOR
SimulationResultWidget::SimulationResultWidget(QWidget *parent) :
QDialog(parent),
ui(new Ui::SimulationResultWidget)
......@@ -17,20 +18,23 @@ SimulationResultWidget::SimulationResultWidget(QWidget *parent) :
ui->setupUi(this);
}
// DELETER
SimulationResultWidget::~SimulationResultWidget()
{
delete ui;
}
// METHODS
void SimulationResultWidget::abrirDialog(Simulation *simulacion)
{
this->simulacion = simulacion;
this->ui->txtNombre->setText(this->simulacion->getNombre());
tablaModel = new QStandardItemModel(this->simulacion->getCantidad(), 2,this);
tablaModel = new QStandardItemModel(this->simulacion->getCantidad(), 3,this);
tablaModel->setHorizontalHeaderItem(0, new QStandardItem(QString("Familia")));
tablaModel->setHorizontalHeaderItem(1, new QStandardItem(QString("Asignacion")));
tablaModel->setHorizontalHeaderItem(2, new QStandardItem(QString("Preferencia")));
QHash<int, QString> asignaciones = this->simulacion->getAsignaciones();
QHash<int, QStringList> preferencias = this->simulacion->getPreferencias();
......@@ -39,31 +43,29 @@ void SimulationResultWidget::abrirDialog(Simulation *simulacion)
for (int i = 0; i < asignaciones.count(); i++){
tablaModel->setItem(i,0, new QStandardItem(preferencias[i].at(0)));
QString vivienda = this->simulacion->getViviendasMapeo()[asignaciones[i].toInt()];
QString vivienda = this->simulacion->getViviendasMapeo()[asignaciones[i].toInt()];
tablaModel->setItem(i,1, new QStandardItem(vivienda));
QString preferencia = preferencias[i].at(asignaciones[i].toInt() + 1);
tablaModel->setItem(i,2, new QStandardItem(preferencia));
}
QList<QStandardItem*> lista;
lista.append(new QStandardItem(QString("Res")));
/*************** TEST ************************
int suma = 0;
for (int i = 0; i < asignaciones.count(); i++){
int aux= QString(preferencias[i].at(asignaciones[i].toInt()+1)).toInt();
suma += aux;
}
lista.append(new QStandardItem(QString::number(suma)));
tablaModel->appendRow(lista);
**********************************************/
ui->tableView->setModel(tablaModel);
ui->tableView->setColumnWidth(0,210);
ui->tableView->setColumnWidth(1,100);
this->exec();
this->open();
showResults();
}
// ACTIONS
void SimulationResultWidget::on_btnExportarAPdf_clicked()
{
......@@ -86,3 +88,25 @@ void SimulationResultWidget::on_btnCerrar_clicked()
{
this->close();
}
void SimulationResultWidget::showResults() {
QHash<int, QString> asignaciones = this->simulacion->getAsignaciones();
QHash<int, QStringList> preferencias = this->simulacion->getPreferencias();
tablaModel->setRowCount(asignaciones.count());
for (int i = 0; i < asignaciones.count(); i++){
tablaModel->setItem(i,0, new QStandardItem(preferencias[i].at(0)));
QString vivienda = this->simulacion->getViviendasMapeo()[asignaciones[i].toInt()];
tablaModel->setItem(i,1, new QStandardItem(vivienda));
QString preferencia = preferencias[i].at(asignaciones[i].toInt() + 1);
tablaModel->setItem(i,2, new QStandardItem(preferencia));
ui->tableView->setModel(tablaModel);
Sleep(2000);
}
}
......@@ -6,6 +6,7 @@
#include "simulation.h"
#include <QStandardItemModel>
#include <QStandardItem>
#include <windows.h>
namespace Ui {
......@@ -24,6 +25,7 @@ private:
private slots:
void on_btnExportarAPdf_clicked();
void on_btnCerrar_clicked();
void showResults();
public:
explicit SimulationResultWidget(QWidget *parent = 0);
......
/********************************************************************************
** Form generated from reading UI file 'waitingwidget.ui'
**
** Created by: Qt User Interface Compiler version 5.7.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_WAITINGWIDGET_H
#define UI_WAITINGWIDGET_H
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QProgressBar>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_WaitingWidget
{
public:
QLabel *label;
QLabel *label_2;
QProgressBar *progressBar;
QPushButton *btnCancelar;