FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Output formatting for a transportation model

  • small LP problem
  • generate a nice printed output
  • using dynamic arrays for representing sparse data structures
  • reading several data arrays from a single data file
Further explanation of this example: 'Mosel User Guide', Section 3.2 A transport example and Section 10.1 Producing formatted output.

The section 'Traditional embedding: solving multiple scenarios' of the Xpress Whitepaper 'Embedding Optimization Algorithms' describes how to embed a similar transportation model into an application.

Source Files

Data Files


<vdl version="4.7">
    <!-- Implementation of a table row filter  -->
        function filterRow(rowData, idx, current, Select) {
            // Plant === CURRENTPLANT && SELCUST for selecting the customers
            return (rowData[0] === current.value) && Select(rowData[1]).value;
        <!-- 'vdl' and 'vdl-page' tags must always be present -->

        <!-- Structural element 'section': print header text for a section -->
        <vdl-section heading="Customer selection">
                <vdl-column size="12">
                        <vdl-column><span vdl-text="Example of interaction between VDL elements: selecting customers and plant locations for display of input and result data in a filtered table."></span></vdl-column>
                        <!-- Display the input values as a table for indices 
                             selected upfront. -->
                        <!-- Several columns within a 'row' for display 
                             side-by-side, dividing up the total row width 
                             of 12 via 'size' setting on each column. -->
                        <vdl-column size="4" heading="Customer selection">
                                <vdl-table-column entity="SELCUST" editable="true"></vdl-table-column>
                        <vdl-column size="8" heading="Data and results for selected customers">
                                <vdl-field label="Plants" entity="CURRENTPLANT" options-set="PLANT"></vdl-field>
                            <vdl-table row-filter="=function(rowData, idx) {return filterRow(rowData, idx, scenario.entities.CURRENTPLANT, scenario.entities.SELCUST)}">
                                <vdl-table-column entity="TRANSCAP"></vdl-table-column>
                                <vdl-table-column entity="DISTANCE"></vdl-table-column>
                                <vdl-table-column entity="flow"></vdl-table-column>

Back to examples browserPrevious exampleNext example