1

I am connecting an MS Access database to an OPL model using the .NET solution presented here:

https://github.com/IBMDecisionOptimization/OPL-.net-custom-data-source

This works fine and I am getting all the Data out of my Database via SQL. However I am struggling to initialize the tuples. My SQL statements look as following:

PName SELECT tblProdukte.PName FROM tblProdukte;
tName SELECT tblMaP.tName FROM tblMaP;
Demands SELECT tblProdukte.PName, tblMaP.tName, tblDemand.demDemand
FROM tblProdukte INNER JOIN (tblMaP INNER JOIN tblDemand ON tblMaP.tID = 
tblDemand.demTID) ON tblProdukte.pID = tblDemand.demPID
WHERE (((tblMaP.tName)>0)); 

In the .mod file I am calling the data as following:

{string} PName =...;
{int} tName =...;
tuple DemandType{
string PName;
int tName; 
int demDemand;
};
{DemandType} Demands=...;

This solution works. But what I actually want to implement is something like

float Demands [PName][tName] =...;

I have tried several different approaches including the oil Example and the Transportation Problem provided by IBM. How can I achieve the indexing in this exact way?

Thanks in Advance!

Xilef91
  • 13
  • 2

1 Answers1

0

Since you already have something working that gets the desired data, one option is to just transform this data. For example, you could write:

float DemandsAsTable[p in PName][t in tName] = sum(d in Demands : d.PName == p && d.tName == t) d.demDemand;

(note that each sum will sum exactly one term).

Daniel Junglas
  • 5,830
  • 1
  • 5
  • 22