Modify free attributes in an OptimizationProblem

2 posts / 0 new
Last post
roel
Offline
Joined: 2010-02-23
Modify free attributes in an OptimizationProblem

Hi all,

Is it possible to modify the 'free' attribute of some of the variables in the OptimizationProblem? 

Something like this:

op = transfer_optimization_problem("VDP_Opt", "VDP_Opt.mop")

op.setattr('u', 'free', False) # don't optimize u

op.setattr('x1', 'free', True) # optimize x1

 

Thanks,

Roel

 

roel
Offline
Joined: 2010-02-23
For those who have the same

For those who have the same question: I found the solution burried in the user guide (section 6.5.2.3 of v2.1).

You have to do this:

op = transfer_optimization_problem("VDP_Opt", "VDP_Opt.mop")

op.getVariable('u').setAttribute('free', False)

 

You can also set 'min', 'max' and 'initialGuess' for any of the parameters.

 

hth,

Roel

Login or register to post comments