Changeset 5767


Ignore:
Timestamp:
May 13, 2012 2:34:03 PM (7 years ago)
Author:
wehart
Message:

Changing a variable name to reflect the change of the corresponding data
in coopr.pyomo.

This is not a functional change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pysp/trunk/coopr/pysp/phobjective.py

    r5389 r5767  
    292292            for index in variable_indices:
    293293
    294                 instance_varvalue = instance_variable[index]
    295 
    296                 if (instance_varvalue.status is not VarStatus.unused) and (instance_varvalue.fixed is False):
     294                instance_vardata = instance_variable[index]
     295
     296                if (instance_vardata.status is not VarStatus.unused) and (instance_vardata.fixed is False):
    297297
    298298                    # add the linear (w-weighted) term in a consistent fashion, independent of variable type.
    299299                    # don't adjust the sign of the weight here - that has already been accounted for in the main PH routine.
    300                     linear_expression += w_parameter[index] * instance_varvalue
     300                    linear_expression += w_parameter[index] * instance_vardata
    301301
    302302                    # there are some cases in which a user may want to avoid the proximal term completely.
     
    310310                            if retain_quadratic_binary_terms is False:
    311311                                if objective.sense is minimize:
    312                                     linear_expression += (blend_parameter[index] * rho_parameter[index] / 2.0 * (instance_varvalue - 2.0 * xbar_parameter[index] * instance_varvalue + xbar_parameter[index] * xbar_parameter[index]))
     312                                    linear_expression += (blend_parameter[index] * rho_parameter[index] / 2.0 * (instance_vardata - 2.0 * xbar_parameter[index] * instance_vardata + xbar_parameter[index] * xbar_parameter[index]))
    313313                                else:
    314                                     linear_expression -= (blend_parameter[index] * rho_parameter[index] / 2.0 * (instance_varvalue - 2.0 * xbar_parameter[index] * instance_varvalue + xbar_parameter[index] * xbar_parameter[index]))
     314                                    linear_expression -= (blend_parameter[index] * rho_parameter[index] / 2.0 * (instance_vardata - 2.0 * xbar_parameter[index] * instance_vardata + xbar_parameter[index] * xbar_parameter[index]))
    315315                            else:
    316316                                if objective.sense is minimize:
    317                                     quad_expression += (blend_parameter[index] * (rho_parameter[index] / 2.0) * (instance_varvalue - xbar_parameter[index]) * (instance_varvalue - xbar_parameter[index]))
     317                                    quad_expression += (blend_parameter[index] * (rho_parameter[index] / 2.0) * (instance_vardata - xbar_parameter[index]) * (instance_vardata - xbar_parameter[index]))
    318318                                else:
    319                                     quad_expression -= (blend_parameter[index] * (rho_parameter[index] / 2.0) * (instance_varvalue - xbar_parameter[index]) * (instance_varvalue - xbar_parameter[index]))
     319                                    quad_expression -= (blend_parameter[index] * (rho_parameter[index] / 2.0) * (instance_vardata - xbar_parameter[index]) * (instance_vardata - xbar_parameter[index]))
    320320
    321321                        # deal with everything else
     
    334334                               # deal with the baseline quadratic case.
    335335                               if objective.sense is minimize:
    336                                    quad_expression += (blend_parameter[index] * (rho_parameter[index] / 2.0) * (instance_varvalue - xbar_parameter[index]) * (instance_varvalue - xbar_parameter[index]))
     336                                   quad_expression += (blend_parameter[index] * (rho_parameter[index] / 2.0) * (instance_vardata - xbar_parameter[index]) * (instance_vardata - xbar_parameter[index]))
    337337                               else:
    338                                    quad_expression -= (blend_parameter[index] * (rho_parameter[index] / 2.0) * (instance_varvalue - xbar_parameter[index]) * (instance_varvalue - xbar_parameter[index]))
     338                                   quad_expression -= (blend_parameter[index] * (rho_parameter[index] / 2.0) * (instance_vardata - xbar_parameter[index]) * (instance_vardata - xbar_parameter[index]))
    339339
    340340    # augment the original objective with the new linear terms.
     
    431431            for variable_index in variable_indices:
    432432
    433                  instance_varvalue = instance_variable[variable_index]
    434 
    435                  if (instance_varvalue.status is not VarStatus.unused) and (instance_varvalue.fixed is False):
     433                 instance_vardata = instance_variable[variable_index]
     434
     435                 if (instance_vardata.status is not VarStatus.unused) and (instance_vardata.fixed is False):
    436436
    437437                    # binaries have already been dealt with in the process of PH objective function formation.
     
    439439
    440440                        xbar = xbar_parameter[variable_index].value
    441                         x = instance_varvalue
     441                        x = instance_vardata
    442442
    443443                        if x.lb is None or x.ub is None:
Note: See TracChangeset for help on using the changeset viewer.