TipsΒΆ
Always remember to set the directory variables (e.g.,
'/home/buyun/Documents/GitHub/PyGRANSO'
) in the tutorials to your specific PyGRANSO installation location and data folder.Please set
device = torch.device('cpu')
or do not specify it (default device is CPU) if your device does not support CUDA.combined_fn
has a required format. It only allows 1 input argument (we are usingX_struct
in tutorials) and must return three values, i.e.,[f,ci,ce]
, for objective value, inequality constraints and equality constraints, respectively. If there are no inequality constraints or/and equality constraints, one should setci=None
or/andce=None
.Advanced users may provide their own analytical gradients. In this case,
combined_fn
should return six values, i.e.,[f,f_grad,ci,ci_grad,ce,ce_grad]
for objective value, inequality constraints and equality constraints, and their corresponding gradients, respectively.Users should try to avoid the use of option
max_it
, since PyGRANSO has a reliable stopping criterion.