SECQUOIA / gdplib

An open library of Generalized Disjunctive Programming (GDP) models
BSD 3-Clause "New" or "Revised" License
9 stars 7 forks source link

Update problem size table #45

Open ZedongPeng opened 3 months ago

ZedongPeng commented 3 months ago

Fixes #46

This pull request updates the problem size table for each model in the README.md. The stranded_gas, modprodnet and mod_hens problems have multiple formulations, and assistance is needed with them.

ZedongPeng commented 3 months ago

We should also come up with a way to use the different formulations of models, like stranded_gas, modprodnet and mod_hens.

AlbertLee125 commented 3 months ago

In this case, for the Mod HENS, it consist of the common code and there variations. I think it would be good to split the common codes into other variations and make them separately.

bernalde commented 3 months ago

I agree with Albert, split into three models, maybe using common functions, and report them separately

ZedongPeng commented 3 months ago

In the old readme file, there are 7 models instead of 3. image

Personally, I don't suggest splitting them into different models or folders since they are different formulations of the same problem. We should do something clever, like using an arg to determine which formulation to use.

ZedongPeng commented 3 months ago

This PR is ready for review, except for the stranded_gas problem. @bernalde

For the stranded_gas problem, the setup for cases like Gas_100, Gas_250, Gas_500, Gas_small, and Gas_large remains unclear, even after reading the code.

Could you please update the README.md file with a detailed example of how to properly use these cases? @AlbertLee125

AlbertLee125 commented 2 months ago

For the stranded_gas problem, the way how the problem is formulated is explained on below code.

if __name__ == "__main__":
    m = build_model()
    # m.module_types.pprint()
    # m.well_clusters.pprint()

    # Restrict number of module types; A, R, S, U
    # valid_modules = ['A500', 'A1000', 'A2000', 'A5000']
    # valid_modules = ['A500', 'R500', 'A5000', 'R5000']
    # valid_modules = ['U500', 'U5000']
    # valid_modules = ['U100', 'U250']
    # valid_modules = ['U1000']
    # valid_modules = ['U500']

    # valid_modules = ['U250']
    valid_modules = ['U100']
    for mtype in m.module_types - valid_modules:
        m.gas_consumption[:, mtype, :].fix(0)
        m.num_modules[mtype, :, :].fix(0)
        m.modules_transferred[mtype, :, :, :].fix(0)
        m.modules_purchased[mtype, :, :].fix(0)
        m.mtype_exists[mtype].deactivate()
        m.mtype_absent[mtype].binary_indicator_var.fix(1)

Given the code. The way that only specific units are activated is that the other units that are not valid are deactivated passing through the for loop.

I obtained the data before running the optimization by searching component_data_objeccts but the numbers of variables I got seems incorrect.

Number of variables: 57618
Number of Boolean variables: 0
Number of binary variables: 0
Number of integer variables: 45360
Number of continuous variables: 12258
Number of constraints: 14791
Number of nonlinear constraints: 0
Number of disjuncts: 175
Number of disjunctions: 96
Number of binary variables after transformation: 175
Problem vars Bool bin int cont cons nl disj disjtn
Gas_100 8816 158 0 2520 6138 14925 1 158 96

I got this table from README.md

ZedongPeng commented 2 months ago

I noticed a significant difference between your results and the ones presented in the README.md. Could you help clarify why there’s such a large discrepancy? @AlbertLee125

Is it possible to integrate the fix() and deactivate() code in the build_model() function? (currently in the main function) Otherwise, it might be too complicated for users to create this model. Any ideas? @bernalde @AlbertLee125