R: 在 lpSolveAPI 中,如何将 objective 函数从最小化变为最大化?

R: In lpSolveAPI, how do I change the objective function from minimization to maximization?

library(lpSolveAPI)
my.lp <- make.lp(nrow = 3, ncol = 2)
set.column(my.lp, 1, c(1, 1, 2))
set.column(my.lp, 2, c(3, 1, 0))
set.objfn(my.lp, c(1, 0))
set.constr.type(my.lp, rep("<=", 3))
set.rhs(my.lp, c(4, 2, 3))
set.bounds(my.lp, lower = c(-Inf, -Inf), upper = c(Inf, Inf))
> my.lp
Model name: 
            C1    C2       
Minimize     1     0       
R1           1     3  <=  4
R2           1     1  <=  2
R3           2     0  <=  3
Kind       Std   Std       
Type      Real  Real       
Upper      Inf   Inf       
Lower     -Inf  -Inf 

my.lp中,objective函数设置为最小化。我怎样才能将其更改为最大化?通过查看 set.objfn.

的帮助页面,我不清楚

设置意义 (minimize/maximize) 为 lp.control

lp.control(my.lp, sense="max")

my.lp
#Model name: 
#            C1    C2       
#Maximize     1     0       
#R1           1     3  <=  4
#R2           1     1  <=  2
#R3           2     0  <=  3
#Kind       Std   Std       
#Type      Real  Real       
#Upper      Inf   Inf       
#Lower     -Inf  -Inf       

solve(my.lp)    # returns 0, success
#[1] 0

get.variables(my.lp)
#[1] 1.5 0.0

get.objective(my.lp)
#[1] 1.5