Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong bound types when using MOSEK #211

Open
goghino opened this issue Mar 1, 2021 · 4 comments
Open

Wrong bound types when using MOSEK #211

goghino opened this issue Mar 1, 2021 · 4 comments

Comments

@goghino
Copy link

goghino commented Mar 1, 2021

I am trying to solve the UC using MOSEK solver, e.g.

md = ModelData.read(os.path.join(this_module_path, '..', '..', 'download',
                                 'pglib-uc-master', 'rts_gmlc', '2020-01-27.json'),
                                file_type = 'pglib-uc')

md_sol = solve_unit_commitment(md, 'mosek', mipgap=0.01, timelimit=300, solver_options={}, solver_tee=True, uc_model_generator=create_tight_unit_commitment_model)

and I get en error
mosek.Error: rescode.err_fixed_bound_values(1420): For a fixed constraint/variable the specified lower bound 0.000000000000000e+00 and upper bound 1.000000000000000e+00 are different.

The problem is reproducible for other test examples and UC formulations. Any suggestions/pointers how to address this issue? Thanks!

@goghino
Copy link
Author

goghino commented Mar 2, 2021

Update

I have changed Pyomo code generating the bound types for MOSEK. There is an indicator in the variables array (var_seq) .is_fixed() which I ignore for the moment. I have changed file /Users/Juraj/anaconda3/envs/UnitCommitmentNew/lib/python3.8/site-packages/pyomo/solvers/plugins/solvers/mosek_direct.py , line 299 in _add_vars from

299:        fxs = tuple(v.is_fixed() for v in var_seq)

to

299:        fxs = tuple(False for v in var_seq) #tuple(v.is_fixed() for v in var_seq)

The fixed variables in the RTS_GMLS model are:

matches = (x for x in var_seq if x.is_fixed())
m = [x for x in matches]
names = [n.local_name for n in m]
names
['UnitOn[121_NUCLEAR_1_T,1]', 'UnitOn[121_NUCLEAR_1_T,2]', 'UnitOn[121_NUCLEAR_1_T,3]', 'UnitOn[121_NUCLEAR_1_T,4]', 'UnitOn[121_NUCLEAR_1_T,5]', 'UnitOn[121_NUCLEAR_1_T,6]', 'UnitOn[121_NUCLEAR_1_T,7]', 'UnitOn[121_NUCLEAR_1_T,8]', 'UnitOn[121_NUCLEAR_1_T,9]', 'UnitOn[121_NUCLEAR_1_T,10]', 'UnitOn[121_NUCLEAR_1_T,11]', 'UnitOn[121_NUCLEAR_1_T,12]', 'UnitOn[121_NUCLEAR_1_T,13]', 'UnitOn[121_NUCLEAR_1_T,14]', ...]
special variables
function variables
00:'UnitOn[121_NUCLEAR_1_T,1]'
01:'UnitOn[121_NUCLEAR_1_T,2]'
02:'UnitOn[121_NUCLEAR_1_T,3]'
03:'UnitOn[121_NUCLEAR_1_T,4]'
04:'UnitOn[121_NUCLEAR_1_T,5]'
05:'UnitOn[121_NUCLEAR_1_T,6]'
06:'UnitOn[121_NUCLEAR_1_T,7]'
07:'UnitOn[121_NUCLEAR_1_T,8]'
08:'UnitOn[121_NUCLEAR_1_T,9]'
09:'UnitOn[121_NUCLEAR_1_T,10]'
10:'UnitOn[121_NUCLEAR_1_T,11]'
11:'UnitOn[121_NUCLEAR_1_T,12]'
12:'UnitOn[121_NUCLEAR_1_T,13]'
13:'UnitOn[121_NUCLEAR_1_T,14]'
14:'UnitOn[121_NUCLEAR_1_T,15]'
15:'UnitOn[121_NUCLEAR_1_T,16]'
16:'UnitOn[121_NUCLEAR_1_T,17]'
17:'UnitOn[121_NUCLEAR_1_T,18]'
18:'UnitOn[121_NUCLEAR_1_T,19]'
19:'UnitOn[121_NUCLEAR_1_T,20]'
20:'UnitOn[121_NUCLEAR_1_T,21]'
21:'UnitOn[121_NUCLEAR_1_T,22]'
22:'UnitOn[121_NUCLEAR_1_T,23]'
23:'UnitOn[121_NUCLEAR_1_T,24]'
24:'UnitOn[121_NUCLEAR_1_T,25]'
25:'UnitOn[121_NUCLEAR_1_T,26]'
26:'UnitOn[121_NUCLEAR_1_T,27]'
27:'UnitOn[121_NUCLEAR_1_T,28]'
28:'UnitOn[121_NUCLEAR_1_T,29]'
29:'UnitOn[121_NUCLEAR_1_T,30]'
30:'UnitOn[121_NUCLEAR_1_T,31]'
31:'UnitOn[121_NUCLEAR_1_T,32]'
32:'UnitOn[121_NUCLEAR_1_T,33]'
33:'UnitOn[121_NUCLEAR_1_T,34]'
34:'UnitOn[121_NUCLEAR_1_T,35]'
35:'UnitOn[121_NUCLEAR_1_T,36]'
36:'UnitOn[121_NUCLEAR_1_T,37]'
37:'UnitOn[121_NUCLEAR_1_T,38]'
38:'UnitOn[121_NUCLEAR_1_T,39]'
39:'UnitOn[121_NUCLEAR_1_T,40]'
40:'UnitOn[121_NUCLEAR_1_T,41]'
41:'UnitOn[121_NUCLEAR_1_T,42]'
42:'UnitOn[121_NUCLEAR_1_T,43]'
43:'UnitOn[121_NUCLEAR_1_T,44]'
44:'UnitOn[121_NUCLEAR_1_T,45]'
45:'UnitOn[121_NUCLEAR_1_T,46]'
46:'UnitOn[121_NUCLEAR_1_T,47]'
47:'UnitOn[121_NUCLEAR_1_T,48]'
len():48

