Closed tosemml closed 10 months ago
Testing with this script:
from gekko import GEKKO
m = GEKKO(remote=True) # create GEKKO model
# create binary variables
x1 = m.Var(integer=True,lb=0,ub=1)
x2 = m.Var(integer=True,lb=0,ub=1)
m.Minimize(4*x1**2-4*x2*x1**2+x2**2+x1**2-x1+1)
m.options.SOLVER = 1 # APOPT solver
m.solver_options = ['minlp_gap_tol 0.1',\
'minlp_maximum_iterations 10000',\
'minlp_max_iter_with_int_sol 500']
m.open_folder()
m.solve()
print('x1: ' + str(x1.value[0]))
print('x2: ' + str(x2.value[0]))
The gk_write_files.py
script needs an additional \n
after the solver options join. Otherwise the changes look good.
These slight code adjustments aim to enhance Pythonic quality by incorporating the str.join function.