Efficiency Analysis

Model

import sasoptpy as so
import pandas as pd
from sasoptpy.util import iterate, concat
from sasoptpy.actions import (
    read_data, create_data, cofor_loop, for_loop, solve, if_condition, diff,
    print_item, inline_condition)


def test(cas_conn, get_tables=False):

    input_list = pd.DataFrame(
        ['staff', 'showroom', 'pop1', 'pop2', 'alpha_enq', 'beta_enq'],
        columns=['input'])
    input_data = cas_conn.upload_frame(
        data=input_list, casout={'name': 'input_data', 'replace': True})

    output_list = pd.DataFrame(
        ['alpha_sales', 'beta_sales', 'profit'], columns=['output'])
    output_data = cas_conn.upload_frame(
        data=output_list, casout={'name': 'output_data', 'replace': True})

    problem_data = pd.DataFrame([
        ['Winchester', 7, 8, 10, 12, 8.5, 4, 2, 0.6, 1.5],
        ['Andover', 6, 6, 20, 30, 9, 4.5, 2.3, 0.7, 1.6],
        ['Basingstoke', 2, 3, 40, 40, 2, 1.5, 0.8, 0.25, 0.5],
        ['Poole', 14, 9, 20, 25, 10, 6, 2.6, 0.86, 1.9],
        ['Woking', 10, 9, 10, 10, 11, 5, 2.4, 1, 2],
        ['Newbury', 24, 15, 15, 13, 25, 19, 8, 2.6, 4.5],
        ['Portsmouth', 6, 7, 50, 40, 8.5, 3, 2.5, 0.9, 1.6],
        ['Alresford', 8, 7.5, 5, 8, 9, 4, 2.1, 0.85, 2],
        ['Salisbury', 5, 5, 10, 10, 5, 2.5, 2, 0.65, 0.9],
        ['Guildford', 8, 10, 30, 35, 9.5, 4.5, 2.05, 0.75, 1.7],
        ['Alton', 7, 8, 7, 8, 3, 2, 1.9, 0.7, 0.5],
        ['Weybridge', 5, 6.5, 9, 12, 8, 4.5, 1.8, 0.63, 1.4],
        ['Dorchester', 6, 7.5, 10, 10, 7.5, 4, 1.5, 0.45, 1.45],
        ['Bridport', 11, 8, 8, 10, 10, 6, 2.2, 0.65, 2.2],
        ['Weymouth', 4, 5, 10, 10, 7.5, 3.5, 1.8, 0.62, 1.6],
        ['Portland', 3, 3.5, 3, 2, 2, 1.5, 0.9, 0.35, 0.5],
        ['Chichester', 5, 5.5, 8, 10, 7, 3.5, 1.2, 0.45, 1.3],
        ['Petersfield', 21, 12, 6, 8, 15, 8, 6, 0.25, 2.9],
        ['Petworth', 6, 5.5, 2, 2, 8, 5, 1.5, 0.55, 1.55],
        ['Midhurst', 3, 3.6, 3, 3, 2.5, 1.5, 0.8, 0.2, 0.45],
        ['Reading', 30, 29, 120, 80, 35, 20, 7, 2.5, 8],
        ['Southampton', 25, 16, 110, 80, 27, 12, 6.5, 3.5, 5.4],
        ['Bournemouth', 19, 10, 90, 12, 25, 13, 5.5, 3.1, 4.5],
        ['Henley', 7, 6, 5, 7, 8.5, 4.5, 1.2, 0.48, 2],
        ['Maidenhead', 12, 8, 7, 10, 12, 7, 4.5, 2, 2.3],
        ['Fareham', 4, 6, 1, 1, 7.5, 3.5, 1.1, 0.48, 1.7],
        ['Romsey', 2, 2.5, 1, 1, 2.5, 1, 0.4, 0.1, 0.55],
        ['Ringwood', 2, 3.5, 2, 2, 1.9, 1.2, 0.3, 0.09, 0.4],
    ], columns=['garage_name', 'staff', 'showroom', 'pop1', 'pop2', 'alpha_enq',
                'beta_enq', 'alpha_sales', 'beta_sales', 'profit'])
    garage_data = cas_conn.upload_frame(
        data=problem_data, casout={'name': 'garage_data', 'replace': True})

    with so.Workspace(name='efficiency_analysis', session=cas_conn) as w:
        inputs = so.Set(name='INPUTS', settype=so.string)
        read_data(table=input_data, index={'target': inputs, 'key': 'input'})

        outputs = so.Set(name='OUTPUTS', settype=so.string)
        read_data(table=output_data, index={'target': outputs, 'key': 'output'})

        garages = so.Set(name='GARAGES', settype=so.number)
        garage_name = so.ParameterGroup(garages, name='garage_name', ptype=so.string)
        input = so.ParameterGroup(inputs, garages, name='input')
        output = so.ParameterGroup(outputs, garages, name='output')
        r = read_data(table=garage_data, index={'target': garages, 'key': so.N},
                      columns=[garage_name])
        with iterate(inputs, 'i') as i:
            r.append({'index': i, 'target': input[i, so.N], 'column': i})
        with iterate(outputs, 'i') as i:
            r.append({'index': i, 'target': output[i, so.N], 'column': i})

        k = so.Parameter(name='k', ptype=so.number)
        efficiency_number = so.ParameterGroup(garages, name='efficiency_number')
        weight_sol = so.ParameterGroup(garages, garages, name='weight_sol')

        weight = so.VariableGroup(garages, name='Weight', lb=0)
        inefficiency = so.Variable(name='Inefficiency', lb=0)

        obj = so.Objective(inefficiency, name='Objective', sense=so.maximize)

        input_con = so.ConstraintGroup(
            (so.expr_sum(input[i, j] * weight[j] for j in garages) <= input[i, k]
             for i in inputs), name='input_con')
        output_con = so.ConstraintGroup(
            (so.expr_sum(output[i, j] * weight[j] for j in garages) >= output[i, k] * inefficiency
             for i in outputs), name='output_con')

        for kk in cofor_loop(garages):
            k.set_value(kk)
            solve()
            efficiency_number[k] = 1 / inefficiency.sol
            for j in for_loop(garages):
                def if_block():
                    weight_sol[k, j] = weight[j].sol
                def else_block():
                    weight_sol[k, j] = None
                if_condition(weight[j].sol > 1e-6, if_block, else_block)

        efficient_garages = so.Set(
            name='EFFICIENT_GARAGES',
            value=[j.sym for j in garages if j.sym.under_condition(efficiency_number[j] >= 1)])
        inefficient_garages = so.Set(value=diff(garages, efficient_garages), name='INEFFICIENT_GARAGES')

        p1 = print_item(garage_name, efficiency_number)
        ed = create_data(table='efficiency_data', index={'key': ['garage']}, columns=[
            garage_name, efficiency_number
        ])
        with iterate(inefficient_garages, 'inefficient_garage') as i:
            wd = create_data(table='weight_data_dense',
                             index={'key': [i], 'set': [i.get_set()]},
                             columns=[garage_name, efficiency_number])
            with iterate(efficient_garages, 'efficient_garage') as j:
                wd.append({
                    'name': concat('w', j),
                    'expression': weight_sol[i, j],
                    'index': j
                })

        filtered_set = so.InlineSet(
            lambda: ((g1, g2)
                     for g1 in inefficient_garages
                     for g2 in efficient_garages
                     if inline_condition(weight_sol[g1, g2] != None)))
        wds = create_data(table='weight_data_sparse',
                          index={'key': ['i', 'j'], 'set': [filtered_set]},
                          columns=[weight_sol])

    print(w.to_optmodel())
    w.submit()

    print('Print Table:')
    print(p1.get_response())

    print('Efficiency Data:')
    print(ed.get_response())

    print('Weight Data (Dense):')
    print(wd.get_response())

    print('Weight Data (Sparse):')
    print(wds.get_response())

    if get_tables:
        return obj.get_value(), ed.get_response()
    else:
        return obj.get_value()

