Re: [AMPL 24563] Constraint not being recognized by AMPL/KNitro

20 views
Skip to first unread message

AMPL Google Group

unread,
Mar 5, 2023, 3:57:28 PM3/5/23
to AMPL Modeling Language
This question was cross-posted to our new user forum at https://discuss.ampl.com, and an answer has been posted there.


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.
{#HS:2169731368-114382#}
On Wed, Mar 1, 2023 at 4:05 AM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
Hello,

I am running into an issue when attempting to impose a constraint within my model. The constraint that I want to impose is that all values for a variable in a set are >=0. Unfortunately, when I solve the model, I get results that do not account for this constraint (i.e., many values for the variable are negative). As you can see in the output below, AMPL/knitro is stating that there is no constraints in my model.

I have set my constraint up as follows:

subject to effort_constraint {(t,o) in CHOICE_SETS}: effort[t,o] >=0;

where I have the following sets, variables, and data (for reserve):

set TIMES;
set OPTIONS;
set CHOICE_SETS within TIMES cross OPTIONS;
var a0 >= -3, <= 3 default .1;
var a_reserve >= -3, <= 3 default .1;
var effort {(t,o) in CHOICE_SETS} = a0 + a_reserve * reserve[t,o] ;

Below is the output from AMPL.

Substitution eliminates 1822104 variables.
Adjusted problem:
87 variables, all nonlinear
0 constraints
1 nonlinear objective; 87 nonzeros.

#presolve 0.016568 16777224 3103628912
#output 1.50372 0 3103628912
Artelys Knitro 12.4.0: outlev=6
par_numthreads=24

=======================================
Commercial License
Artelys Knitro 12.4.0
=======================================

Knitro presolve eliminated 0 variables and 0 constraints.

datacheck: 0
hessian_no_f: 1
outlev: 6
par_concurrent_evals: 0
par_numthreads: 24
The problem is identified as bound constrained only.
Knitro changing algorithm from AUTO to 1.
Knitro changing bar_initpt from AUTO to 3.
Knitro changing bar_murule from AUTO to 4.
Knitro changing bar_penaltycons from AUTO to 0.
Knitro changing bar_penaltyrule from AUTO to 2.
Knitro changing bar_switchrule from AUTO to 0.
Knitro changing hessopt from AUTO to 1.
Knitro changing honorbnds from AUTO to -1.
Knitro changing linesearch from AUTO to 2.
Knitro changing linsolver from AUTO to 2.

Problem Characteristics ( Presolved)
-----------------------
Objective goal: Maximize
Objective type: general
Number of variables: 87 ( 87)
bounded below only: 0 ( 0)
bounded above only: 0 ( 0)
bounded below and above: 87 ( 87)
fixed: 0 ( 0)
free: 0 ( 0)
Number of constraints: 0 ( 0)
linear equalities: 0 ( 0)
quadratic equalities: 0 ( 0)
gen. nonlinear equalities: 0 ( 0)
linear one-sided inequalities: 0 ( 0)
quadratic one-sided inequalities: 0 ( 0)
gen. nonlinear one-sided inequalities: 0 ( 0)
linear two-sided inequalities: 0 ( 0)
quadratic two-sided inequalities: 0 ( 0)
gen. nonlinear two-sided inequalities: 0 ( 0)
Number of nonzeros in Jacobian: 0 ( 0)
Number of nonzeros in Hessian: 3191 ( 3191)

Knitro using the Interior-Point/Barrier Direct algorithm.

Iter fCount Objective FeasError OptError ||Step|| CGits
-------- -------- -------------- ---------- ---------- ---------- -------
0 1 -1.460429e+05 0.000e+00
1 2 -1.341320e+05 0.000e+00 5.078e-02 8.307e-02 0
2 3 -1.316150e+05 0.000e+00 1.112e-01 1.163e-01 0
3 4 -1.309600e+05 0.000e+00 1.044e-02 8.668e-02 0
4 5 -1.301728e+05 0.000e+00 4.864e-03 1.824e-01 0
5 6 -1.286407e+05 0.000e+00 9.907e-03 4.115e-01 0
6 7 -1.266849e+05 0.000e+00 9.935e-03 7.502e-01 0
7 8 -1.258941e+05 0.000e+00 5.212e-03 6.593e-01 0
8 9 -1.251635e+05 0.000e+00 2.329e-03 1.040e+00 0
9 10 -1.244462e+05 0.000e+00 9.338e-03 1.600e+00 0
10 11 -1.238459e+05 0.000e+00 9.938e-03 2.256e+00 0
11 12 -1.233630e+05 0.000e+00 9.945e-03 3.311e+00 0
12 13 -1.227579e+05 0.000e+00 3.097e-02 6.443e+00 0
13 14 -1.220007e+05 0.000e+00 2.747e-02 1.096e+01 0
14 15 -1.211545e+05 0.000e+00 3.941e-02 1.736e+01 0
15 16 -1.205930e+05 0.000e+00 9.124e-03 1.914e+01 0
16 17 -1.203966e+05 0.000e+00 9.900e-03 1.586e+01 0
17 18 -1.203354e+05 0.000e+00 5.569e-03 1.359e+01 0
18 19 -1.203199e+05 0.000e+00 2.059e-03 1.047e+01 0
19 20 -1.203170e+05 0.000e+00 3.167e-04 7.431e+00 0
20 21 -1.203162e+05 0.000e+00 1.951e-05 7.389e+00 0
21 22 -1.203159e+05 0.000e+00 4.615e-06 7.874e+00 0
22 23 -1.203158e+05 0.000e+00 1.964e-06 5.499e+00 0
23 24 -1.203157e+05 0.000e+00 2.275e-07 1.881e+00 0

EXIT: Locally optimal solution found.

Final Statistics
----------------
Final objective value = -1.20315744045573e+05
Final feasibility error (abs / rel) = 0.00e+00 / 0.00e+00
Final optimality error (abs / rel) = 2.28e-07 / 2.28e-07
# of iterations = 23
# of CG iterations = 0
# of function evaluations = 24
# of gradient evaluations = 24
# of Hessian evaluations = 23
Total program time (secs) = 69.69688 ( 172.375 CPU time)
Time spent in evaluations (secs) = 69.03858

Solution Vector
---------------


===============================================================================

Knitro 12.4.0: Locally optimal or satisfactory solution.
objective -120315.744; feasibility error 0
23 iterations; 24 function evaluations

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ampl/48158864-f165-4fa4-bae9-c995526b2317n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages