I am trying to set up an ATC architecture with OpenMDAO. I was advised before to use sub-assemblies with passthrough variables to send targets and penalty weights from the top problem to sub problems, and using connect to send variables to outside an assembly's scope. I have tried this and am receiving the error
RuntimeError: P11: The following parameters collide with connected inputs: R11.z11 in P11.driver
I can't find any references to this error online. Any ideas how to fix this? My code is below

class Optimization1(Assembly): """my optimization template"""

def configure(self):

    # Create Optimizer instance
    self.add('driver', SLSQPdriver())

    # Create component instances
    self.add('R01', DisciplineTemplate.R01())
    self.add('R02', DisciplineTemplate.R02())
    self.add('Multipliers', DisciplineTemplate.Multipliers())

    # Iteration Hierarchy
    self.driver.workflow.add(['R01', 'R02', 'Multipliers'])

    #x0[z4 z5 z7]
    self.driver.add_parameter('R01.z4', low=0., high=10.)
    self.driver.add_parameter(('R01.z5','R02.z5'), low = 0.0,   high=10.0)
    self.driver.add_parameter('R02.z7', low=0., high=10.)
    #T11=z3
    self.driver.add_parameter('R01.z3', low=0., high=10.)
    #T12=z6
    self.driver.add_parameter('R02.z6', low=0., high=10.)

    #Targets
    self.create_passthrough('R01.z3', 'pT11')
    self.create_passthrough('R02.z6', 'pT12')

    #Constraints
    self.driver.add_constraint('(R01.z3)**(-2) + (R01.z4)**(2) - (R01.z5)**(2) <= 0')
    self.driver.add_constraint('(R02.z5)**(2) + (R02.z6)**(-2) - (R02.z7)**(2) <= 0')

    # SLSQP Flags
    self.driver.iprint = 0

class Optimization2(Assembly): """my optimization template"""

v = Array(array([1.0,1.0,1.0]), dtype=float, desc = "Penalty", iotype='in')
w = Array(array([1.0,1.0,1.0]), dtype=float, desc = "Penalty", iotype='in')
pT11 = Float(1.0, desc='Target', iotype='in')
py12 = Float(1.0, desc='Coupling', iotype='in')

def configure(self):

    # Create Optimizer instance
    self.add('driver', SLSQPdriver())

    # Create component instances
    self.add('R11', DisciplineTemplate.R11())

    # Iteration Hierarchy
    self.driver.workflow.add(['R11'])

    #x11[z8,z9,z10]
    self.driver.add_parameter('R11.z8', low=0., high=10.)
    self.driver.add_parameter('R11.z9', low=0., high=10.)
    self.driver.add_parameter('R11.z10', low=0., high=10.)
    #y11=z11
    self.driver.add_parameter('R11.z11', low=0., high=10.)

    #Out Targets
    self.create_passthrough('R11.z3', 'pR11')
    self.create_passthrough('R11.z11', 'py11')

    #Constraints
    self.driver.add_constraint('(R11.z8)**(2) + (R11.z9)**(2) - (R11.z11)**(2) <= 0')
    self.driver.add_constraint('(R11.z8)**(-2) + (R11.z10)**(2) - (R11.z11)**(2) <= 0')

    # SLSQP Flags
    self.driver.iprint = 0

class Optimization3(Assembly): """my optimization template"""

v = Array(array([1.0,1.0,1.0]), dtype=float, desc = "Penalty", iotype='in')
w = Array(array([1.0,1.0,1.0]), dtype=float, desc = "Penalty", iotype='in')
pT12 = Float(1.0, desc='Target', iotype='in')
py11 = Float(1.0, desc='Coupling', iotype='in')

def configure(self):

    # Create Optimizer instance
    self.add('driver', SLSQPdriver())

    # Create component instances
    self.add('R12', DisciplineTemplate.R12())

    # Iteration Hierarchy
    self.driver.workflow.add(['R12'])

    #x12[z12,z13,z14]
    self.driver.add_parameter('R12.z12', low=0., high=10.)
    self.driver.add_parameter('R12.z13', low=0., high=10.)
    self.driver.add_parameter('R12.z14', low=0., high=10.)
    #y12=z11
    self.driver.add_parameter('R12.z11', low=0., high=10.)

    #Targets
    self.create_passthrough('R12.z6', 'pR12')
    self.create_passthrough('R12.z11', 'py12')

    #Constraints
    self.driver.add_constraint('(R12.z11)**(2) + (R12.z12)**(-2) - (R12.z13)**(2) <= 0')
    self.driver.add_constraint('(R12.z11)**(2) + (R12.z12)**(2) - (R12.z14)**(2) <= 0')

    # SLSQP Flags
    self.driver.iprint = 0

if name == "main":

#Hierarchy
P0 = set_as_top(Optimization1())

P0.add('P11', Optimization2())
P0.driver.workflow.add('P11')

P0.add('P12', Optimization3())
P0.driver.workflow.add('P12')

#connections
P0.connect('Multipliers.v','P11.v')
P0.connect('Multipliers.w','P11.w')
P0.connect('pT11','P11.pT11')
P0.connect('P12.py12','P11.py12')

P0.connect('Multipliers.v','P12.v')
P0.connect('Multipliers.w','P12.w')
P0.connect('pT12','P12.pT12')
P0.connect('P11.py11','P12.py11')

#Objectives
P0.driver.add_objective('(R01.z1-0.0)**2 + (R02.z2-0.0)**2 + Multipliers.v[0]*(R01.z3-P11.pR11) + Multipliers.v[1]*(R02.z6-P12.pR12) + Multipliers.w[0]*Multipliers.w[0]*(R01.z3-P11.pR11)**2 + Multipliers.w[1]*Multipliers.w[1]*(R02.z6-P12.pR12)**2')

P0.P11.driver.add_objective('v[0]*(pT11-R11.z3) + v[2]*(py12-R11.z11) + w[0]*w[0]*(pT11-R11.z3)**2 + w[2]*w[2]*(py12-R11.z11)**2')

P0.P12.driver.add_objective('v[1]*(pT12-R12.z6) + v[2]*(R12.z11-py11) + w[1]*w[1]*(pT12-R12.z6)**2 + w[2]*w[2]*(R12.z11-py11)**2')

import time
tt = time.time()

P0.run()

asked 23 Jul '15, 14:35

Grasshopper's gravatar image

Grasshopper
3719


It looks like the problem is the promotion on the input. That creates an input that feeds the value from py12 into R12.Z11. So when you add the parameter, it see that it is hooking up to a connected variable.

To get around this, try changing

self.create_passthrough('R12.z11', 'py12')

to

self.add('py12', Float(1.0, iotype='out'))
self.connect('R12.z11', 'py12')

Note, making this change in Opt2 and 3 got me past that error and brings me to another variable where you will need to make the same fix. I didn't check beyond that one.

link

answered 23 Jul '15, 15:08

Kenneth%20T%20Moore's gravatar image

Kenneth T Moore ♦
1.1k1212

edited 23 Jul '15, 15:09

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×43
×39
×27

Asked: 23 Jul '15, 14:35

Seen: 1,545 times

Last updated: 23 Jul '15, 15:09

powered by OSQA