Output

In [1]: import os

In [2]: hostname = os.getenv('CASHOST')

In [3]: port = os.getenv('CASPORT')

In [4]: from swat import CAS

In [5]: cas_conn = CAS(hostname, port)

In [6]: import sasoptpy
In [7]: from examples.server_side.efficiency_analysis import test

In [8]: test(cas_conn)
NOTE: Cloud Analytic Services made the uploaded file available as table INPUT_DATA in caslib CASUSER(casuser).
NOTE: The table INPUT_DATA has been created in caslib CASUSER(casuser) from binary data uploaded to Cloud Analytic Services.
NOTE: Cloud Analytic Services made the uploaded file available as table OUTPUT_DATA in caslib CASUSER(casuser).
NOTE: The table OUTPUT_DATA has been created in caslib CASUSER(casuser) from binary data uploaded to Cloud Analytic Services.
NOTE: Cloud Analytic Services made the uploaded file available as table GARAGE_DATA in caslib CASUSER(casuser).
NOTE: The table GARAGE_DATA has been created in caslib CASUSER(casuser) from binary data uploaded to Cloud Analytic Services.
proc optmodel;
   set <str> INPUTS;
   read data INPUT_DATA into INPUTS=[input] ;
   set <str> OUTPUTS;
   read data OUTPUT_DATA into OUTPUTS=[output] ;
   set GARAGES;
   str garage_name {GARAGES};
   num input {INPUTS, GARAGES};
   num output {OUTPUTS, GARAGES};
   read data GARAGE_DATA into GARAGES=[_N_] garage_name {i in INPUTS} < input[i, _N_]=col(i) > {i in OUTPUTS} < output[i, _N_]=col(i) >;
   num k;
   num efficiency_number {GARAGES};
   num weight_sol {GARAGES, GARAGES};
   var Weight {{GARAGES}} >= 0;
   var Inefficiency >= 0;
   max Objective = Inefficiency;
   con input_con {o21 in INPUTS} : input[o21, k] - (sum {j in GARAGES} (input[o21, j] * Weight[j])) >= 0;
   con output_con {o33 in OUTPUTS} : sum {j in GARAGES} (output[o33, j] * Weight[j]) - output[o33, k] * Inefficiency >= 0;
   cofor {o46 in GARAGES} do;
      k = o46;
      solve;
      efficiency_number[k] = (1) / (Inefficiency.sol);
      for {o58 in GARAGES} do;
         if Weight[o58].sol > 1e-06 then do;
            weight_sol[k, o58] = Weight[o58].sol;
         end;
         else do;
            weight_sol[k, o58] = .;
         end;
      end;
   end;
   set EFFICIENT_GARAGES = {{o69 in GARAGES: efficiency_number[o69] >= 1}};
   set INEFFICIENT_GARAGES = GARAGES diff EFFICIENT_GARAGES;
   print garage_name efficiency_number;
   create data efficiency_data from [garage] garage_name efficiency_number;
   create data weight_data_dense from [inefficient_garage] = {{INEFFICIENT_GARAGES}} garage_name efficiency_number {efficient_garage in EFFICIENT_GARAGES} < col('w' || efficient_garage)=(weight_sol[inefficient_garage, efficient_garage]) >;
   create data weight_data_sparse from [i j] = {{{o83 in INEFFICIENT_GARAGES, o85 in EFFICIENT_GARAGES: weight_sol[o83, o85] ne .}}} weight_sol;
quit;
NOTE: Added action set 'optimization'.
NOTE: There were 6 rows read from table 'INPUT_DATA' in caslib 'CASUSER(casuser)'.
NOTE: There were 3 rows read from table 'OUTPUT_DATA' in caslib 'CASUSER(casuser)'.
NOTE: There were 28 rows read from table 'GARAGE_DATA' in caslib 'CASUSER(casuser)'.
NOTE: The COFOR statement is executing in single-machine mode.
NOTE: Problem generation will use 8 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.01 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    2.788571E+01         0
          P 2          6    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.02 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    6.185408E+01         0
          P 2          6    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.02 seconds.
NOTE: Problem generation will use 6 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    6.669507E+01         0
          P 2         15    1.152977E+00         0
NOTE: Optimal.
NOTE: Objective = 1.1529771581.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 5 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    6.771196E+01         0
          P 2          5    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.00 seconds.
NOTE: Problem generation will use 8 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    9.367804E+01         0
          P 2         18    1.191606E+00         0
NOTE: Optimal.
NOTE: Objective = 1.1916056975.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    6.282477E+01         0
          P 2          7    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.02 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    2.113425E+02         0
          P 2          7    1.141723E+00         0
NOTE: Optimal.
NOTE: Objective = 1.141723356.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    8.984164E+01         0
          P 2         20    1.190229E+00         0
NOTE: Optimal.
NOTE: Objective = 1.1902294108.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    7.496160E+01         0
          P 2          7    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    6.137365E+01         0
          P 2          9    1.011903E+00         0
NOTE: Optimal.
NOTE: Objective = 1.0119030842.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    5.430205E+01         0
          P 2         18    1.018276E+00         0
