我正在尝试运行一长串行来优化我的模型的第J列中的“最低成本”解决方案。
列C,D,E和F中有四个变量,从第9行到第50行,以及一些约束。
一般来说VBA相当新,但最初的单行解算器代码如下所示,基本上需要继续重复该过程,然后通过更改变量C10-F10,然后转到第11行等来解决J10。
非常感谢任何开始循环过程的指针!
干杯!
Sub Macro11()
SolverOk SetCell:="$J$9", MaxMinVal:=2, ValueOf:=0, ByChange:="$C$9:$F$9", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$C$9", Relation:=1, FormulaText:="23"
SolverAdd CellRef:="$D$9", Relation:=1, FormulaText:="23"
SolverOk SetCell:="$J$9", MaxMinVal:=2, ValueOf:=0, ByChange:="$C$9:$F$9", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$J$9", MaxMinVal:=2, ValueOf:=0, ByChange:="$C$9:$F$9", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverSolve
SolverOk SetCell:="$J$9", MaxMinVal:=2, ValueOf:=0, ByChange:="$C$9:$F$9", _
Engine:=1, EngineDesc:="GRG Nonlinear"
End Sub
答案 0 :(得分:0)
输入由表示范围的字符串定义,因此通过与循环变量连接来创建范围字符串:
File "/home/user/projects/project/.venv/lib/python3.6/site-packages/rest_framework/views.py", line 491, in dispatch
response = handler(request, *args, **kwargs)
File "/home/user/projects/project/companies/views.py", line 83, in add_bank_account
if serializer.is_valid(raise_exception=True):
File "/home/user/projects/project/.venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 236, in is_valid
self._validated_data = self.run_validation(self.initial_data)
File "/home/user/projects/project/.venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 434, in run_validation
value = self.to_internal_value(data)
File "/home/user/projects/project/.venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 458, in to_internal_value
fields = self._writable_fields
File "/home/user/projects/project/.venv/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/user/projects/project/.venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 369, in _writable_fields
field for field in self.fields.values()
File "/home/user/projects/project/.venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 362, in fields
for key, value in self.get_fields().items():
File "/home/user/projects/project/.venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 1021, in get_fields
source, info, model, depth
File "/home/user/projects/project/.venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 1166, in build_field
return self.build_unknown_field(field_name, model_class)
File "/home/user/projects/project/.venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 1278, in build_unknown_field
(field_name, model_class.__name__)