teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

プログラムの修正

2021/11/11 05:02

投稿

robocat
robocat

スコア4

title CHANGED
File without changes
body CHANGED
@@ -153,9 +153,9 @@
153
153
  problem += 7*x_e + 5* x_r <= 360
154
154
 
155
155
  ###新たに加えた制約
156
- if x_r.value >= 1:
156
+ if x_r.value() >= 1:
157
- y_r=1
157
+ y_r=1
158
- problem += y_r == 1
158
+ problem += y_r == 1
159
159
 
160
160
  # 最適化
161
161
  problem.solve()
@@ -170,8 +170,8 @@
170
170
 
171
171
  ```Result1
172
172
  ~省略~
173
- if x_r.value >= 1:
173
+ if x_r.value() >= 1:
174
- TypeError: '>=' not supported between instances of 'method' and 'int'
174
+ TypeError: '>=' not supported between instances of 'NoneType' and 'int'
175
175
  ```
176
176
 
177
177