scipy.minimize ValueError:用户提供的目标函数必须返回标量值

问题描述

我已阅读文档并试图了解如何使用scipy.optimize.minimize(),但我做不到。

         [
             'label' => "Select Country",'name' => 'company_country','type' => 'select2_from_ajax','entity'   =>'country',//method
             'attribute' => 'name',//showing to user
             'model' => "App\Models\Country",//foreign key
             'data_source' => url('getCountry'),'placeholder' => 'Select country','minimum_input_length' => 3,'wrapperAttributes'=>['class'=>'form-group col-md-8'],] ```
In my controller i have this method for country

 ```
    public function getCountry($id)
    {
      return Country::find($id);
     } ``` 

What should go in Model and in the routes for that?
if someone provides a demo for the country,state and city,It is appreciatable. 


输出 ValueError:用户提供的目标函数必须返回标量值。” 或类似的东西

解决方法

我已经解决了:x0应该是数字或(1,)数组