NOTE: Optimal.
NOTE: Objective = 1.0182756046.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    9.121193E+01         0
          P 2         17    1.170487E+00         0
NOTE: Optimal.
NOTE: Objective = 1.170487106.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    7.130206E+01         0
          P 2         12    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    7.942787E+01         0
          P 2         15    1.090062E+00         0
NOTE: Optimal.
NOTE: Objective = 1.0900621118.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    3.333800E+01         0
          P 2          8    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    3.269636E+01         0
          P 2          5    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.00 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    1.483009E+02         0
          P 2         12    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    7.522880E+01         0
          P 2          9    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    8.552410E+01         0
          P 2         14    1.160239E+00         0
NOTE: Optimal.
NOTE: Objective = 1.1602389558.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    6.743350E+01         0
          P 2         20    1.029858E+00         0
NOTE: Optimal.
NOTE: Objective = 1.0298577511.
NOTE: The Dual Simplex solve time is 0.00 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    1.119904E+02         0
          P 2          6    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    3.162476E+01         0
          P 2          5    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    1.462372E+02         0
          P 2          9    1.205868E+00         0
NOTE: Optimal.
NOTE: Objective = 1.2058683067.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    9.913941E+01         0
          P 2         16    1.228251E+00         0
NOTE: Optimal.
NOTE: Objective = 1.2282514234.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    1.428026E+02         0
          P 2          5    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    9.575369E+01         0
          P 2         16    1.213087E+00         0
NOTE: Optimal.
NOTE: Objective = 1.2130872456.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    3.928295E+01         0
          P 2          7    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: Problem generation will use 7 threads.
NOTE: The problem has 29 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (0 LE, 0 EQ, 9 GE, 0 range).
NOTE: The problem has 255 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver time is 0.00 seconds.
NOTE: The LP presolver removed 0 variables and 0 constraints.
NOTE: The LP presolver removed 0 constraint coefficients.
NOTE: The presolved problem has 29 variables, 9 constraints, and 255 constraint coefficients.
NOTE: The LP solver is called.
NOTE: The Dual Simplex algorithm is used.
                              Objective
         Phase Iteration        Value         Time
          D 2          1    4.906079E+01         0
          P 2          5    1.000000E+00         0
NOTE: Optimal.
NOTE: Objective = 1.
NOTE: The Dual Simplex solve time is 0.01 seconds.
NOTE: The output table 'EFFICIENCY_DATA' in caslib 'CASUSER(casuser)' has 28 rows and 3 columns.
NOTE: The output table 'WEIGHT_DATA_DENSE' in caslib 'CASUSER(casuser)' has 17 rows and 14 columns.
NOTE: The output table 'WEIGHT_DATA_SPARSE' in caslib 'CASUSER(casuser)' has 43 rows and 3 columns.
NOTE: The output table 'SOLUTION' in caslib 'CASUSER(casuser)' has 29 rows and 6 columns.
NOTE: The output table 'DUAL' in caslib 'CASUSER(casuser)' has 9 rows and 4 columns.
Print Table:
    COL1  garage_name  efficiency_number
0    1.0  Bournemouth           1.000000
1    2.0       Henley           1.000000
2    3.0       Woking           0.867320
3    4.0        Alton           1.000000
4    5.0   Dorchester           0.839204
5    6.0    Alresford           1.000000
6    7.0     Ringwood           0.875869
7    8.0   Winchester           0.840174
8    9.0     Weymouth           1.000000
9   10.0     Petworth           0.988237
10  11.0      Reading           0.982052
11  12.0    Weybridge           0.854345
12  13.0   Portsmouth           1.000000
13  14.0      Andover           0.917379
14  15.0      Newbury           1.000000
15  16.0   Maidenhead           1.000000
16  17.0  Basingstoke           1.000000
17  18.0    Salisbury           1.000000
18  19.0        Poole           0.861891
19  20.0     Bridport           0.971008
20  21.0     Portland           1.000000
21  22.0  Petersfield           1.000000
22  23.0     Midhurst           0.829278
23  24.0    Guildford           0.814166
24  25.0       Romsey           1.000000
25  26.0   Chichester           0.824343
26  27.0  Southampton           1.000000
27  28.0      Fareham           1.000000
Efficiency Data:
Selected Rows from Table EFFICIENCY_DATA

    garage  garage_name  efficiency_number
0      1.0  Bournemouth           1.000000
1      2.0       Henley           1.000000
2      3.0       Woking           0.867320
3      4.0        Alton           1.000000
4      5.0   Dorchester           0.839204
5      6.0    Alresford           1.000000
6      7.0     Ringwood           0.875869
7      8.0   Winchester           0.840174
8      9.0     Weymouth           1.000000
9     10.0     Petworth           0.988237
10    11.0      Reading           0.982052
11    12.0    Weybridge           0.854345
12    13.0   Portsmouth           1.000000
13    14.0      Andover           0.917379
14    15.0      Newbury           1.000000
15    16.0   Maidenhead           1.000000
16    17.0  Basingstoke           1.000000
17    18.0    Salisbury           1.000000
18    19.0        Poole           0.861891
19    20.0     Bridport           0.971008
20    21.0     Portland           1.000000
21    22.0  Petersfield           1.000000
22    23.0     Midhurst           0.829278
23    24.0    Guildford           0.814166
24    25.0       Romsey           1.000000
25    26.0   Chichester           0.824343
26    27.0  Southampton           1.000000
27    28.0      Fareham           1.000000
Weight Data (Dense):
Selected Rows from Table WEIGHT_DATA_DENSE

    inefficient_garage  garage_name  efficiency_number  ...       w22  w25       w27
0                  1.0  Bournemouth           1.000000  ...       NaN  NaN       NaN
1                  3.0       Woking           0.867320  ...       NaN  NaN  0.009093
2                  5.0   Dorchester           0.839204  ...       NaN  NaN       NaN
3                  7.0     Ringwood           0.875869  ...       NaN  NaN       NaN
4                  8.0   Winchester           0.840174  ...       NaN  NaN       NaN
5                 10.0     Petworth           0.988237  ...  0.015212  NaN       NaN
6                 11.0      Reading           0.982052  ...       NaN  NaN       NaN
7                 12.0    Weybridge           0.854345  ...       NaN  NaN       NaN
8                 13.0   Portsmouth           1.000000  ...       NaN  NaN       NaN
9                 14.0      Andover           0.917379  ...       NaN  NaN       NaN
10                17.0  Basingstoke           1.000000  ...       NaN  NaN       NaN
11                19.0        Poole           0.861891  ...       NaN  NaN       NaN
12                20.0     Bridport           0.971008  ...       NaN  NaN       NaN
13                23.0     Midhurst           0.829278  ...  0.043482  NaN       NaN
14                24.0    Guildford           0.814166  ...       NaN  NaN       NaN
15                26.0   Chichester           0.824343  ...       NaN  NaN       NaN
16                28.0      Fareham           1.000000  ...       NaN  NaN       NaN

[17 rows x 14 columns]
Weight Data (Sparse):
Selected Rows from Table WEIGHT_DATA_SPARSE

       i     j  weight_sol
0    5.0   2.0    0.035318
1    7.0   2.0    0.146485
2   11.0   2.0    2.862469
3   19.0   2.0    0.434419
4   20.0   2.0    0.783097
5   26.0   2.0    0.236367
6    3.0   4.0    0.021078
7    3.0   6.0    0.952525
8    5.0   6.0    0.104478
9    8.0   6.0    0.416268
10  24.0   6.0    0.622715
11  26.0   6.0    0.096820
12   5.0   9.0    0.119287
13   8.0   9.0    0.333333
14  11.0   9.0    0.544410
15  12.0   9.0    0.796562
16  14.0   9.0    0.857143
17  23.0   9.0    0.066511
18  24.0   9.0    0.191804
19  26.0   9.0    0.335428
20  10.0  15.0    0.066345
21   3.0  16.0    0.148376
22  10.0  16.0    0.034089
23  11.0  16.0    0.137534
24  12.0  16.0    0.145236
25  14.0  16.0    0.214286
26  19.0  16.0    0.344634
27  20.0  16.0    0.194894
28  23.0  16.0    0.008940
29   8.0  18.0    0.403284
30  23.0  18.0    0.059574
31   5.0  21.0    0.751632
32   7.0  21.0    0.319728
33   8.0  21.0    0.096138
34  11.0  21.0    1.199139
35  19.0  21.0    0.757330
36  20.0  21.0    0.469693
37  23.0  21.0    0.471893
38  24.0  21.0    0.168067
39  26.0  21.0    0.165227
40  10.0  22.0    0.015212
41  23.0  22.0    0.043482
42   3.0  27.0    0.009093
Out[8]: 1.0000000000000002