Using pyomo module in Matlab
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ileperff
am 16 Mai 2022
Kommentiert: hossein jbn
am 6 Sep. 2022
Hi everyone,
I'm currtly working on a project involving pyomo in matlab. I've managed to use other python modules in matlab (numpy for example), in different ways without any problem. It seems I've also succeed in creating a pyomo ConcreteModel from matlab. However, I can't get RangeSet() to work. I'll explain what I've tired and I hope someone can see what I've done wrong.
Fisrt with line command:
mod = py.importlib.import_module('pyomo');
py.RangeSet() % Option 1
py.pyomo.RangeSet() % Option 2
py.mod.RangeSet() % Option 3
None of this is working, each time I get the same error 'Unable to resolve the name py.RangeSet.'
Second I've try calling a pyhton file (testRangeFile.py):
mod = py.importlib.import_module('pyomo');
test = py.importlib.import_module('testRangeFile');
test.testRange(2)
test.testRangeFile.testRange(2)
My pyhton fuction for testing being:
def testRange(value):
from pyomo.environ import pyomo % also tried importing outside def
return pyomo.RangeSet(value)
In that case the error is 'Unrecognized method, property, or field 'testRange' for class 'py.module'.'
I don't know what else to try, and I can't figure out why this is not working when the other modules/functions are. If someone as an explanation so I uderstand best how this works it would help a lot.
Thanks for reading :)
PS: I'm using 2020b
1 Kommentar
hossein jbn
am 6 Sep. 2022
Hi my friend
i would like to add pyomo in matlab but i don't know how i can do it. please guide me. to contact me you can send an email to Hossein.jobran77@gmail.com.
thanks a lot
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!