source: coopr.pyomo/stable/coopr/pyomo/tests/NL/CUTE/gigomez1_cute.py @ 3285

Last change on this file since 3285 was 3285, checked in by wehart, 10 years ago

Merged revisions 3184-3284 via svnmerge from
https://software.sandia.gov/svn/public/coopr/coopr.pyomo/trunk

........

r3188 | jwatson | 2010-10-29 08:09:35 -0600 (Fri, 29 Oct 2010) | 3 lines


Eliminating initial domain check when constructing numeric constants and the default domain (Reals) is specified.

........

r3203 | jwatson | 2010-10-29 14:46:18 -0600 (Fri, 29 Oct 2010) | 3 lines


Fixing bugs in has_discrete_variables() method of PyomoModel?.

........

r3211 | jdsiiro | 2010-11-01 14:49:11 -0600 (Mon, 01 Nov 2010) | 4 lines


bugfixes for Blocks:

  • avoid infinite loop when adding a block to a model
  • support pretty printing of user-defined components

........

r3212 | jdsiiro | 2010-11-02 15:17:13 -0600 (Tue, 02 Nov 2010) | 5 lines


  • cleaning up the management of Block._parent_block and Component.model attributes. Adding & removing blocks now updates the model attribute on all children
  • renaming Block._setattr_exec -> Block._add_component

........

r3213 | jdsiiro | 2010-11-03 10:47:06 -0600 (Wed, 03 Nov 2010) | 2 lines


Bugfix to the PyomoLogHandler? for python 2.4 compatibility

........

r3214 | jdsiiro | 2010-11-03 15:20:47 -0600 (Wed, 03 Nov 2010) | 3 lines


There is no point logging a warning when the problem is encountered
generating a logging.info message: log the warning at the info level.

........

r3215 | wehart | 2010-11-04 23:05:17 -0600 (Thu, 04 Nov 2010) | 3 lines


Adding a simple knapsack example to illustrate the difference between
a concrete and abstract model.

........

r3216 | jwatson | 2010-11-05 09:39:19 -0600 (Fri, 05 Nov 2010) | 3 lines


Fixing error diagnostic when indexing a variable with a bad index.

........

r3219 | jwatson | 2010-11-05 16:01:23 -0600 (Fri, 05 Nov 2010) | 3 lines


Supressing a validation test with NumericConstant?. If the user specifies a value, we are (now) assuming it is actually a numeric value - otherwise, the domain check significantly inflates the run-time associated with expression tree creation. This needs to be revisited in the Coopr 2.5 re-write.

........

r3226 | wehart | 2010-11-06 21:32:59 -0600 (Sat, 06 Nov 2010) | 2 lines


Setting up example, which was never converted.

........

r3233 | wehart | 2010-11-12 15:56:28 -0700 (Fri, 12 Nov 2010) | 4 lines


Migrating OS-specific functionality into coopr.os


Adding coopr.os to the dev.ini config file.

........

r3242 | wehart | 2010-11-13 01:28:57 -0700 (Sat, 13 Nov 2010) | 4 lines


Type fix.


Updating error message.

........

r3244 | wehart | 2010-11-13 10:44:26 -0700 (Sat, 13 Nov 2010) | 2 lines


Skipping OSiL writer when not defined.

........

r3246 | wehart | 2010-11-13 10:54:15 -0700 (Sat, 13 Nov 2010) | 2 lines


bug fix.

........

r3247 | wehart | 2010-11-13 11:14:01 -0700 (Sat, 13 Nov 2010) | 2 lines


Bug fix.

........

r3248 | jwatson | 2010-11-17 13:51:47 -0700 (Wed, 17 Nov 2010) | 3 lines


Interim fixes to output of quadratic terms in LP writer - more to do, but at least the basic examples now work.

........

r3254 | jwatson | 2010-11-19 13:19:19 -0700 (Fri, 19 Nov 2010) | 3 lines


Fixed bug in LP writer involving quadratic terms involving two distinct variables. Added two new quadratic examples.

........

r3257 | jwatson | 2010-11-19 13:59:35 -0700 (Fri, 19 Nov 2010) | 3 lines


Fixing diagnostic error message when attempting to solve quadratic programs with GLPK - code for generating message was not syntatically legal.

........

r3268 | jwatson | 2010-12-01 15:08:28 -0700 (Wed, 01 Dec 2010) | 3 lines


Fixing issues with the Piecewise construct when breakpoints and slopes are generated via rules. Works now (on a sample of size 1 - the newly added example5.py) for non-indexed rules, likely broken for indexed breakpoint/slope rules.

........

r3272 | jwatson | 2010-12-02 13:53:51 -0700 (Thu, 02 Dec 2010) | 3 lines


Adding omitted pprint() method for SOS constraints - identified while debugging a piecewise issue.

........

r3274 | jwatson | 2010-12-02 16:32:29 -0700 (Thu, 02 Dec 2010) | 3 lines


Adding example of Piecewise construct using breakpoint and slope rules, as opposed to explicit/direct lists.

........

r3276 | jwatson | 2010-12-03 14:06:40 -0700 (Fri, 03 Dec 2010) | 3 lines


Some progress toward functional indexed Piecewise components.

........

File size: 2.7 KB
Line 
1#  _________________________________________________________________________                                                                                \
2#                                                                                                                                                           \
3#  Coopr: A COmmon Optimization Python Repository                                                                                                           \
4#  Copyright (c) 2010 Sandia Corporation.                                                                                                                   \
5#  This software is distributed under the BSD License.                                                                                                      \
6#  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,                                                                                   \
7#  the U.S. Government retains certain rights in this software.                                                                                             \
8#  For more information, see the Coopr README.txt file.                                                                                                     \
9#  _________________________________________________________________________                                                                                \
10                                                                                                                                                             
11# Formulated in Pyomo by Carl D. Laird, Daniel P. Word, and Brandon C. Barrera                                                               
12# Taken from:     
13
14# AMPL Model by Hande Y. Benson
15#
16# Copyright (C) 2001 Princeton University
17# All Rights Reserved
18#
19# Permission to use, copy, modify, and distribute this software and
20# its documentation for any purpose and without fee is hereby
21# granted, provided that the above copyright notice appear in all
22# copies and that the copyright notice and this
23# permission notice appear in all supporting documentation.                     
24
25#   Source:
26#   C. Gigola and S. Gomez,
27#   "A Regularization Method for Solving the Finite Convex Min-Max Problem",
28#   SINUM 27(6), pp. 1621-1634, 1990.
29
30#   SIF input: Ph. Toint, August 1993.
31
32#   classification LQR2-AN-3-3
33
34from coopr.pyomo import *
35model = ConcreteModel()
36
37model.x = Var([1,2], initialize=2.0)
38model.z = Var(initialize=2.0)
39
40model.f = Objective(expr=model.z)
41
42model.cons1 = Constraint(expr=model.z+5.0*model.x[1]-model.x[2] >= 0)
43model.cons2 = Constraint(expr=model.z-4.0*model.x[2]-model.x[1]**2-model.x[2]**2 >= 0)
44model.cons3 = Constraint(expr=model.z-5.0*model.x[1]-model.x[2] >= 0)
45
Note: See TracBrowser for help on using the repository browser.