Dear All,
I have a very beginner question. How to display all variables in an optimization model? For example, with this simple code, I want to display x1, x2, x3, and obj.
!pip install gamspy
!gamspy install license 5879d20c-aaa7-4cdf-9c92-c005b04a614f
import gamspy as gpy
from gamspy import Container,Variable,Sense
#Model
m = Container()
#definikan variabel-variabel
x1 = Variable(m, name=“x1”)
x2 = Variable(m, name=“x2”)
x3 = Variable(m, name=“x3”)
#definikan fungsi-fungsi kendala
con01 = gpy.Equation(m, name=“con01”, definition=x1 + 2*x2 >= 3)
con02 = gpy.Equation(m, name=“con02”, definition=x3 + x2 >= 5)
con03 = gpy.Equation(m, name=“con03”, definition=x1 + x3 == 4)
#Definiskan fungsi objektif
obj = x1 + 3x2 + 3x3
#Solve
LP = Model(m,
name=“LP”,
equations=[con01,con02,con03],
sense=Sense.MIN,
objective=obj)
LP.solve()
Thank you very much.