Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only

Most Efficient Way to Connect Two Tuples (Syntax Needed)

  • 1.  Most Efficient Way to Connect Two Tuples (Syntax Needed)

    Posted 02/09/11 10:04 AM

    Originally posted by: char507


    Hi,

    I asked a question similar to this a while back but I thought I would make everything more clear here. A vast simplification is that our model is trying to assign assets to customers. Each customer starts with an asset, then the model looks at the assets available and determines if a different asset would be more efficient. The data is defined as follows:

    tuple Asset
    {
    key string id
    float cost
    int numberAvailable
    }

    tuple Customer
    {
    key string id
    string currentAssetId
    }

    There are a number of places in the model where we currently link tuple objects by Id and then use filtering the constraints to link the objects together. My guess is that this model would be more efficient if we defined tuples inside of tuples and eliminated the filtering by constraints using a definition like so:

    tuple Customer
    {
    key string id
    Asset currentAsset
    }

    {Customer} Customers = ...;

    My problem is that I do not know how to instantiate the Customer objects using a .NET CustomDataSource. Once I have loaded the list of assets through the data handler, I move to the customer data and write the following:

    handler.StartElement("Customers");
    handler.StartSet();
    foreach(Customer c in customerList)
    {
    handler.StartTuple();
    handler.AddStringItem(c.Name);
    handler.AddStringItem(c.CurrentAsset.Id);
    }
    handler.EndSet();
    handler.EndElement();

    My question is: What goes in place of "handler.AddStringItem(c.CurrentAsset.Id)"? When I define a tuple inside of a tuple, how do I instantiate the data with a link to the sub-tuple object?

    I would be happy to answer any clarifying questions and I would really appreciate some help!
    #DecisionOptimization
    #OPLusingCPLEXOptimizer