classmethod Constraint.drop()
用法
drop
說明
drop
刪除約束中的所有實例,對應於 AMPL 代碼 drop constraintname;
。
示例
創建一個標量約束 c1 和一個索引約束 c2(使用
)並刪除它們。AMPL.eval
ampl.eval('var x{1..3}<=4;');
ampl.eval('maximize z: sum{i in 1..3} x[i];');
ampl.eval('c1: x[2] <= 1;');
ampl.eval('c2 {i in 1..3} : x[i] <= i;');
x = ampl.getVariable('x');
ampl.solve;
x.display
ampl.getConstraint('c1').drop
ampl.solve;
x.display
ampl.getConstraint('c2').drop
ampl.solve;
x.display
gives::
ans =
x [*] :=
1 1
2 1
3 3
;
ans =
x [*] :=
1 1
2 2
3 3
;
ans =
x [*] :=
1 4
2 4
3 4
;
相關用法
- Matlab AMPL Constraint.dual用法及代碼示例
- Matlab AMPL Constraint.body用法及代碼示例
- Matlab AMPL Constraint.lb用法及代碼示例
- Matlab AMPL Constraint.setDual用法及代碼示例
- Matlab AMPL Constraint.getValues用法及代碼示例
- Matlab AMPL Constraint.restore用法及代碼示例
- Matlab AMPL Constraint.ub用法及代碼示例
- Matlab AMPL Constraint.get用法及代碼示例
- Matlab AMPL ConstraintInstance.lb用法及代碼示例
- Matlab AMPL ConstraintInstance.ub用法及代碼示例
- Matlab AMPL ConstraintInstance.body用法及代碼示例
- Matlab AMPL ConstraintInstance.restore用法及代碼示例
- Matlab AMPL ConstraintInstance.setDual用法及代碼示例
- Matlab AMPL ConstraintInstance.drop用法及代碼示例
- Matlab AMPL ConstraintInstance.dual用法及代碼示例
- Matlab AMPL VariableInstance.ub用法及代碼示例
- Matlab AMPL Parameter.hasDefault用法及代碼示例
- Matlab AMPL SetInstance.contains用法及代碼示例
- Matlab AMPL Variable.getIntegrality用法及代碼示例
- Matlab AMPL DataFrame.setMatrix用法及代碼示例
注:本文由純淨天空篩選整理自ampl.com大神的英文原創作品 drop。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。