Then, running MOSEK works fine

$ python pglib_uc_example_juraj.py
Creating and solving pglib-uc example ...
Calculating PTDF Matrix Factorization
Problem
  Name                   :
  Objective sense        : min
  Type                   : LO (linear optimization problem)
  Constraints            : 51903
  Cones                  : 0
  Scalar variables       : 53537
  Matrix variables       : 0
  Integer variables      : 21425

Optimizer started.
Mixed integer optimizer started.
Threads used: 8
Presolve started.
Presolve terminated. Time = 1.43
Presolved problem: 39320 variables, 38393 constraints, 184453 non-zeros
Presolved problem: 1647 general integer, 21081 binary, 16592 continuous
Clique table size: 26680
BRANCHES RELAXS   ACT_NDS  DEPTH    BEST_INT_OBJ         BEST_RELAX_OBJ       REL_GAP(%)  TIME
0        1        1        0        NA                   1.2266453400e+06     NA          14.3
0        1        1        0        1.2328787585e+06     1.2266453400e+06     0.51        20.1
Cut generation started.
0        1        1        0        1.2328787585e+06     1.2266453400e+06     0.51        22.3
Cut generation terminated. Time = 0.35
Presolve started.
Presolve terminated. Time = 1.53
Presolved problem: 30970 variables, 36470 constraints, 149759 non-zeros
Presolved problem: 1617 general integer, 12773 binary, 16580 continuous
Clique table size: 25028
BRANCHES RELAXS   ACT_NDS  DEPTH    BEST_INT_OBJ         BEST_RELAX_OBJ       REL_GAP(%)  TIME
0        4        1        0        1.2328787585e+06     1.2268057436e+06     0.49        24.7
0        7        1        0        1.2328787585e+06     1.2268057436e+06     0.49        33.4
0        18       1        0        1.2328787585e+06     1.2268057436e+06     0.49        34.1
12       31       1        0        1.2328787585e+06     1.2268057436e+06     0.49        35.2
26       45       1        0        1.2328787585e+06     1.2268057436e+06     0.49        35.5
50       69       1        0        1.2328787585e+06     1.2268057436e+06     0.49        36.0

@michaelbynum
Copy link
Collaborator

I believe this is now fixed in Pyomo (Pyomo/pyomo#1844).

@goghino
Copy link
Author

goghino commented Mar 2, 2021

I am using the latest Pyomo via Anaconda 3 and I still experience the issue
pyomo 5.7.3 py38h91a8764_0 conda-forge

@michaelbynum
Copy link
Collaborator

Sorry - it was fixed in the main branch. There has not been a release since Pyomo/pyomo#1844 was merged. It will probably be another month before there is another Pyomo release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants