This topic describes tutorials to help you get started with Optimization Solver. The tutorials include the procedures for activating the service, downloading and installing the software, and configuring the license file, and an example on how to quickly solve an optimization problem.
1. Activate the service
You can log on to the Optimization Solver console to activate the service, and then obtain the license key from Available Service List.
Mathematical Programming Solution is free of charge during the public preview period. This means that you do not need to pay for activating and purchasing the service during public preview.
Activate the service
When you purchase the service, you need to log on to the Optimization Solver console and click Enable on the Overview page to activate the service. Then, you need to click Buy, and specify the validity period during which you want to use Optimization Solver and select the maximum number of solving tasks that are allowed to run concurrently. After purchasing the service, you can click Renew or Change to modify the configurations, as shown in the following figure.
View the purchased service and license key
Click Available Service List in the left-side navigation pane. The Available Service List page that shows details about the purchased service appears. You can view the license key on the page. See the following figure.
2. Download and install the SDK
You can install Optimization Solver of a specific version based on your business requirements. For information about how to download and install the software, see Download and install the latest Optimization Solver SDK.
3. Use the license key of Alibaba Cloud for authentication
Configure accounts for authentication
Optimization Solver requires a license to solve problems. After you purchase the service, you can see the license key on the Available Service List page. You can use the license key to configure the license file fl_client.ini
. For information about how to obtain the license file, see Step 4: Configure license files. We recommend that you use the environment variable MINDOPT_LICENSE_PATH
to specify a location for storing the license file. If the fl_client.ini
file does not exist, create one, copy the following sample content to the file, and modify the content based on your business requirements.
[security]
# key for client authentication
aliyun_license_key = xxx # Change the value of this parameter to the license key of the service that you purchase. You can obtain the license key from the Available Service List page of the Optimization Solver console.
aliyun_ak_id= xxx # Change the value of this parameter to the AccessKey ID of your Alibaba Cloud account or Resource Access Management (RAM) user.
aliyun_ak_secret= xxx # Change the value of this parameter to the AccessKey secret of your Alibaba Cloud account or RAM user.
# Copy the following content. You do not need to modify the content unless otherwise required.
[server]
# license server host
name = opt.us-east-1.aliyuncs.com #opt.cn-beijing.aliyuncs.com # Change the name to the endpoint of the region where you purchase the service.
# license server port 80 if absent
port = 443
# license server is https protocol
https = true
# client side request timeout in second
request_timeout = 2
In summary:
You need to modify the following account configurations in the fl_client.ini
file:
In the
security
section, change the value of thealiyun_license_key
parameter. You can view the license key on the Available Service List page of the Optimization Solver console.In the
security
section, change the values ofaliyun_ak_id
andaliyun_ak_secret
to the AccessKey ID and AccessKey secret of your Alibaba Cloud account or RAM user.
You can perform the following operations to create an AccessKey pair:
Log on to the Optimization Solver console, move the pointer over the profile picture in the upper-right corner of the page that appears, click AccessKey Management, and create an AccessKey pair on the page that appears.
You can also use the following methods to create an AccessKey pair:
Alibaba Cloud account: Create an AccessKey pair on the AccessKey Pair page.
RAM user: For information about how to create an AccessKey pair for a RAM user, see Create an AccessKey pair for a RAM user. After you create an AccessKey pair for a RAM user, you must use the Alibaba Cloud account to which the RAM user belongs to grant the permissions to manage Optimization Solver.
4. Example of quick problem solving
The SDK package contains an examples folder that provides sample code and sample data in various languages. Assume that you have correctly set the environment variable MINDOPT_HOME
by following the instructions in the installation document when you install Optimization Solver. The following examples show how to solve the optimization problem in an afiro.mps file:
Run command-line commands.
Linux or macOS
mindopt $MINDOPT_HOME/examples/data/afiro.mps
2. Windows
mindopt %MINDOPT_HOME%\examples\data\afiro.mps MaxTime=10800 SPX/MaxIterations=1000000000
Run Python code. (You can open the
mindopt.py
file to view the sample source code.)
Linux or macOS
python $MINDOPT_HOME/examples/python/mdo_mps.py --filename $MINDOPT_HOME/examples/data/afiro.mps
2. Windows
python "%MINDOPT_HOME%\examples\python\mdo_mps.py" --filename "%MINDOPT_HOME%\examples\data\afiro.mps"
Currently, Optimization Solver supports Python 3.6 and later. When you run the sample code in Python 3.8 or later, you may be prompted that the mindoptpy
file cannot be found. For information about how to handle this error, see Install the MindOpt Python software package.
For more information about how to use Optimization Solver, see User Manual of Optimization Solver.
The following example shows the solving results: