genmodel 0.0.42 → 0.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2c2eb418e6347ae5ad8a9447cff3debce26aee40
4
- data.tar.gz: c8e15d5e32d6477c58597deb154eebbb13181e58
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzU3MmMwZWQ1ZTU5OGU4Y2U0NGZjODQ4OGM3ZTMwNTFhNzA4OTU3Nw==
5
+ data.tar.gz: !binary |-
6
+ MzBmMmZhYzgyNGI5OTE3MTQ0YWMxYTcyYzUyNTM4OTQ5YWUxMTJmNQ==
5
7
  SHA512:
6
- metadata.gz: 6f7a89e77f0c1a9897b84e1b1d0403733222b318fec05b670102c929f599e6095b259757644b808b521d7cd658b4595fe2f98a4782c598174e42dfe123225ec5
7
- data.tar.gz: 0ce51d8f03618e9e241ee9966f7c6fe4f0c41bc11c86ee53e44746f9e9b3e1e3db31e3d4ab2f661d38172012b70578cadc6eb49db1043cbab68f854c3f6b6a41
8
+ metadata.gz: !binary |-
9
+ NWI3ZDk0M2RlZmRlZmNlYTg0OThkYWM4NDY1ZDMyOGZjYWY2Y2UzNWQ2ZmNl
10
+ ZjgwOGRhNzQ3YjgwYzlkOWVkNjkzM2IxNWI0MDcxYmQ5M2RkMzBiYWY4NTE3
11
+ NTZiM2ZmOGY1MzFiOGYyN2I0MjQ5NDZkOWQ5OGNjYjRmNTBiZjc=
12
+ data.tar.gz: !binary |-
13
+ ZDU0NjdjNTRiNDQxM2RiMWEyNjBkMGE5Mzg3YzEwZWQ3MDFlYmYxZTU3YmI3
14
+ MmNiOGFkYmJiMzVjZmVjZGUyMzkzMGRhMTI1YmYwMmNkN2E0M2RjMjAzMjE2
15
+ ZWEwZmYyY2YzYWM1ZmY1NWJlMjllNWU0ZDc5ODFlN2I3OThjNGY=
@@ -134,6 +134,8 @@ public:
134
134
  virtual long MakeConstraintFeasible(long row);
135
135
  virtual long MakeAllConstraintFeasible(long max_iter = -1);
136
136
  virtual long PrintRowInfo(long row);
137
+ virtual string GetStatusString();
138
+ //virtual string Serialize();
137
139
  bool binit;
138
140
  bool bcreated;
139
141
  string name;
@@ -15,6 +15,7 @@ GenModel::GenModel()
15
15
  {
16
16
  version = "genmodel-0.0.39 build 0001";
17
17
  hassolution = false;
18
+ solstat = numeric_limits<int>::infinity();
18
19
  bcreated = false;
19
20
  binit = false;
20
21
  nc=0;
@@ -31,14 +32,14 @@ bool GenModel::IsAvailable()
31
32
  double GenModel::FindConstraintMaxLhs(long row)
32
33
  {
33
34
  double total = 0.0;
34
- for(int i = 0; i < int(consts[row].cols.size()); i++)
35
+ for(size_t i = 0; i < consts[row].cols.size(); i++)
35
36
  total += (consts[row].coefs[i] >= 0 ? vars.ub[consts[row].cols[i]] : vars.lb[consts[row].cols[i]])*consts[row].coefs[i];
36
37
  return total;
37
38
  }
38
39
 
39
40
  long GenModel::UpdateVariableBoundsMax(long row)
40
41
  {
41
- for(int i = 0; i < int(consts[row].cols.size()); i++)
42
+ for(size_t i = 0; i < consts[row].cols.size(); i++)
42
43
  {
43
44
  if(fabs(vars.lb[consts[row].cols[i]] - vars.ub[consts[row].cols[i]]) > 1e-7)
44
45
  hasinfeasibilities = true;
@@ -53,14 +54,14 @@ long GenModel::UpdateVariableBoundsMax(long row)
53
54
  double GenModel::FindConstraintMinLhs(long row)
54
55
  {
55
56
  double total = 0.0;
56
- for(int i = 0; i < int(consts[row].cols.size()); i++)
57
+ for(size_t i = 0; i < consts[row].cols.size(); i++)
57
58
  total += (consts[row].coefs[i] >= 0 ? vars.lb[consts[row].cols[i]] : vars.ub[consts[row].cols[i]])*consts[row].coefs[i];
58
59
  return total;
59
60
  }
60
61
 
61
62
  long GenModel::UpdateVariableBoundsMin(long row)
62
63
  {
63
- for(int i = 0; i < int(consts[row].cols.size()); i++)
64
+ for(size_t i = 0; i < consts[row].cols.size(); i++)
64
65
  {
65
66
  if(fabs(vars.lb[consts[row].cols[i]] - vars.ub[consts[row].cols[i]]) > 1e-7)
66
67
  hasinfeasibilities = true;
@@ -342,7 +343,7 @@ long GenModel::SetQpCoef(long i, long j, double val)
342
343
  long GenModel::AddModelCol(vector<int>& ind, vector<double>& val, double obj, double lb, double ub, string name, char type)
343
344
  {
344
345
  AddVar(name, obj, lb, ub, type);
345
- for(long i = 0; i < long(ind.size()); i++)
346
+ for(size_t i = 0; i < ind.size(); i++)
346
347
  AddNz(ind[i], vars.n-1, val[i]);
347
348
 
348
349
  return 0;
@@ -351,7 +352,7 @@ long GenModel::AddModelCol(vector<int>& ind, vector<double>& val, double obj, do
351
352
  long GenModel::AddModelRow(vector<int>& ind, vector<double>& val, double rhs, char sense, string name)
352
353
  {
353
354
  AddConst(name, rhs, sense);
354
- for(long i = 0; i < long(ind.size()); i++)
355
+ for(size_t i = 0; i < ind.size(); i++)
355
356
  AddNzToLast(ind[i], val[i]);
356
357
 
357
358
  return 0;
@@ -391,6 +392,25 @@ double GenModel::GetMIPRelativeGap()
391
392
  return 0.0;
392
393
  }
393
394
 
395
+ string GenModel::GetStatusString()
396
+ {
397
+ char cstr[256];
398
+ snprintf(cstr, 256, "Status value %d", solstat);
399
+ return string(cstr);
400
+ }
401
+
402
+ /*string Serialize()
403
+ {
404
+ string name;
405
+ vector<ModConsts> consts;
406
+ ModVars vars;
407
+ void* solverdata;
408
+ map<string, long> longParam;
409
+ map<string, double> dblParam;
410
+ map<string, bool> boolParam;
411
+ map<string, string> strParam;
412
+ }*/
413
+
394
414
  long ModVars::AddVar(string nn, double o, double l, double u, char t)
395
415
  {
396
416
  //offset[nn] = n;